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/widget.hh

Go to the documentation of this file.
00001 /* $Id: widget.hh,v 1.19 2003/08/05 14:23:15 reed Exp $ */
00002 
00003 /** @file widget.hh Defines MetaObject class for gui:widget type (revision 0). */
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 #ifndef _WIDGET_HH_
00024 #define _WIDGET_HH_
00025 
00026 #if defined(_WIN32) && defined(_MSC_VER)
00027 # ifdef VOSGUI_EXPORTS
00028 #  define VOSGUI_API __declspec(dllexport)
00029 # else
00030 #  define VOSGUI_API __declspec(dllimport)
00031 # endif
00032 #else
00033 # define VOSGUI_API
00034 #endif
00035 
00036 #include <vos/corelibs/vos/vos.hh>
00037 #include <vos/metaobjects/property/property.hh>
00038 
00039 /** VOS Graphical User Interface */
00040 namespace VOSGUI
00041 {
00042 
00043 /** MetaObject implementing "gui:widget" Object Type.  */
00044 
00045     class VOSGUI_API Widget : public virtual MetaObject
00046     {
00047 
00048     protected:
00049         PropertyAccessControl* accessControl;
00050 
00051 
00052     public:
00053 
00054         /** Constructor */
00055         Widget(MetaObject* superobject);
00056 
00057         /** Return type string ("gui:widget") */
00058         virtual const string getType();
00059 
00060         /** Destructor */
00061         virtual ~Widget();
00062 
00063         /** Register Extenders */
00064         static void registerExtenders();
00065 
00066         /** Set default access control policy */
00067         virtual void setPropertyAccessControl(PropertyAccessControl* ac);
00068 
00069         /** Get default access control policy */
00070         virtual PropertyAccessControl* getPropertyAccessControl();
00071 
00072 
00073         /** Initialize required subproperties with given access control and
00074             set that as the default. */
00075         virtual void initialize(PropertyAccessControl* ac);
00076 
00077         /** Initialize required subproperties. If access control has been
00078             previously set with initialize(PropertyAccessControl*) or
00079             setPropertyAccessControl(), then that policy will be used. Otherwise,
00080             NoPropertyAccessControl will be used.
00081         */
00082         virtual void initialize();
00083 
00084 
00085 
00086         /** @name Access Subobjects */
00087         //@{
00088 
00089         /** Get the value of gui:alignment property  */
00090         virtual string getAlignment();
00091 
00092         /** Get the value of gui:padding property */
00093         virtual int getPadding();
00094 
00095         /** Get the value of the gui:proportion property. */
00096         virtual int getProportion();
00097 
00098         /** Set alignment property.
00099             @param value    Property value. Must be one of the following:
00100             <dl>
00101             <dt>center</dt>
00102             <dt>fill</dt>
00103             <dt>expand</dt>
00104             <dt>top</dt>
00105             <dt>bottom</dt>
00106             <dt>left</dt>
00107             <dt>right</dt>
00108             </dl>
00109             @param ac   Access control policy. If omitted, a pointer to
00110             NoPropertyAccessControl::static_ will be used.
00111         */
00112         virtual void setAlignment(const string& value, PropertyAccessControl* ac = 0);
00113 
00114         /** Set gui:padding property.
00115             @param value The new value
00116             @param ac Property access control policy. If omitted, then &NoAccessControl::static_ will be used.
00117         */
00118         virtual void setPadding(int value, PropertyAccessControl* ac = 0);
00119 
00120         /** Set the gui:proportion value.
00121          * @param value the new value
00122          * @param ac Property access control policy. if omitted, then
00123          * &NoAccessControl::static_ will be used.
00124          */
00125         virtual void setProportion(int value, PropertyAccessControl* ac = 0);
00126 
00127         /** Get gui:label property. 
00128             @throw Vobject::NoSuchObjectError if there is no label property.
00129             @throw bad_cast if "gui:label" is not a property.
00130         */
00131         virtual string getLabel();
00132         
00133         /** Set gui:label property. */
00134         virtual void setLabel(const string& value, const string& datatype = "text/plain", PropertyAccessControl* ac = 0);
00135 
00136         /** Set Vobject for the gui:label property. */
00137         virtual void setLabelObj(Property* newobj);
00138 
00139         /** Get datatype for label property. */
00140         virtual string getLabelDatatype();
00141             
00142         /** Get Vobject for the gui:label property.
00143             @throw Vobject::NoSuchObjectError if no label object exists
00144             @throw bad_cast if the label object is not a property.
00145         */
00146         virtual Property* getLabelObj();
00147 
00148         /** Set enabled or disabled ("dimmed") */
00149         virtual void setEnabled(bool q = true, PropertyAccessControl* defaultAC = &NoPropertyAccessControl::static_);
00150 
00151         /** Get enabled or disabled */
00152         virtual bool getEnabled();
00153 
00154         /** Set enabled or disabled object */
00155         virtual void setEnabledObj(Property* obj);
00156 
00157         /** Get enabled or disabled object */
00158         virtual Property* getEnabledObj();
00159 
00160         /** Set visible  */
00161         virtual void setVisible(bool q = true, PropertyAccessControl* defaultAC = &NoPropertyAccessControl::static_);
00162 
00163         /** Get visible  */
00164         virtual bool getVisible();
00165 
00166         /** Set visible property object */
00167         virtual void setVisibleObj(Property* obj);
00168 
00169         /** Get visible property object */
00170         virtual Property* getVisibleObj();
00171         
00172         
00173         //@}
00174         
00175 
00176 
00177     protected:
00178         void setOrInsertChild(const string& name, Vobject* obj);
00179 
00180 
00181     };
00182 
00183 
00184 
00185 /** Local version of Widget. */
00186     class VOSGUI_API LocalWidget : public virtual Widget
00187     {
00188 
00189     public:
00190 
00191         /** Constructor */
00192         LocalWidget(MetaObject* superobject);
00193 
00194         /** Static generator, for factory. */
00195         static MetaObject* new_LocalWidget(MetaObject* superobject, const string& type);
00196 
00197     };
00198 
00199 
00200 /** Remote version of Widget. */
00201     class VOSGUI_API RemoteWidget : public virtual Widget
00202     {
00203     public:
00204 
00205         /** Constructor */
00206         RemoteWidget(MetaObject* superobject);
00207 
00208         /** Static generator, for factory. */
00209         static MetaObject* new_RemoteWidget(MetaObject* superobject, const string& type);
00210 
00211     };
00212 }
00213 
00214 #endif // #ifdef _WIDGET_HH_
00215 

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