WidgetList Class Reference

#include <widget_list.h>

Inheritance diagram for WidgetList:

Inheritance graph
[legend]
Collaboration diagram for WidgetList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 WidgetList ()
 WidgetList (const Rectanglei &rect)
virtual ~WidgetList ()
void Update (const Point2i &mousePosition, Surface &surf)
virtual void SendKey (SDL_keysym key)
virtual WidgetClic (const Point2i &mousePosition, uint button)
virtual void Draw (const Point2i &mousePosition, Surface &surf) const
virtual void SetSizePosition (const Rectanglei &rect)
virtual void AddWidget (Widget *)
virtual void Redraw (const Rectanglei &rect, Surface &surf)
void ForceRedraw ()
void SetFocusOn (Widget *)

Protected Member Functions

virtual void DelFirstWidget ()

Protected Attributes

std::list< Widget * > widget_list

Private Attributes

Point2i lastMousePosition
Widgetlast_clicked

Detailed Description

Definition at line 30 of file widget_list.h.


Constructor & Destructor Documentation

WidgetList::WidgetList (  ) 

Definition at line 28 of file widget_list.cpp.

00029 {
00030   last_clicked = NULL;
00031 }

WidgetList::WidgetList ( const Rectanglei rect  ) 

Definition at line 33 of file widget_list.cpp.

00033                                              : Widget(rect)
00034 {
00035   last_clicked = NULL;
00036 }

WidgetList::~WidgetList (  )  [virtual]

Definition at line 38 of file widget_list.cpp.

00039 {
00040   for(std::list<Widget*>::iterator w=widget_list.begin();
00041       w != widget_list.end();
00042       w++)
00043     delete *w;
00044 
00045   widget_list.clear();
00046 }


Member Function Documentation

void WidgetList::AddWidget ( Widget  )  [virtual]

Reimplemented in Box, VBox, and HBox.

Definition at line 54 of file widget_list.cpp.

00055 {
00056   assert(w!=NULL);
00057   widget_list.push_back(w);
00058   w->SetContainer(this);
00059 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from Widget.

Reimplemented in Box, MapSelectionBox, NetworkTeamsSelectionBox, TeamBox, and TeamsSelectionBox.

Definition at line 92 of file widget_list.cpp.

00093 {
00094   for(std::list<Widget*>::iterator w=widget_list.begin();
00095       w != widget_list.end();
00096       w++)
00097   {
00098     if((*w)->Contains(mousePosition))
00099     {
00100       Widget* child = (*w)->Clic(mousePosition,button);
00101       if(child != NULL)
00102       {
00103         SetFocusOn(child);
00104         return child;
00105       }
00106     }
00107   }
00108   return NULL;
00109 }

Here is the call graph for this function:

Here is the caller graph for this function:

void WidgetList::DelFirstWidget (  )  [protected, virtual]

Reimplemented in VBox.

Definition at line 48 of file widget_list.cpp.

00049 {
00050   delete widget_list.front();
00051   widget_list.pop_front();
00052 }

Here is the caller graph for this function:

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

Implements Widget.

Reimplemented in Box.

Definition at line 74 of file widget_list.cpp.

00075 {
00076 }

void WidgetList::ForceRedraw (  )  [virtual]

Reimplemented from Widget.

Definition at line 111 of file widget_list.cpp.

00112 {
00113   need_redrawing = true;
00114 
00115   for(std::list<Widget*>::iterator w=widget_list.begin();
00116       w != widget_list.end();
00117       w++)
00118   {
00119     (*w)->ForceRedraw();
00120   }
00121 }

Here is the caller graph for this function:

void WidgetList::Redraw ( const Rectanglei rect,
Surface surf 
) [virtual]

Implements Container.

Reimplemented in Box.

Definition at line 78 of file widget_list.cpp.

00079 {
00080   // Redraw bottom layer
00081   if (ct != NULL) {
00082     ct->Redraw(rect, surf);
00083   }
00084 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from Widget.

Definition at line 86 of file widget_list.cpp.

00087 {
00088   if(last_clicked != NULL)
00089     last_clicked -> SendKey(key);
00090 }

Here is the caller graph for this function:

void WidgetList::SetFocusOn ( Widget  ) 

Definition at line 123 of file widget_list.cpp.

00124 {
00125   if(last_clicked != NULL) {
00126     last_clicked->have_focus = false;
00127     last_clicked->ForceRedraw();
00128   }
00129 
00130   if (w != NULL) {
00131     last_clicked = w ;
00132     last_clicked->have_focus = true;
00133     last_clicked->ForceRedraw();
00134   }
00135 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void WidgetList::SetSizePosition ( const Rectanglei rect  )  [inline, virtual]

Implements Widget.

Reimplemented in VBox, and HBox.

Definition at line 53 of file widget_list.h.

00053 {};  

void WidgetList::Update ( const Point2i mousePosition,
Surface surf 
)

Definition at line 61 of file widget_list.cpp.

00062 {
00063   for(std::list<Widget*>::iterator w=widget_list.begin();
00064       w != widget_list.end();
00065       w++)
00066   {
00067     // Then redraw the widget
00068     (*w)->Update(mousePosition, lastMousePosition, surf);
00069   }
00070 
00071   lastMousePosition = mousePosition;
00072 }

Here is the caller graph for this function:


Member Data Documentation

Widget* WidgetList::last_clicked [private]

Definition at line 34 of file widget_list.h.

Point2i WidgetList::lastMousePosition [private]

Definition at line 33 of file widget_list.h.

std::list<Widget*> WidgetList::widget_list [protected]

Definition at line 37 of file widget_list.h.


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