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/select_boolean.cc

Go to the documentation of this file.
00001 /* $Id: select_boolean.cc,v 1.10 2003/07/23 00:17:21 reed Exp $ */
00002 
00003 /** @file select_boolean.cc Code: a MetaObject for widget.select.boolean object types. 
00004 
00005     Copyright (C) 2002 Reed Hedges
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 
00021 */
00022 
00023 #include <vos/corelibs/vos/vos.hh>
00024 #include <vos/metaobjects/property/property.hh>
00025 #include "select_boolean.hh"
00026 
00027 using namespace VOSGUI;
00028 
00029 /* Constructor */
00030 SelectBoolean::SelectBoolean(MetaObject* s) : MetaObject(s), Select(s), Widget(s)
00031 {
00032 }
00033 
00034 /* Destructor */
00035 SelectBoolean::~SelectBoolean() {
00036 }
00037 
00038 
00039 LocalSelectBoolean::LocalSelectBoolean(MetaObject* s) : SelectBoolean(s), MetaObject(s), Select(s), LocalSelect(s), Widget(s), LocalWidget(s)
00040 {
00041 }
00042 
00043 LocalSelectBoolean::~LocalSelectBoolean() {
00044 }
00045 
00046 
00047 
00048 RemoteSelectBoolean::RemoteSelectBoolean(MetaObject* s) : SelectBoolean(s), MetaObject(s), Select(s), RemoteSelect(s), Widget(s), RemoteWidget(s)
00049 {
00050 }
00051 
00052 RemoteSelectBoolean::~RemoteSelectBoolean() {
00053 }
00054 
00055 /* Return type string ("gui:widget.select.boolean") */
00056 
00057 const string SelectBoolean::getType() {
00058     return string("gui:widget.select.boolean");
00059 }
00060 
00061 /* Register extenders with libvos MetaFactory */
00062 void SelectBoolean::registerExtenders() {
00063     LocalSite::addLocalObjectExtension(typeid(LocalSelectBoolean).name(), &LocalSelectBoolean::new_LocalSelectBoolean);
00064     LocalSite::addLocalObjectExtension(typeid(SelectBoolean).name(), &LocalSelectBoolean::new_LocalSelectBoolean);
00065     LocalSite::addLocalObjectExtension("gui:widget.select.boolean", &LocalSelectBoolean::new_LocalSelectBoolean);
00066     RemoteSite::addRemoteObjectExtension(typeid(RemoteSelectBoolean).name(), &RemoteSelectBoolean::new_RemoteSelectBoolean);
00067     RemoteSite::addRemoteObjectExtension(typeid(SelectBoolean).name(), &RemoteSelectBoolean::new_RemoteSelectBoolean);
00068     RemoteSite::addRemoteObjectExtension("gui:widget.select.boolean", &RemoteSelectBoolean::new_RemoteSelectBoolean);
00069 }
00070 
00071 /* Get and set Subproperties and other Subobjects */
00072 
00073 bool SelectBoolean::getTarget() {
00074     string s;
00075     vRef<Vobject> v = findObject("gui:target");
00076     Property* p = meta_cast<Property*>(&v);
00077     if(!p) throw bad_cast();
00078     p->read(s);
00079     return(s == "yes");
00080 }
00081 
00082 
00083 void SelectBoolean::setTarget(bool value,  PropertyAccessControl* ac) {
00084     if(ac == NULL)
00085         ac = accessControl;
00086     Property::setProperty(*this, "gui:target", (value)?"yes":"no", "text/x-yes-no", ac);
00087 }
00088 
00089 Property* SelectBoolean::getTargetObj() {
00090     return meta_cast<Property*>(&findObject("gui:target"));
00091 }
00092 
00093 
00094 void SelectBoolean::setTargetObj(Property* p) {
00095     try {
00096         vRef<ParentChildRelation> c = findChild("gui:target");
00097         setChild(c->position, "gui:target", p);
00098     } catch(NoSuchObjectError) {
00099         insertChild(-1, "gui:target", p);
00100     }
00101 }
00102 
00103 
00104 
00105 /* Generators for factory */
00106 
00107 
00108 MetaObject* LocalSelectBoolean::new_LocalSelectBoolean(MetaObject *s, const string& type) {
00109     LocalSelectBoolean* o = new LocalSelectBoolean(s);
00110     return o;
00111 }
00112 
00113 MetaObject* RemoteSelectBoolean::new_RemoteSelectBoolean(MetaObject *s, const string& type) {
00114     return new RemoteSelectBoolean(s);
00115 }
00116 

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