Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

arsobject.h

Go to the documentation of this file.
00001 #if !defined( __ARSOBJ_H__ )
00002 #define __ARSOBJ_H__
00003 
00004 namespace Ars
00005 {
00006 
00007         //      Button: UP - DOWN - DISABLED
00008         //      Check:  Unchecxked - checked - disabled
00009         //      Dropdown: allow_edit
00010         //      CEdit: readOnly - Password
00011         //      ListBox: multipleSelection
00012         //      Picture: DrawBorder
00013         
00014 #define F_NONE                  0x00000000
00015 #define F_SELECTABLE    0x00000001
00016 #define F_EXIT                  0x00000002
00017 #define F_EDITABLE              0x00000004
00018 #define F_HIDETREE              0x00000008
00019 #define F_INDIRECT              0x00000010 
00020 #define F_PASSWORD         (0x00000020 | F_EDITABLE)
00021 #define F_MULTISELECT  (0x00000040 | F_SELECTABLE)
00022 #define F_TABSTOP               0x00000080
00023 #define F_DIRTY                 0x00000100
00024 #define F_FOLLOWMOUSE   0x00000200
00025 
00026 #define S_NONE                  0x00000000
00027 #define S_SELECTED              0x00000001
00028 #define S_DISABLED              0x00000002
00029 #define S_CHECKED               0x00000004
00030 #define S_OUTLINED              0x00000008
00031 #define S_SHADOWED              0x00000010
00032 #define S_BORDER                0x00000020
00033 #define S_FOCUS                 0x00000040
00034 #define S_HIGHLIGHT             0x00000080
00035 
00036 #define S_ALIGN_LEFT    0x00000100
00037 #define S_ALIGN_RIGHT   0x00000200
00038 #define S_ALIGN_TOP             0x00000400
00039 #define S_ALIGN_BOTTOM  0x00000800
00040 #define VALIGN_MASK     (S_ALIGN_TOP|S_ALIGN_BOTTOM)
00041 #define HALIGN_MASK     (S_ALIGN_LEFT|S_ALIGN_RIGHT)
00042 
00043 #define S_RAISED                0x00001000
00044 #define S_SUNKEN                0x00002000
00045 
00046 #define S_TRANSPARENT           0x00004000
00047 #define S_INVERTONFOLLOW        0x00008000
00048 
00049 #define MAY_GAINFOCUS   (F_SELECTABLE|F_EDITABLE|F_EXIT|F_TABSTOP)
00050 
00051 class Thing : public XRect , public MessageClient       {
00052 private:
00053         
00054         unsigned long   flags;  
00055         unsigned long   states; 
00056 
00057         RGBColor        fg;             
00058         RGBColor        bg;             
00059 
00060         int     obId;                   
00061 
00062 public:
00063         // Constructor
00066         Thing( void );
00067 
00068         ~Thing( void )  {};
00069 
00077         virtual void Init( icstring &aStr );
00078 
00081         virtual void SetWindowRect( const XRect &WindowRect ) { static_cast<XRect &>( *this ) = WindowRect; }
00082 
00084         XRect GetWindowRect( void ) { return *static_cast<XRect *>( this ); }
00085 
00086         const bool IsVisible( void ) const      {       return (GetFlags() & F_HIDETREE) == F_HIDETREE; }
00087 
00089         void SetFgColor( const RGBColor &c )    {       fg = c; }
00090         const RGBColor &GetFgColor( void ) const        {       return fg;      }
00091 
00093         void SetBgColor( const RGBColor &c )    {       bg = c; }
00094         const RGBColor &GetBgColor( void ) const        {       return bg;      }
00095 
00096         const unsigned long GetFlags( void ) const              {       return flags;   }
00097         void SetFlags( const unsigned long aFlg )               {       if( (flags & aFlg) == 0)        SetDirty();     flags |= aFlg;  }
00098         void ResetFlags( const unsigned long aFlg )             {       if( flags & aFlg)       SetDirty();     flags &= ~aFlg; }
00099         
00100         virtual const unsigned long GetStates( void ) const     {       return states;  }
00101         bool SetState( const unsigned long aNewState )
00102         {
00103                 if( aNewState == S_NONE )
00104                 {
00105                         if( states !=  S_NONE )
00106                                 SetDirty( true );
00107                         states = aNewState;
00108                 }
00109                 else if( (states & aNewState) != aNewState )
00110                 {
00111                         SetDirty( true );
00112                         states |= aNewState;
00113                 }
00114                 return IsDirty();
00115         }
00116         
00117         const bool ResetState( const unsigned long aNewState )
00118         {
00119                 if( (states & aNewState) != 0 )
00120                 {
00121                         SetDirty( true );
00122                         states &= ~aNewState;
00123                 }
00124                 return IsDirty();
00125         }
00126         
00127         void EnableWindow( const bool enable )
00128         {       if( enable )
00129                         ResetState( S_DISABLED );
00130                 else
00131                         SetState( S_DISABLED );
00132         }
00133 
00134         const int GetId( void ) const   {       return obId;    }
00135 
00136         const bool IsDirty( void ) const        {       return (flags & F_DIRTY) == F_DIRTY;    }
00137         void SetDirty( const bool aDirty = true )       
00138         {       
00139                 if( aDirty )    flags |= F_DIRTY;
00140                 else flags &= ~F_DIRTY;
00141         }
00142 };
00143 
00144 }
00145 #endif

Generated on Fri Dec 5 04:05:59 2003 for Borqueror by doxygen 1.3.3