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

PG_ScrollWidget Class Reference

Encapsulation of the PG_ScrollArea widget providing scrollbars. More...

#include <pgscrollwidget.h>

Inheritance diagram for PG_ScrollWidget:

Inheritance graph
[legend]
List of all members.

Public Types

enum  { IDWIDGETLIST_VSCROLL = PG_WIDGETID_INTERNAL + 10, IDWIDGETLIST_HSCROLL }

Public Member Functions

 PG_ScrollWidget (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, const std::string &style="ScrollWidget")
 Constructor of the PG_Widget class.
 ~PG_ScrollWidget ()
 Destructor of the PG_Widget class.
void LoadThemeStyle (const std::string &widgettype)
 Load a specific themestyle.
void EnableScrollBar (bool enable, PG_ScrollBar::ScrollDirection direction=PG_ScrollBar::VERTICAL)
 Enable / disable the Scrollbar (override automatic display).
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.
Uint16 GetListHeight ()
Uint16 GetListWidth ()
Uint16 GetWidgetCount ()
PG_WidgetGetFirstInList ()
virtual void DeleteAll ()
virtual void RemoveAll ()
void AddChild (PG_Widget *child)
 Add a clientwidget (which will be embedded into this widget).
void SetLineSize (int linesize)
 Linesize is the scroll distance that is scrolled if one of the arrow buttons is pressed.
int GetLineSize ()
void SetShiftOnRemove (bool shiftx, bool shifty)
 Shift widgets on removal.
Uint16 GetScrollPosX ()
 Get x offset of current scroll position.
Uint16 GetScrollPosY ()
 Get y offset of current scroll position.
void SetAutoResize (bool bRemove, bool bAdd)
 Automatically adjusts the widget's size to the actual scroll area size;.

Public Attributes

PG_ScrollArea::SignalAreaChangedHeight sigAreaChangedHeight
PG_ScrollArea::SignalAreaChangedWidth sigAreaChangedWidth

Protected Member Functions

void eventSizeWidget (Uint16 w, Uint16 h)
 Callback for the SizeWidget event.
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
bool handleScrollPos (PG_ScrollBar *widget, long data)
bool handleScrollTrack (PG_ScrollBar *widget, long data)
bool handleAreaChangedHeight (PG_ScrollArea *area, Uint16 h)
bool handleAreaChangedWidth (PG_ScrollArea *area, Uint16 w)
void CheckScrollBars ()

Protected Attributes

PG_ScrollBarmy_objVerticalScrollbar
PG_ScrollBarmy_objHorizontalScrollbar
PG_ScrollAreamy_scrollarea
int my_widthScrollbar
int my_heightHorizontalScrollbar
bool my_enableVerticalScrollbar
bool my_enableHorizontalScrollbar
int my_scrollLineSize

Detailed Description

Encapsulation of the PG_ScrollArea widget providing scrollbars.

Author:
Alexander Pipelka
Generally used to make a large 'pane' of widgets that can be scrolled through in a smaller 'portal' with scrollbars.

Definition at line 50 of file pgscrollwidget.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
IDWIDGETLIST_VSCROLL 
IDWIDGETLIST_HSCROLL 

Definition at line 53 of file pgscrollwidget.h.


Constructor & Destructor Documentation

PG_ScrollWidget::PG_ScrollWidget PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const std::string &  style = "ScrollWidget"
 

Constructor of the PG_Widget class.

Definition at line 34 of file pgscrollwidget.cpp.

References handleAreaChangedHeight(), handleAreaChangedWidth(), handleScrollPos(), handleScrollTrack(), PG_Rect::Height(), PG_Widget::Hide(), PG_ScrollBar::HORIZONTAL, IDWIDGETLIST_HSCROLL, IDWIDGETLIST_VSCROLL, my_enableHorizontalScrollbar, my_enableVerticalScrollbar, PG_Rect::my_height, my_heightHorizontalScrollbar, my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, PG_Rect::my_width, my_widthScrollbar, PG_Rect::PG_Rect(), PG_ScrollBar::SetRange(), PG_ScrollArea::SetShiftOnRemove(), sigAreaChangedHeight, PG_ScrollArea::sigAreaChangedHeight, sigAreaChangedWidth, PG_ScrollArea::sigAreaChangedWidth, PG_ScrollBar::sigScrollPos, PG_ScrollBar::sigScrollTrack, PG_ScrollBar::VERTICAL, and PG_Rect::Width().

PG_ScrollWidget::~PG_ScrollWidget  ) 
 

Destructor of the PG_Widget class.

Definition at line 77 of file pgscrollwidget.cpp.

References PG_ScrollArea::DeleteAll(), and my_scrollarea.


Member Function Documentation

void PG_ScrollWidget::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.

Reimplemented in PG_ListBox, PG_RichEdit, and PG_WidgetList.

Definition at line 272 of file pgscrollwidget.cpp.

References PG_ScrollArea::AddChild(), PG_Widget::AddChild(), my_objHorizontalScrollbar, my_objVerticalScrollbar, and my_scrollarea.

Referenced by PG_RichEdit::AddChild().

void PG_ScrollWidget::CheckScrollBars  )  [protected]
 

Definition at line 297 of file pgscrollwidget.cpp.

References GetListHeight(), GetListWidth(), PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), GetWidgetCount(), PG_Rect::Height(), my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, my_scrollLineSize, PG_ScrollBar::SetLineSize(), PG_ScrollBar::SetPageSize(), PG_ScrollBar::SetPosition(), PG_ScrollBar::SetRange(), and PG_Rect::Width().

Referenced by EnableScrollBar(), eventSizeWidget(), handleAreaChangedHeight(), handleAreaChangedWidth(), PG_WidgetList::PageDown(), PG_WidgetList::PageUp(), PG_WidgetList::ScrollTo(), ScrollTo(), and ScrollToWidget().

void PG_ScrollWidget::DeleteAll  )  [virtual]
 

Reimplemented in PG_ListBox.

Definition at line 396 of file pgscrollwidget.cpp.

References PG_ScrollArea::DeleteAll(), and my_scrollarea.

void PG_ScrollWidget::EnableScrollBar bool  enable,
PG_ScrollBar::ScrollDirection  direction = PG_ScrollBar::VERTICAL
 

Enable / disable the Scrollbar (override automatic display).

Parameters:
enable true - enable scrollbar / false - disable scrollbar
direction modified scrollbar (PG_ScrollBar::VERTICAL | PG_ScrollBar::HORIZONTAL)

Definition at line 326 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_ScrollBar::HORIZONTAL, PG_Rect::IsNull(), my_enableHorizontalScrollbar, my_enableVerticalScrollbar, my_objHorizontalScrollbar, my_objVerticalScrollbar, and PG_ScrollBar::VERTICAL.

Referenced by ASCGUI_Window::parsePanelASCTXT(), PG_ListBox::PG_ListBox(), PG_RichEdit::PG_RichEdit(), SaveGameBaseDialog::SaveGameBaseDialog(), and SetWidgetListAtts().

bool PG_ScrollWidget::eventMouseButtonDown const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Reimplemented in PG_ListBox.

Definition at line 221 of file pgscrollwidget.cpp.

References PG_ScrollBar::GetLineSize(), GetLineSize(), GetScrollPosX(), GetScrollPosY(), PG_Widget::IsVisible(), my_objVerticalScrollbar, and ScrollTo().

void PG_ScrollWidget::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_ThemeWidget.

Reimplemented in PG_RichEdit.

Definition at line 210 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_ThemeWidget::eventSizeWidget(), PG_Rect::my_height, my_scrollarea, PG_Rect::my_width, and PG_Widget::SizeWidget().

Referenced by PG_RichEdit::eventSizeWidget().

PG_Widget * PG_ScrollWidget::GetFirstInList  ) 
 

Definition at line 386 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetFirstInList(), and my_scrollarea.

Referenced by PG_DropDown::GetFirstInList().

int PG_ScrollWidget::GetLineSize  ) 
 

Definition at line 290 of file pgscrollwidget.cpp.

References my_scrollLineSize.

Referenced by eventMouseButtonDown().

Uint16 PG_ScrollWidget::GetListHeight  ) 
 

Definition at line 342 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetAreaHeight(), and my_scrollarea.

Referenced by CheckScrollBars().

Uint16 PG_ScrollWidget::GetListWidth  ) 
 

Definition at line 346 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetAreaWidth(), and my_scrollarea.

Referenced by TextRenderer::AreaWidth(), and CheckScrollBars().

Uint16 PG_ScrollWidget::GetScrollPosX  ) 
 

Get x offset of current scroll position.

Definition at line 408 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetScrollPosX(), and my_scrollarea.

Referenced by TextRenderer::eventKeyDown(), eventMouseButtonDown(), and ItemSelectorWidget::reLoad().

Uint16 PG_ScrollWidget::GetScrollPosY  ) 
 

Get y offset of current scroll position.

Definition at line 412 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetScrollPosY(), and my_scrollarea.

Referenced by TextRenderer::eventKeyDown(), eventMouseButtonDown(), and ItemSelectorWidget::reLoad().

Uint16 PG_ScrollWidget::GetWidgetCount  ) 
 

Definition at line 350 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetWidgetCount(), and my_scrollarea.

Referenced by CheckScrollBars(), and PG_WidgetList::FindWidget().

bool PG_ScrollWidget::handleAreaChangedHeight PG_ScrollArea area,
Uint16  h
[protected]
 

Definition at line 354 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_ScrollArea::GetAreaHeight(), PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), PG_Rect::my_height, my_scrollarea, and PG_ScrollArea::ScrollTo().

Referenced by PG_ScrollWidget().

bool PG_ScrollWidget::handleAreaChangedWidth PG_ScrollArea area,
Uint16  w
[protected]
 

Definition at line 370 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_ScrollArea::GetAreaWidth(), PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), my_scrollarea, PG_Rect::my_width, and PG_ScrollArea::ScrollTo().

Referenced by PG_ScrollWidget().

bool PG_ScrollWidget::handleScrollPos PG_ScrollBar widget,
long  data
[protected]
 

Definition at line 244 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, and PG_ScrollArea::ScrollTo().

Referenced by PG_ScrollWidget().

bool PG_ScrollWidget::handleScrollTrack PG_ScrollBar widget,
long  data
[protected]
 

Reimplemented in CargoWidget.

Definition at line 258 of file pgscrollwidget.cpp.

References PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, and PG_ScrollArea::ScrollTo().

Referenced by PG_ScrollWidget().

void PG_ScrollWidget::LoadThemeStyle const std::string &  widgettype  ) 
 

Load a specific themestyle.

Parameters:
widgettype name of widget type to load

Reimplemented from PG_ThemeWidget.

Definition at line 194 of file pgscrollwidget.cpp.

References PG_Rect::Height(), PG_Widget::IsVisible(), PG_ScrollBar::LoadThemeStyle(), PG_ThemeWidget::LoadThemeStyle(), my_heightHorizontalScrollbar, my_objHorizontalScrollbar, my_objVerticalScrollbar, my_widthScrollbar, and PG_Rect::Width().

Referenced by PG_DropDown::LoadThemeStyle(), and PG_WidgetList::PG_WidgetList().

void PG_ScrollWidget::RemoveAll  )  [virtual]
 

Reimplemented in PG_ListBox.

Definition at line 400 of file pgscrollwidget.cpp.

References my_scrollarea, and PG_ScrollArea::RemoveAll().

void PG_ScrollWidget::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 390 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_Rect::IsNull(), my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, and PG_ScrollArea::ScrollTo().

Referenced by TextRenderer::eventKeyDown(), eventMouseButtonDown(), and ItemSelectorWidget::reLoad().

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

Scroll to a widget.

Parameters:
widget the target widget
bVertical scroll direction

Definition at line 336 of file pgscrollwidget.cpp.

References CheckScrollBars(), PG_Rect::IsNull(), my_objHorizontalScrollbar, my_objVerticalScrollbar, my_scrollarea, and PG_ScrollArea::ScrollToWidget().

Referenced by ItemSelectorWidget::locateObject(), and ItemSelectorWidget::moveSelection().

void PG_ScrollWidget::SetAutoResize bool  bRemove,
bool  bAdd
 

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

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

Reimplemented in PG_RichEdit.

Definition at line 416 of file pgscrollwidget.cpp.

References my_scrollarea, and PG_ScrollArea::SetResizeParent().

Referenced by PG_DropDown::PG_DropDown().

void PG_ScrollWidget::SetLineSize int  linesize  ) 
 

Linesize is the scroll distance that is scrolled if one of the arrow buttons is pressed.

Definition at line 285 of file pgscrollwidget.cpp.

References my_scrollLineSize.

Referenced by TextRenderer::TextRenderer().

void PG_ScrollWidget::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 404 of file pgscrollwidget.cpp.

References my_scrollarea, and PG_ScrollArea::SetShiftOnRemove().

Referenced by PG_DropDown::PG_DropDown().


Member Data Documentation

bool PG_ScrollWidget::my_enableHorizontalScrollbar [protected]
 

Definition at line 164 of file pgscrollwidget.h.

Referenced by EnableScrollBar(), and PG_ScrollWidget().

bool PG_ScrollWidget::my_enableVerticalScrollbar [protected]
 

Definition at line 163 of file pgscrollwidget.h.

Referenced by EnableScrollBar(), and PG_ScrollWidget().

int PG_ScrollWidget::my_heightHorizontalScrollbar [protected]
 

Definition at line 161 of file pgscrollwidget.h.

Referenced by LoadThemeStyle(), and PG_ScrollWidget().

PG_ScrollBar* PG_ScrollWidget::my_objHorizontalScrollbar [protected]
 

Definition at line 157 of file pgscrollwidget.h.

Referenced by PG_WidgetList::AddChild(), AddChild(), CargoWidget::CargoWidget(), CheckScrollBars(), EnableScrollBar(), PG_RichEdit::eventBlit(), handleScrollPos(), handleScrollTrack(), LoadThemeStyle(), PG_RichEdit::PG_RichEdit(), PG_ScrollWidget(), ScrollTo(), and ScrollToWidget().

PG_ScrollBar* PG_ScrollWidget::my_objVerticalScrollbar [protected]
 

Definition at line 156 of file pgscrollwidget.h.

Referenced by PG_WidgetList::AddChild(), AddChild(), CargoWidget::CargoWidget(), CheckScrollBars(), EnableScrollBar(), PG_RichEdit::eventBlit(), eventMouseButtonDown(), handleScrollPos(), handleScrollTrack(), LoadThemeStyle(), PG_RichEdit::PG_RichEdit(), PG_ScrollWidget(), ScrollTo(), and ScrollToWidget().

PG_ScrollArea* PG_ScrollWidget::my_scrollarea [protected]
 

Definition at line 158 of file pgscrollwidget.h.

Referenced by PG_WidgetList::AddChild(), AddChild(), PG_ListBox::AddChild(), CheckScrollBars(), DeleteAll(), PG_ListBox::DeleteAll(), PG_RichEdit::eventBlit(), eventSizeWidget(), PG_WidgetList::FindWidget(), GetFirstInList(), GetListHeight(), GetListWidth(), GetScrollPosX(), GetScrollPosY(), PG_ListBox::GetSelectedItems(), GetWidgetCount(), handleAreaChangedHeight(), handleAreaChangedWidth(), handleScrollPos(), handleScrollTrack(), PG_WidgetList::PageDown(), PG_WidgetList::PageUp(), PG_RichEdit::PG_RichEdit(), PG_ScrollWidget(), PG_WidgetList::PG_WidgetList(), RemoveAll(), PG_ListBox::RemoveAll(), PG_WidgetList::ScrollTo(), ScrollTo(), ScrollToWidget(), PG_ListBox::SetAlignment(), SetAutoResize(), PG_ListBox::SetIndent(), SetShiftOnRemove(), PG_RichEdit::SetText(), and ~PG_ScrollWidget().

int PG_ScrollWidget::my_scrollLineSize [protected]
 

Definition at line 165 of file pgscrollwidget.h.

Referenced by CheckScrollBars(), GetLineSize(), and SetLineSize().

int PG_ScrollWidget::my_widthScrollbar [protected]
 

Definition at line 160 of file pgscrollwidget.h.

Referenced by LoadThemeStyle(), PG_ScrollWidget(), and PG_PropertyEditor::RegisterProperty().

PG_ScrollArea::SignalAreaChangedHeight PG_ScrollWidget::sigAreaChangedHeight
 

Definition at line 135 of file pgscrollwidget.h.

Referenced by PG_ScrollWidget().

PG_ScrollArea::SignalAreaChangedWidth PG_ScrollWidget::sigAreaChangedWidth
 

Definition at line 137 of file pgscrollwidget.h.

Referenced by PG_ScrollWidget().


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