00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00030 SelectBoolean::SelectBoolean(MetaObject* s) : MetaObject(s), Select(s), Widget(s)
00031 {
00032 }
00033
00034
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
00056
00057 const string SelectBoolean::getType() {
00058 return string("gui:widget.select.boolean");
00059 }
00060
00061
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
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
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