Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_RectList Class Reference

A list derived from vector to handle overlapping and child-widgets. More...

#include <pgrectlist.h>

List of all members.

Public Member Functions

 PG_RectList ()
 constructor of the list
virtual ~PG_RectList ()
 destructor
void Add (PG_Widget *rect, bool front=false)
 add a widget to the list
bool Remove (PG_Rect *rect)
 remove a widget from the list
PG_WidgetIsInside (const PG_Point &p)
 check if a given point is inside any rectangle in the list
PG_WidgetFind (int id, bool recursive=false)
PG_WidgetFind (const std::string &name, bool recursive=false)
void Blit ()
 blit all rectangles in the list to the screen
void Blit (const PG_Rect &rect)
 blit all rectangles from the list intersecting a reference rectangle to the screen
void Blit (const PG_Rect &rect, PG_Widget *first, PG_Widget *last=NULL)
bool BringToFront (PG_Widget *rect)
 reorder a widget (rectangle) - front
bool SendToBack (PG_Widget *rect)
 reorder a widget (rectangle) - back
PG_Widgetfirst ()
PG_Widgetlast ()
void clear ()
Uint32 size ()

Protected Attributes

PG_Widgetmy_first
PG_Widgetmy_last
Uint32 my_count


Detailed Description

A list derived from vector to handle overlapping and child-widgets.

Author:
Alexander Pipelka

Definition at line 46 of file pgrectlist.h.


Constructor & Destructor Documentation

PG_RectList::PG_RectList  ) 
 

constructor of the list

Definition at line 36 of file pgrectlist.cpp.

PG_RectList::~PG_RectList  )  [virtual]
 

destructor

Definition at line 41 of file pgrectlist.cpp.


Member Function Documentation

void PG_RectList::Add PG_Widget rect,
bool  front = false
 

add a widget to the list

Parameters:
rect pointer to the widget (rect)
front insert the rectangle at the head of the list if true This functions adds the widget to the back of the list.

Definition at line 91 of file pgrectlist.cpp.

References PG_Rect::index, my_count, my_first, my_last, PG_Rect::my_next, PG_Rect::my_prev, and PG_LogWRN().

Referenced by PG_Widget::AddChild(), PG_Widget::AddToWidgetList(), BringToFront(), and SendToBack().

void PG_RectList::Blit const PG_Rect rect,
PG_Widget first,
PG_Widget last = NULL
 

Definition at line 180 of file pgrectlist.cpp.

References Blit(), PG_Widget::Blit(), PG_Widget::GetChildList(), PG_Widget::GetClipRect(), PG_Application::GetScreen(), PG_Rect::IntersectRect(), PG_Widget::IsHidden(), PG_Widget::IsVisible(), PG_Rect::next(), PG_Rect::OverlapRect(), and screen.

void PG_RectList::Blit const PG_Rect rect  ) 
 

blit all rectangles from the list intersecting a reference rectangle to the screen

Parameters:
rect reference rectangle
Performs an intersection of all visible rectangles in the list with the reference rectangle. The resulting list is clipped to the reference and blitted to the screen.

Definition at line 176 of file pgrectlist.cpp.

References Blit(), and first().

void PG_RectList::Blit  ) 
 

blit all rectangles in the list to the screen

This function blits all visible rectangles from the first to the last position to the screen.

Definition at line 223 of file pgrectlist.cpp.

References PG_Widget::Blit(), first(), PG_Widget::IsHidden(), PG_Widget::IsVisible(), and PG_Rect::next().

Referenced by PG_Widget::Blit(), Blit(), PG_Widget::BulkBlit(), PG_Widget::RestoreBackground(), PG_Widget::Update(), and PG_Widget::UpdateRect().

bool PG_RectList::BringToFront PG_Widget rect  ) 
 

reorder a widget (rectangle) - front

Parameters:
rect widget to reorder
Returns:
true - the rectangle was found and reordered / false - the rectangle isn't in the list.
Bring the given widget (rectangle) to the front (will overlap all other widgets in the list).

Definition at line 234 of file pgrectlist.cpp.

References Add(), and Remove().

Referenced by PG_Widget::BringToFront(), and PG_Widget::Show().

void PG_RectList::clear  ) 
 

Definition at line 284 of file pgrectlist.cpp.

References my_count, my_first, and my_last.

Referenced by PG_Widget::RemoveAllChilds().

PG_Widget * PG_RectList::Find const std::string &  name,
bool  recursive = false
 

Definition at line 268 of file pgrectlist.cpp.

References PG_Widget::FindChild(), first(), PG_Widget::GetName(), and PG_Rect::next().

PG_Widget * PG_RectList::Find int  id,
bool  recursive = false
 

Definition at line 252 of file pgrectlist.cpp.

References PG_Widget::FindChild(), first(), PG_Widget::GetID(), and PG_Rect::next().

Referenced by PG_Widget::FindChild().

PG_Widget* PG_RectList::first  )  [inline]
 

Definition at line 126 of file pgrectlist.h.

Referenced by Blit(), Find(), FindInChildObjects(), PG_ScrollArea::GetFirstInList(), PG_ListBox::GetSelectedItems(), PG_Widget::HideAll(), PG_Widget::MoveRect(), PG_Widget::ProcessEvent(), PG_Widget::Redraw(), PG_Widget::RemoveAllChilds(), PG_Widget::RestoreBackground(), PG_ListBox::SetAlignment(), PG_Widget::SetChildTransparency(), PG_ListBox::SetIndent(), and PG_Widget::SetVisible().

PG_Widget * PG_RectList::IsInside const PG_Point p  ) 
 

check if a given point is inside any rectangle in the list

Parameters:
p point to check
Returns:
pointer to the first widget that contains the point / NULL if there is no match
Returns the first visible widget which contains the given point.

Definition at line 73 of file pgrectlist.cpp.

References PG_Widget::GetClipRect(), PG_Widget::IsHidden(), PG_Widget::IsVisible(), last(), and PG_Rect::prev().

Referenced by PG_Widget::FindWidgetFromPos().

PG_Widget* PG_RectList::last  )  [inline]
 

Definition at line 130 of file pgrectlist.h.

Referenced by IsInside().

bool PG_RectList::Remove PG_Rect rect  ) 
 

remove a widget from the list

Parameters:
rect pointer to the widget (rect)
Returns:
true - if the widget was remove successfully
This functions removes the given widget from the list

Definition at line 132 of file pgrectlist.cpp.

References my_count, my_first, my_last, PG_Rect::my_next, PG_Rect::my_prev, PG_Rect::next(), and PG_Rect::prev().

Referenced by BringToFront(), PG_Widget::RemoveChild(), PG_Widget::RemoveFromWidgetList(), and SendToBack().

bool PG_RectList::SendToBack PG_Widget rect  ) 
 

reorder a widget (rectangle) - back

Parameters:
rect widget to reorder
Returns:
true - the rectangle was found and reordered / false - the rectangle isn't in the list.
Send the given widget (rectangle) to the back (will be overlapped by all other widgets in the list).

Definition at line 243 of file pgrectlist.cpp.

References Add(), and Remove().

Referenced by PG_Widget::SendToBack().

Uint32 PG_RectList::size  )  [inline]
 

Definition at line 136 of file pgrectlist.h.

Referenced by PG_Widget::GetChildCount().


Member Data Documentation

Uint32 PG_RectList::my_count [protected]
 

Definition at line 146 of file pgrectlist.h.

Referenced by Add(), clear(), and Remove().

PG_Widget* PG_RectList::my_first [protected]
 

Definition at line 142 of file pgrectlist.h.

Referenced by Add(), clear(), and Remove().

PG_Widget* PG_RectList::my_last [protected]
 

Definition at line 144 of file pgrectlist.h.

Referenced by Add(), clear(), and Remove().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:22 2008 for Advanced Strategic Command by  doxygen 1.4.2