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

Ars::Thing Class Reference

#include <arsobject.h>

Inheritance diagram for Ars::Thing:

Inheritance graph
[legend]
Collaboration diagram for Ars::Thing:

Collaboration graph
[legend]

Public Member Functions

 Thing (void)
 ~Thing (void)
virtual void Init (icstring &aStr)
virtual void SetWindowRect (const XRect &WindowRect)
XRect GetWindowRect (void)
 A copy of the CRect that the window represents.

const bool IsVisible (void) const
void SetFgColor (const RGBColor &c)
 Assign a new foreground color (text color) to the object.

const RGBColorGetFgColor (void) const
void SetBgColor (const RGBColor &c)
 Assign a new background color to the object.

const RGBColorGetBgColor (void) const
const unsigned long GetFlags (void) const
void SetFlags (const unsigned long aFlg)
void ResetFlags (const unsigned long aFlg)
virtual const unsigned long GetStates (void) const
bool SetState (const unsigned long aNewState)
const bool ResetState (const unsigned long aNewState)
void EnableWindow (const bool enable)
const int GetId (void) const
const bool IsDirty (void) const
void SetDirty (const bool aDirty=true)

Private Attributes

unsigned long flags
 Flags of the object: determine how the object reacts.

unsigned long states
 State of the object: determine how the object is displayed.

RGBColor fg
 Foreground color by default black.

RGBColor bg
 Background color by default light grey.

int obId
 Identifier of the thing nice if unique - initialized with a unique id.


Constructor & Destructor Documentation

Ars::Thing::Thing void   ) 
 

Parameters:
XRect boundary of the object by default the object is not there.
the string argument to initialize the object

Definition at line 47 of file arsobject.cpp.

References bg, F_NONE, fg, Cfg::GetCfg(), Cfg::Handler::GetCfgColorHex(), Ars::idCnt, and S_NONE.

00048 : XRect( 0 , 0 , 0 , 0 ) , obId( ++idCnt ) , states( S_NONE ) , flags( F_NONE )
00049 , fg( 0 ,0 ,0 ) , bg( 0xd0 , 0xd0 , 0xd0 )
00050 {
00051         Cfg::Handler &h = Cfg::GetCfg();
00052         fg = h.GetCfgColorHex( "Ars" , "text_color" , fg );
00053         bg = h.GetCfgColorHex( "Ars" , "back_color" , bg );
00054 }

Ars::Thing::~Thing void   )  [inline]
 

Definition at line 68 of file arsobject.h.

00068 {};


Member Function Documentation

void Ars::Thing::EnableWindow const bool  enable  )  [inline]
 

Definition at line 127 of file arsobject.h.

References ResetState(), S_DISABLED, and SetState().

00128         {       if( enable )
00129                         ResetState( S_DISABLED );
00130                 else
00131                         SetState( S_DISABLED );
00132         }

const RGBColor& Ars::Thing::GetBgColor void   )  const [inline]
 

Definition at line 94 of file arsobject.h.

References bg.

Referenced by Ars::XLabel::AdjustColors(), Ars::XListBox::Draw(), Ars::XGroupBox::Draw(), Ars::XEditBox::Draw(), Ars::XCheckBox::Draw(), Ars::XBox::Draw(), Ars::Window::DrawBG(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), Ars::XLabel::RestoreColors(), and Ars::XEditBox::SetReadOnly().

00094 {       return bg;      }

const RGBColor& Ars::Thing::GetFgColor void   )  const [inline]
 

Definition at line 90 of file arsobject.h.

References fg.

Referenced by Ars::XListBox::AddItem(), Ars::XLabel::AdjustColors(), Ars::XTextBox::Draw(), Ars::XScrollBar::Draw(), Ars::XListBox::Draw(), Ars::XLabel::Draw(), Ars::XGroupBox::Draw(), Ars::XEditBox::Draw(), Ars::XCheckBox::Draw(), Ars::XBox::GetBorderColor(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XProgress::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), and Ars::XLabel::RestoreColors().

00090 {       return fg;      }

const unsigned long Ars::Thing::GetFlags void   )  const [inline]
 

Definition at line 96 of file arsobject.h.

References flags.

Referenced by Ars::Window::evMouseButtonDown(), Ars::XListBox::Init(), Init(), Ars::Window::IsVisible(), IsVisible(), Ars::XListBox::SetAllSelections(), Ars::XListBox::SetSelection(), and Ars::XEditBox::SetupWindow().

00096 {       return flags;   }

const int Ars::Thing::GetId void   )  const [inline]
 

Definition at line 134 of file arsobject.h.

References obId.

00134 {       return obId;    }

virtual const unsigned long Ars::Thing::GetStates void   )  const [inline, virtual]
 

Reimplemented in Ars::Painter.

Definition at line 100 of file arsobject.h.

References states.

Referenced by Init().

00100 {       return states;  }

XRect Ars::Thing::GetWindowRect void   )  [inline]
 

A copy of the CRect that the window represents.

Definition at line 84 of file arsobject.h.

Referenced by Ars::XLabel::Draw(), Ars::XImage::Draw(), Ars::XGroupBox::Draw(), Ars::XCheckBox::Draw(), Ars::XButtonImage::Draw(), Ars::XBox::Draw(), Ars::Window::DrawBG(), Ars::Form::FindWindowParent(), and Ars::Window::GetClientRect().

00084 { return *static_cast<XRect *>( this ); }

void Ars::Thing::Init icstring aStr  )  [virtual]
 

Initialize the thing object via a string the CAR identifiers used are: fg: foreground color (default is GetCfgColorHex( "Ars" , "text_color" )) bg: background color (default is GetCfgColorHex( "Ars" , "back_colors" )) flags: object flags - use mnemonics F_XXX|F_XXX (default is 0) states: object states - use mnemonics S_XXX|S_XXX (default is 0) id: object identifier (default is -1)

Reimplemented in Ars::Painter, Ars::Window, Ars::XButtonImage, Ars::XDropDown, Ars::XImage, Ars::XListBox, Ars::XMPEG, Ars::XProgress, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 56 of file arsobject.cpp.

References Ars::ExprIntParser::Apply(), bg, Ars::XRect::Bottom(), Ars::ExprIntParser::Eval(), fg, Cfg::GetCfg(), GetFlags(), GetStates(), icstring, obId, Ars::XRect::Right(), Ars::ArsApplication::scrH, Ars::ArsApplication::scrW, SetBgColor(), SetFgColor(), SetFlags(), SetState(), and SetWindowRect().

00057 {
00058         XRect   r;
00059 
00060         icstring        coordStr = Rsrc::FindCrdOf( aStr , "coord" );
00061         if( !coordStr.empty() )
00062         {
00063                 ExprIntParser   p;
00064                 string  buffer = Rsrc::FindCrdOf( coordStr , "x" ).c_str();
00065                 if( buffer.empty() )
00066                         r.x = Rsrc::GetInt( aStr , 0 );
00067                 else
00068                         r.x = p.Apply( p.Eval( buffer ) );
00069                 buffer = Rsrc::FindCrdOf( coordStr , "y" ).c_str();
00070                 if( buffer.empty() )
00071                         r.y = Rsrc::GetInt( aStr , 0 );
00072                 else
00073                         r.y = p.Apply( p.Eval( buffer ) );
00074                 buffer = Rsrc::FindCrdOf( coordStr , "w" ).c_str();
00075                 if( buffer.empty() )
00076                         r.w = Rsrc::GetInt( aStr , 0 );
00077                 else
00078                         r.w = p.Apply( p.Eval( buffer ) );
00079                 buffer = Rsrc::FindCrdOf( coordStr , "h" ).c_str();
00080                 if( buffer.empty() )
00081                         r.h = Rsrc::GetInt( aStr , 0 );
00082                 else
00083                         r.h = p.Apply( p.Eval( buffer ) );
00084         }
00085         else
00086         {
00087                 r.x = Rsrc::GetInt( aStr , 0 );
00088                 r.y = Rsrc::GetInt( aStr , 0 );
00089                 r.w = Rsrc::GetInt( aStr , 0 );
00090                 r.h = Rsrc::GetInt( aStr , 0 );
00091         }
00092 
00093         if( r.Right() >= Ars::ArsApplication::scrW )
00094                 r.w = (Ars::ArsApplication::scrW - 1) - r.x;
00095         if( r.Bottom() >= Ars::ArsApplication::scrH )
00096                 r.h = (Ars::ArsApplication::scrH - 1) - r.y;
00097 
00098         SetWindowRect( r );
00099 
00100         Cfg::Handler &h = Cfg::GetCfg();
00101 
00102         //      Get the foreground (tex color) and the background color
00103         icstring tmp = Rsrc::FindCrdOf( aStr , "fg" );
00104         SetFgColor( Rsrc::GetColor( tmp , fg ) );
00105         tmp = Rsrc::FindCrdOf( aStr , "bg" );
00106         SetBgColor( Rsrc::GetColor( tmp , bg ) );
00107 
00108         //      Get the flags and the states...
00109         tmp = Rsrc::FindCrdOf( aStr , "flags" );
00110         SetFlags( Rsrc::GetMnemo( tmp , ArsApplication::Mnemo_f , GetFlags() ) );
00111         tmp = Rsrc::FindCrdOf( aStr , "states" );
00112         SetState( Rsrc::GetMnemo( tmp , ArsApplication::Mnemo_s , GetStates() ) );
00113 
00114         tmp = Rsrc::FindCrdOf( aStr , "id" );
00115         obId = Rsrc::GetInt( tmp , obId );
00116 }

const bool Ars::Thing::IsDirty void   )  const [inline]
 

Definition at line 136 of file arsobject.h.

References F_DIRTY, and flags.

Referenced by Ars::Window::HandleMessage(), ResetState(), and SetState().

00136 {       return (flags & F_DIRTY) == F_DIRTY;    }

const bool Ars::Thing::IsVisible void   )  const [inline, virtual]
 

Reimplemented from Ars::MessageClient.

Reimplemented in Ars::Window.

Definition at line 86 of file arsobject.h.

References F_HIDETREE, and GetFlags().

00086 {       return (GetFlags() & F_HIDETREE) == F_HIDETREE; }

void Ars::Thing::ResetFlags const unsigned long  aFlg  )  [inline]
 

Definition at line 98 of file arsobject.h.

References flags, and SetDirty().

Referenced by Ars::Window::ShowWindow().

00098 {       if( flags & aFlg)       SetDirty();     flags &= ~aFlg; }

const bool Ars::Thing::ResetState const unsigned long  aNewState  )  [inline]
 

Definition at line 117 of file arsobject.h.

References IsDirty(), SetDirty(), and states.

Referenced by Ars::XGroupBox::Draw(), Ars::XCheckBox::Draw(), Ars::XButtonImage::Draw(), EnableWindow(), Ars::XButton::evMouseButtonUp(), Ars::XLabel::evMouseMove(), Ars::XEditBox::evMouseMove(), Ars::XButton::evMouseMove(), Ars::Painter::SetTextAlign(), and Ars::XCheckBox::ToggleCheck().

00118         {
00119                 if( (states & aNewState) != 0 )
00120                 {
00121                         SetDirty( true );
00122                         states &= ~aNewState;
00123                 }
00124                 return IsDirty();
00125         }

void Ars::Thing::SetBgColor const RGBColor c  )  [inline]
 

Assign a new background color to the object.

Definition at line 93 of file arsobject.h.

References bg.

Referenced by Ars::XLabel::AdjustColors(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), Init(), Ars::XLabel::RestoreColors(), and Ars::XEditBox::SetReadOnly().

00093 {       bg = c; }

void Ars::Thing::SetDirty const bool  aDirty = true  )  [inline]
 

Definition at line 137 of file arsobject.h.

References F_DIRTY, and flags.

Referenced by Ars::XListBox::AddItem(), Ars::XImage::ChangeImage(), Ars::XListBox::ClearItems(), Ars::Window::DrawProc(), Ars::XListBox::evKeyDown(), Ars::XEditBox::evKeyDown(), Ars::XScrollBar::evMouseButtonDown(), Ars::XListBox::evMouseButtonDown(), Ars::XEditBox::evMouseButtonDown(), Ars::XScrollBar::evMouseButtonUp(), Ars::XListBox::evMouseButtonUp(), Ars::XScrollBar::evMouseLClick(), Ars::XScrollBar::evMouseMove(), Ars::XEditBox::evMouseMove(), Ars::XTextBox::evValueChange(), Ars::XListBox::evValueChange(), Ars::XTextBox::evValueChanging(), Ars::XListBox::evValueChanging(), Ars::XListBox::RemoveItem(), ResetFlags(), ResetState(), Ars::XListBox::SetAllSelections(), SetFlags(), Ars::XImage::SetImageId(), Ars::XListBox::SetItemHeight(), Ars::XScrollBar::SetLimits(), Ars::XEditBox::SetReadOnly(), Ars::XListBox::SetSelection(), SetState(), Ars::XTextBox::SetWndText(), Ars::XLabel::SetWndText(), Ars::Window::SetWndText(), Ars::Form::ShutdownDialog(), Ars::Window::wmPaint(), and Ars::View::wmResize().

00138         {       
00139                 if( aDirty )    flags |= F_DIRTY;
00140                 else flags &= ~F_DIRTY;
00141         }

void Ars::Thing::SetFgColor const RGBColor c  )  [inline]
 

Assign a new foreground color (text color) to the object.

Definition at line 89 of file arsobject.h.

References fg.

Referenced by Ars::XLabel::AdjustColors(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), Init(), and Ars::XLabel::RestoreColors().

00089 {       fg = c; }

void Ars::Thing::SetFlags const unsigned long  aFlg  )  [inline]
 

Definition at line 97 of file arsobject.h.

References flags, and SetDirty().

Referenced by Ars::Window::HideWindow(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), and Init().

00097 {       if( (flags & aFlg) == 0)        SetDirty();     flags |= aFlg;  }

bool Ars::Thing::SetState const unsigned long  aNewState  )  [inline]
 

Definition at line 101 of file arsobject.h.

References IsDirty(), S_NONE, SetDirty(), and states.

Referenced by Ars::XGroupBox::Draw(), Ars::XCheckBox::Draw(), Ars::XButtonImage::Draw(), EnableWindow(), Ars::XButton::evMouseButtonDown(), Ars::XButton::evMouseButtonUp(), Ars::XLabel::evMouseMove(), Ars::XEditBox::evMouseMove(), Ars::XTextBox::Init(), Ars::XScrollBar::Init(), Ars::XListBox::Init(), Ars::XDropDown::Init(), Init(), Ars::Painter::SetTextAlign(), and Ars::XCheckBox::ToggleCheck().

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         }

virtual void Ars::Thing::SetWindowRect const XRect WindowRect  )  [inline, virtual]
 

Giving a control a new WindowRect will move and resize the control

Parameters:
WindowRect A CRect that defines the outer limits of the control

Reimplemented in Ars::Window, Ars::XListBox, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 81 of file arsobject.h.

Referenced by Init().

00081 { static_cast<XRect &>( *this ) = WindowRect; }


Field Documentation

RGBColor Ars::Thing::bg [private]
 

Background color by default light grey.

Definition at line 58 of file arsobject.h.

Referenced by GetBgColor(), Init(), SetBgColor(), and Thing().

RGBColor Ars::Thing::fg [private]
 

Foreground color by default black.

Definition at line 57 of file arsobject.h.

Referenced by GetFgColor(), Init(), SetFgColor(), and Thing().

unsigned long Ars::Thing::flags [private]
 

Flags of the object: determine how the object reacts.

Definition at line 54 of file arsobject.h.

Referenced by GetFlags(), IsDirty(), ResetFlags(), SetDirty(), and SetFlags().

int Ars::Thing::obId [private]
 

Identifier of the thing nice if unique - initialized with a unique id.

Definition at line 60 of file arsobject.h.

Referenced by GetId(), and Init().

unsigned long Ars::Thing::states [private]
 

State of the object: determine how the object is displayed.

Definition at line 55 of file arsobject.h.

Referenced by GetStates(), ResetState(), and SetState().


The documentation for this class was generated from the following files:
Generated on Fri Dec 5 04:06:49 2003 for Borqueror by doxygen 1.3.3