Widget Class Reference

#include <widget.h>

Inheritance diagram for Widget:

Inheritance graph
[legend]
Collaboration diagram for Widget:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Widget ()
 Widget (const Rectanglei &rect)
virtual ~Widget ()
virtual void Update (const Point2i &mousePosition, const Point2i &lastMousePosition, Surface &surf)
virtual void Draw (const Point2i &mousePosition, Surface &surf) const =0
virtual void ForceRedraw ()
virtual void SendKey (SDL_keysym key)
virtual WidgetClic (const Point2i &mousePosition, uint button)
void SetContainer (Container *_ct)
virtual void SetSizePosition (const Rectanglei &rect)=0
void SetXY (int _x, int _y)

Public Attributes

bool have_focus

Protected Member Functions

void StdSetSizePosition (const Rectanglei &rect)

Protected Attributes

Containerct
bool need_redrawing

Detailed Description

Definition at line 32 of file widget.h.


Constructor & Destructor Documentation

Widget::Widget (  ) 

Definition at line 25 of file widget.cpp.

00026 {
00027   have_focus = false;
00028   ct = NULL;
00029 
00030   need_redrawing = true;
00031 }

Widget::Widget ( const Rectanglei rect  ) 

Definition at line 33 of file widget.cpp.

00034 {
00035   position = rect.GetPosition();
00036   size = rect.GetSize();
00037   have_focus = false;
00038   ct = NULL;
00039   
00040   need_redrawing = true;
00041 }

Here is the call graph for this function:

Widget::~Widget (  )  [virtual]

Definition at line 43 of file widget.cpp.

00044 {
00045 }


Member Function Documentation

Widget * Widget::Clic ( const Point2i mousePosition,
uint  button 
) [virtual]

Reimplemented in Box, CheckBox, ListBox, SpinButton, SpinButtonBig, SpinButtonWithPicture, WidgetList, MapSelectionBox, NetworkTeamsSelectionBox, TeamBox, and TeamsSelectionBox.

Definition at line 51 of file widget.cpp.

00052 {
00053   need_redrawing = true;
00054 
00055   return this;
00056 }

Here is the caller graph for this function:

virtual void Widget::Draw ( const Point2i mousePosition,
Surface surf 
) const [pure virtual]

Implemented in Box, Button, ButtonText, CheckBox, Label, ListBox, ListBoxWithLabel, MsgBox, NullWidget, PictureTextCBox, PictureWidget, SpinButton, SpinButtonBig, SpinButtonWithPicture, TextBox, and WidgetList.

Here is the caller graph for this function:

void Widget::ForceRedraw (  )  [virtual]

Reimplemented in WidgetList.

Definition at line 86 of file widget.cpp.

00087 {
00088   need_redrawing = true;
00089 }

Here is the caller graph for this function:

void Widget::SendKey ( SDL_keysym  key  )  [virtual]

Reimplemented in TextBox, and WidgetList.

Definition at line 47 of file widget.cpp.

00048 {
00049 }

void Widget::SetContainer ( Container _ct  ) 

Definition at line 64 of file widget.cpp.

00065 {
00066   ct = _ct;
00067 }

Here is the caller graph for this function:

virtual void Widget::SetSizePosition ( const Rectanglei rect  )  [pure virtual]

Implemented in VBox, HBox, Button, CheckBox, Label, ListBox, ListBoxWithLabel, MsgBox, NullWidget, PictureTextCBox, PictureWidget, SpinButton, SpinButtonBig, SpinButtonWithPicture, and WidgetList.

Here is the caller graph for this function:

void Widget::SetXY ( int  _x,
int  _y 
) [inline]

Definition at line 59 of file widget.h.

00059                             { 
00060           SetSizePosition( Rectanglei(Point2i(_x, _y), size) ); 
00061   };  

Here is the call graph for this function:

Here is the caller graph for this function:

void Widget::StdSetSizePosition ( const Rectanglei rect  )  [protected]

Definition at line 58 of file widget.cpp.

00059 {
00060   position = rect.GetPosition();
00061   size = rect.GetSize();
00062 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Widget::Update ( const Point2i mousePosition,
const Point2i lastMousePosition,
Surface surf 
) [virtual]

Reimplemented in Box, and TeamBox.

Definition at line 69 of file widget.cpp.

00072 {
00073   if ( 
00074       need_redrawing 
00075       || (Contains(mousePosition) && mousePosition != lastMousePosition) 
00076       || (Contains(lastMousePosition) && !Contains(mousePosition))
00077       ) 
00078     {
00079       if (ct != NULL) ct->Redraw(*this, surf);
00080       
00081       Draw(mousePosition, surf);
00082     }
00083   need_redrawing = false;
00084 }

Here is the call graph for this function:


Member Data Documentation

Container* Widget::ct [protected]

Definition at line 35 of file widget.h.

bool Widget::have_focus

Definition at line 40 of file widget.h.

bool Widget::need_redrawing [protected]

Definition at line 36 of file widget.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:33:18 2007 for Wormux by  doxygen 1.4.7