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

PG_ScrollArea Class Reference

A widget containing other widgets which can be paned. More...

#include <pgscrollarea.h>

Inheritance diagram for PG_ScrollArea:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_ScrollArea (PG_Widget *parent, const PG_Rect &r=PG_Rect::null)
 Create a scrollarea widget.
 ~PG_ScrollArea ()
void SetShiftOnRemove (bool shiftx, bool shifty)
 Shift widgets on removal.
void ScrollTo (int x, int y)
 scroll to a give X/Y-Coordinate within the client area.
void ScrollToWidget (PG_Widget *widget, bool bVertical=true)
 Scroll to a widget.
void SetAreaWidth (Uint16 w)
 Set the width of the scrollable area manually.
void SetAreaHeight (Uint16 h)
 Set the height of the scrollable area manually.
Uint16 GetAreaWidth ()
 Get the width of the scrollable area.
Uint16 GetAreaHeight ()
 Get the height of the scrollable area.
void RemoveAll ()
 Remove all widgets from the list (without deletion).
void DeleteAll ()
 Delete (destroy) all widgets in the list.
Uint16 GetWidgetCount ()
 Get the number of widgets in the list.
Uint16 GetScrollPosX ()
Uint16 GetScrollPosY ()
void AddChild (PG_Widget *child)
 Add a clientwidget (which will be embedded into this widget).
bool RemoveChild (PG_Widget *child)
PG_WidgetGetFirstInList ()
void SetResizeParent (bool bRemove, bool bAdd)
 Automatically adjusts the parent's size to the actual scroll area size;.

Public Attributes

SignalAreaChangedHeight sigAreaChangedHeight
SignalAreaChangedWidth sigAreaChangedWidth

Protected Member Functions

void eventSizeWidget (Uint16 w, Uint16 h)
 Callback for the SizeWidget event.

Protected Attributes

PG_Rect my_area
bool my_shiftx
bool my_shifty
bool my_AddResizeParent
bool my_RemoveResizeParent

Classes

class  SignalAreaChangedHeight
class  SignalAreaChangedWidth

Detailed Description

A widget containing other widgets which can be paned.

Author:
Alexander Pipelka
With this widget you can create larger scrollable areas. This could be one larger client-widget or any number of widgets "spanning" the scrollable area. This widget doesn't provide scrollbars you can only move to a position by using the PG_ScrollArea::ScrollTo method.

Definition at line 48 of file pgscrollarea.h.


Constructor & Destructor Documentation

PG_ScrollArea::PG_ScrollArea PG_Widget parent,
const PG_Rect r = PG_Rect::null
 

Create a scrollarea widget.

Parameters:
parent parent widget if the scrollarea should be within the client context of an other widget, or NULL if this widget has no parent.
r position and dimensions of the widget

Definition at line 35 of file pgscrollarea.cpp.

PG_ScrollArea::~PG_ScrollArea  ) 
 

Definition at line 38 of file pgscrollarea.cpp.


Member Function Documentation

void PG_ScrollArea::AddChild PG_Widget child  )  [virtual]
 

Add a clientwidget (which will be embedded into this widget).

Parameters:
child the widget to add

Reimplemented from PG_Widget.

Definition at line 87 of file pgscrollarea.cpp.

References PG_Widget::AddChild(), PG_Widget::GetBorderSize(), PG_Widget::GetParent(), PG_Widget::IsVisible(), PG_Widget::MoveRect(), my_AddResizeParent, my_area, PG_Rect::my_height, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, PG_Widget::Show(), sigAreaChangedHeight, and sigAreaChangedWidth.

Referenced by PG_WidgetList::AddChild(), and PG_ScrollWidget::AddChild().

void PG_ScrollArea::DeleteAll  ) 
 

Delete (destroy) all widgets in the list.

Definition at line 228 of file pgscrollarea.cpp.

References PG_Widget::GetChildList(), my_area, PG_Rect::next(), PG_Widget::SetVisible(), sigAreaChangedHeight, sigAreaChangedWidth, and PG_Widget::Update().

Referenced by PG_ScrollWidget::DeleteAll(), PG_ListBox::DeleteAll(), and PG_ScrollWidget::~PG_ScrollWidget().

void PG_ScrollArea::eventSizeWidget Uint16  w,
Uint16  h
[protected, virtual]
 

Callback for the SizeWidget event.

Parameters:
w new width
h new height This virtual function can be used to implement custom behavior for SizeWidget events.

Reimplemented from PG_Widget.

Definition at line 304 of file pgscrollarea.cpp.

References PG_Rect::my_height, and PG_Rect::my_width.

Uint16 PG_ScrollArea::GetAreaHeight  )  [inline]
 

Get the height of the scrollable area.

Returns:
width (in pixels) of the scrollable area

Definition at line 115 of file pgscrollarea.h.

Referenced by PG_WidgetList::AddChild(), PG_ScrollWidget::GetListHeight(), and PG_ScrollWidget::handleAreaChangedHeight().

Uint16 PG_ScrollArea::GetAreaWidth  )  [inline]
 

Get the width of the scrollable area.

Returns:
width (in pixels) of the scrollable area

Definition at line 107 of file pgscrollarea.h.

Referenced by PG_ScrollWidget::GetListWidth(), and PG_ScrollWidget::handleAreaChangedWidth().

PG_Widget * PG_ScrollArea::GetFirstInList  ) 
 

Definition at line 287 of file pgscrollarea.cpp.

References PG_RectList::first(), and PG_Widget::GetChildList().

Referenced by PG_ScrollWidget::GetFirstInList().

Uint16 PG_ScrollArea::GetScrollPosX  ) 
 

Definition at line 258 of file pgscrollarea.cpp.

References my_area.

Referenced by PG_ScrollWidget::CheckScrollBars(), PG_RichEdit::eventBlit(), PG_ScrollWidget::GetScrollPosX(), PG_ScrollWidget::handleAreaChangedHeight(), PG_ScrollWidget::handleAreaChangedWidth(), PG_ScrollWidget::handleScrollPos(), PG_ScrollWidget::handleScrollTrack(), PG_WidgetList::PageDown(), PG_WidgetList::PageUp(), and PG_WidgetList::ScrollTo().

Uint16 PG_ScrollArea::GetScrollPosY  ) 
 

Definition at line 262 of file pgscrollarea.cpp.

References my_area.

Referenced by PG_ScrollWidget::CheckScrollBars(), PG_RichEdit::eventBlit(), PG_ScrollWidget::GetScrollPosY(), PG_ScrollWidget::handleAreaChangedHeight(), PG_ScrollWidget::handleAreaChangedWidth(), PG_ScrollWidget::handleScrollPos(), PG_ScrollWidget::handleScrollTrack(), PG_WidgetList::PageDown(), and PG_WidgetList::PageUp().

Uint16 PG_ScrollArea::GetWidgetCount  ) 
 

Get the number of widgets in the list.

Definition at line 250 of file pgscrollarea.cpp.

References PG_Widget::GetChildList().

Referenced by PG_ScrollWidget::GetWidgetCount(), and ScrollToWidget().

void PG_ScrollArea::RemoveAll  ) 
 

Remove all widgets from the list (without deletion).

Definition at line 209 of file pgscrollarea.cpp.

References PG_Widget::GetChildList(), my_area, my_shiftx, my_shifty, sigAreaChangedHeight, sigAreaChangedWidth, and PG_Widget::Update().

Referenced by PG_ScrollWidget::RemoveAll(), and PG_ListBox::RemoveAll().

bool PG_ScrollArea::RemoveChild PG_Widget child  )  [virtual]
 

Reimplemented from PG_Widget.

Definition at line 146 of file pgscrollarea.cpp.

References PG_Widget::GetChildList(), PG_Widget::GetParent(), PG_Widget::MoveRect(), my_area, PG_Rect::my_height, my_RemoveResizeParent, my_shiftx, my_shifty, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, PG_Rect::next(), PG_Widget::RemoveChild(), sigAreaChangedHeight, sigAreaChangedWidth, and PG_Widget::Update().

void PG_ScrollArea::ScrollTo int  x,
int  y
 

scroll to a give X/Y-Coordinate within the client area.

Parameters:
x X-Position
y Y-Position

Definition at line 40 of file pgscrollarea.cpp.

References PG_Widget::GetChildList(), PG_Widget::MoveRect(), my_area, PG_Rect::my_height, PG_Rect::my_width, PG_Rect::next(), and PG_Widget::Update().

Referenced by PG_ListBox::DeleteAll(), PG_ScrollWidget::handleAreaChangedHeight(), PG_ScrollWidget::handleAreaChangedWidth(), PG_ScrollWidget::handleScrollPos(), PG_ScrollWidget::handleScrollTrack(), PG_WidgetList::PageDown(), PG_WidgetList::PageUp(), PG_WidgetList::ScrollTo(), PG_ScrollWidget::ScrollTo(), and ScrollToWidget().

void PG_ScrollArea::ScrollToWidget PG_Widget widget,
bool  bVertical = true
 

Scroll to a widget.

Parameters:
widget the target widget
bVertical scroll direction

Definition at line 113 of file pgscrollarea.cpp.

References GetWidgetCount(), my_area, PG_Rect::my_height, PG_Rect::my_width, PG_Rect::my_xpos, PG_Rect::my_ypos, and ScrollTo().

Referenced by PG_ScrollWidget::ScrollToWidget().

void PG_ScrollArea::SetAreaHeight Uint16  h  ) 
 

Set the height of the scrollable area manually.

Parameters:
h new height of the scrollable area. This method overrides the automatically computed height of the scrollable area.

Definition at line 279 of file pgscrollarea.cpp.

References my_area, and sigAreaChangedHeight.

Referenced by PG_RichEdit::SetText().

void PG_ScrollArea::SetAreaWidth Uint16  w  ) 
 

Set the width of the scrollable area manually.

Parameters:
w new width of the scrollable area. This method overrides the automatically computed width of the scrollable area.

Definition at line 271 of file pgscrollarea.cpp.

References my_area, and sigAreaChangedWidth.

Referenced by PG_RichEdit::PG_RichEdit(), and PG_RichEdit::SetText().

void PG_ScrollArea::SetResizeParent bool  bRemove,
bool  bAdd
 

Automatically adjusts the parent's size to the actual scroll area size;.

Parameters:
bRemove adjusts size when removing a child
bAdd adjusts size when adding a child

Definition at line 295 of file pgscrollarea.cpp.

References PG_Widget::GetParent(), my_AddResizeParent, and my_RemoveResizeParent.

Referenced by PG_ScrollWidget::SetAutoResize().

void PG_ScrollArea::SetShiftOnRemove bool  shiftx,
bool  shifty
 

Shift widgets on removal.

Parameters:
shiftx shift all widgets to the right of the removed widgets.
shifty shift all widgets beneath the removed one. This method controls the behaviour if a widget will be removed from the client context.

Definition at line 266 of file pgscrollarea.cpp.

References my_shiftx, and my_shifty.

Referenced by PG_ScrollWidget::PG_ScrollWidget(), PG_WidgetList::PG_WidgetList(), and PG_ScrollWidget::SetShiftOnRemove().


Member Data Documentation

bool PG_ScrollArea::my_AddResizeParent [protected]
 

Definition at line 165 of file pgscrollarea.h.

Referenced by AddChild(), and SetResizeParent().

PG_Rect PG_ScrollArea::my_area [protected]
 

Definition at line 159 of file pgscrollarea.h.

Referenced by AddChild(), DeleteAll(), GetScrollPosX(), GetScrollPosY(), RemoveAll(), RemoveChild(), ScrollTo(), ScrollToWidget(), SetAreaHeight(), and SetAreaWidth().

bool PG_ScrollArea::my_RemoveResizeParent [protected]
 

Definition at line 167 of file pgscrollarea.h.

Referenced by RemoveChild(), and SetResizeParent().

bool PG_ScrollArea::my_shiftx [protected]
 

Definition at line 161 of file pgscrollarea.h.

Referenced by RemoveAll(), RemoveChild(), and SetShiftOnRemove().

bool PG_ScrollArea::my_shifty [protected]
 

Definition at line 163 of file pgscrollarea.h.

Referenced by RemoveAll(), RemoveChild(), and SetShiftOnRemove().

SignalAreaChangedHeight PG_ScrollArea::sigAreaChangedHeight
 

Definition at line 138 of file pgscrollarea.h.

Referenced by AddChild(), DeleteAll(), PG_ScrollWidget::PG_ScrollWidget(), RemoveAll(), RemoveChild(), and SetAreaHeight().

SignalAreaChangedWidth PG_ScrollArea::sigAreaChangedWidth
 

Definition at line 140 of file pgscrollarea.h.

Referenced by AddChild(), DeleteAll(), PG_ScrollWidget::PG_ScrollWidget(), RemoveAll(), RemoveChild(), and SetAreaWidth().


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