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

Go to the documentation of this file.
00001 /* $Id: container.hh,v 1.17 2003/08/05 14:23:15 reed Exp $ */
00002 
00003 
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 #ifndef _CONTAINER_HH_
00023 #define _CONTAINER_HH_
00024 
00025 #if defined(_WIN32) && defined(_MSC_VER)
00026 # ifdef VOSGUI_EXPORTS
00027 #  define VOSGUI_API __declspec(dllexport)
00028 # else
00029 #  define VOSGUI_API __declspec(dllimport)
00030 # endif
00031 #else
00032 # define VOSGUI_API
00033 #endif
00034 
00035 #include <vector>
00036 
00037 #include <vos/corelibs/vos/vos.hh>
00038 #include <vos/metaobjects/property/property.hh>
00039 #include <vos/gui/gui/widget.hh>
00040 
00041 
00042 namespace VOSGUI
00043 {
00044 
00045     /** MetaObject implementing the "container" Object Type.  
00046     */
00047     class VOSGUI_API Container : public virtual Widget
00048     {
00049 
00050     public:
00051 
00052         /** Constructor */
00053         Container(MetaObject* superobject);
00054 
00055         /*** Destructor */
00056         virtual ~Container();
00057 
00058         /** Return type string ("gui:container") */
00059         virtual const string getType();
00060 
00061         /** Register Extenders */
00062         static void registerExtenders();
00063 
00064         /** @name Access Subobjects */
00065         //@{
00066 
00067         string getLayout();
00068         void setLayout(const string& value, PropertyAccessControl* ac = 0);
00069         bool getBorder();
00070         void setBorder(bool value = true, PropertyAccessControl* ac = 0);
00071 
00072         bool getCompact();
00073         void setCompact(bool val = true, PropertyAccessControl* ac = 0);
00074         void setCompactObject(Property* obj);
00075         Property* getCompactObject();
00076 
00077         //@}
00078 
00079         /** Show remote containers (force raise if it has been hidden by the user, 
00080             e.g. re-open a closed window. */
00081         virtual void raise() = 0;
00082 
00083 #if 0
00084        virtual void hide() = 0;
00085 
00086         /** Notification that remote container was hidden (e.g. user closed a
00087             window) */
00088         virtual void hidden() = 0;
00089 #endif
00090 
00091 
00092     };
00093 
00094 
00095 
00096     /** Local version of Container. */
00097 
00098     class VOSGUI_API LocalContainer : public virtual Container, public virtual LocalWidget
00099     {
00100     private:
00101         /** If a container is a "top level" member of a display -- ie, a window
00102          *  -- then we might want to send it explicit set visible messages to force
00103          *  it to be displayed and raised.  To get added to this set, a remote
00104          *  container object needs to send a "gui:start-listening" message with
00105          *  a value of "raise". 
00106          */  
00107         vector<Vobject*> remoteWindows;
00108 
00109     public:
00110 
00111         /** Constructor */
00112         LocalContainer(MetaObject* superobject);
00113 
00114         /** Static generator, for factory. */
00115         static MetaObject* new_LocalContainer(MetaObject* superobject, const string& type);
00116 
00117         /** Send a "raise" message to remote windows, asking them to show this
00118             container on top if it is currently hidden. */
00119         virtual void raise();
00120 
00121 //        virtual void hide();
00122 
00123         /* Override this to do something when a "hidden" message is recieved. */
00124  //       virtual void hidden();
00125 
00126     private:
00127 //        virtual void handleHidden(Message* m);
00128          virtual void handleStartListening(Message* m);
00129 
00130     };
00131 
00132 
00133 /** Remote version of Container. */
00134     class VOSGUI_API RemoteContainer : public virtual Container, public virtual RemoteWidget
00135     {
00136     public:
00137 
00138         /** Constructor */
00139         RemoteContainer(MetaObject* superobject);
00140 
00141         /** Static generator, for factory. */
00142         static MetaObject* new_RemoteContainer(MetaObject* superobject, const string& type);
00143 
00144         /** Override this to do something when a "raise" message is recieved. */
00145         virtual void raise();
00146 
00147 #if 0
00148         virtual void hide();
00149 
00150         /** Send a "hidden" message to the local object, indicating that this
00151             remote container was closed or hidden by the user. */
00152         void hidden();
00153 
00154         /** Start listening for a "show-container" or "hide-container"  message 
00155           * from the local object.
00156           * A display client implementing the Remote GUI classes typically would
00157           * call this on top-level containers -- windows -- in the display. */
00158         void startListeningForShow(); 
00159     
00160  
00161 #endif
00162     protected:
00163 
00164         virtual void handleRaise(Message* m);
00165 //        virtual void handleHide(Message* m);
00166 
00167     };
00168 }
00169 
00170 #endif // #ifdef _CONTAINER_HH_
00171 

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