Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/gui/gui/input_numeric_slider.cc

Go to the documentation of this file.
00001 /* $Id: input_numeric_slider.cc,v 1.5 2003/07/23 00:17:20 reed Exp $ */
00002 
00003 /*  Copyright (C) 2003 Reed Hedges <reed@interreality.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00018 
00019 */
00020 
00021 
00022 
00023 #include <vos/corelibs/vos/vos.hh>
00024 #include <vos/metaobjects/property/property.hh>
00025 #include "input_numeric_slider.hh"
00026 
00027 using namespace VOSGUI;
00028 
00029 /* Constructor */
00030 SliderNumericInput::SliderNumericInput(MetaObject* s) : NumericInput(s),
00031     Input(s), Widget(s), MetaObject(s)
00032 {
00033 }
00034 
00035 /* Destructor */
00036 SliderNumericInput::~SliderNumericInput() {
00037 }
00038 
00039 
00040 LocalSliderNumericInput::LocalSliderNumericInput(MetaObject* s) :
00041     SliderNumericInput(s), LocalNumericInput(s), NumericInput(s), LocalInput(s),
00042     Input(s), LocalWidget(s), Widget(s), MetaObject(s)
00043 {
00044 }
00045 
00046 LocalSliderNumericInput::~LocalSliderNumericInput() {
00047 }
00048 
00049 /* Initialize required subobjects: */
00050 
00051 void LocalSliderNumericInput::initialize(PropertyAccessControl* ac) {
00052     LocalNumericInput::initialize(ac);
00053 }
00054 
00055 
00056 
00057 RemoteSliderNumericInput::RemoteSliderNumericInput(MetaObject* s) :
00058     SliderNumericInput(s), RemoteNumericInput(s), NumericInput(s),
00059     RemoteInput(s), Input(s), RemoteWidget(s), Widget(s), MetaObject(s)
00060 {
00061 
00062 }
00063 
00064 RemoteSliderNumericInput::~RemoteSliderNumericInput() {
00065 }
00066 
00067 /* Return type string ("gui:widget.input") */
00068 
00069 const string SliderNumericInput::getType() {
00070     return string("gui:widget.input.numeric.slider");
00071 }
00072 
00073 /* Register extenders with libvos MetaFactory */
00074 void SliderNumericInput::registerExtenders() {
00075     LocalSite::addLocalObjectExtension(typeid(LocalSliderNumericInput).name(), &LocalSliderNumericInput::new_LocalSliderNumericInput);
00076     LocalSite::addLocalObjectExtension(typeid(SliderNumericInput).name(), &LocalSliderNumericInput::new_LocalSliderNumericInput);
00077     LocalSite::addLocalObjectExtension("gui:widget.input.numeric.slider", &LocalSliderNumericInput::new_LocalSliderNumericInput);
00078     RemoteSite::addRemoteObjectExtension(typeid(RemoteSliderNumericInput).name(), &RemoteSliderNumericInput::new_RemoteSliderNumericInput);
00079     RemoteSite::addRemoteObjectExtension(typeid(SliderNumericInput).name(), &RemoteSliderNumericInput::new_RemoteSliderNumericInput);
00080     RemoteSite::addRemoteObjectExtension("gui:widget.input.numeric.slider", &RemoteSliderNumericInput::new_RemoteSliderNumericInput);
00081 }
00082 
00083 /* Get and set Subproperties and other Subobjects */
00084 
00085 string SliderNumericInput::getOrientation() {
00086     string s;
00087     try {
00088         vRef<Vobject> v = &findObject("gui:orientation");
00089         Property* p = meta_cast<Property*>(&v);
00090         if(!p) throw bad_cast();
00091         p->read(s);
00092     } catch(...) {
00093         s = "vertical";
00094     }
00095     return s;
00096 }
00097 
00098 void SliderNumericInput::setOrientation(const string& value, PropertyAccessControl* ac) {
00099     if(!ac) ac = accessControl;
00100     Property::setProperty(*this, "gui:orientation", value, "text/plain", ac);
00101 }
00102 
00103 Property* SliderNumericInput::getOrientationObject() {
00104     return meta_cast<Property*>(&findObject("gui:orientation"));
00105 }
00106 
00107 void SliderNumericInput::setOrientationObject(Property* newobj) {
00108     try {
00109         vRef<ParentChildRelation> pcr = findChild("gui:orientation");
00110         setChild(pcr->position, "gui:orientation", newobj);
00111     } catch (NoSuchObjectError) {
00112         insertChild(-1, "gui:orientation", newobj);
00113     }
00114 }
00115 
00116 bool SliderNumericInput::getShowLabels() {
00117     return Property::getBoolProperty(*this, "gui:show-labels", true);
00118 }
00119 
00120 void SliderNumericInput::setShowLabels(bool value, PropertyAccessControl* ac) {
00121     if(!ac) ac = accessControl;
00122     Property::setBoolProperty(*this, "gui:show-labels", value, ac);
00123 }
00124 
00125 Property* SliderNumericInput::getShowLabelsObject() {
00126     return meta_cast<Property*>(&findObject("gui:show-labels"));
00127 }
00128 
00129 void SliderNumericInput::setShowLabelsObject(Property* newobj) {
00130     try {
00131         vRef<ParentChildRelation> pcr = findChild("gui:show-labels");
00132         setChild(pcr->position, "gui:show-labels", newobj);
00133     } catch (NoSuchObjectError) {
00134         insertChild(-1, "gui:show-labels", newobj);
00135     }
00136 }
00137 
00138 
00139 
00140 /* Generators for factory */
00141 
00142 MetaObject* LocalSliderNumericInput::new_LocalSliderNumericInput(MetaObject *s, const string& type) {
00143     LocalSliderNumericInput* o = new LocalSliderNumericInput(s);
00144     return o;
00145 }
00146 
00147 MetaObject* RemoteSliderNumericInput::new_RemoteSliderNumericInput(MetaObject *s, const string& type) {
00148     return new RemoteSliderNumericInput(s);
00149 }
00150 

Generated on Tue Aug 12 03:55:43 2003 for Interreality Project - VOS by doxygen 1.3.2