GG::Scroll Class Reference

This is a basic scrollbar control. More...

#include <Scroll.h>

Inheritance diagram for GG::Scroll:

GG::Control GG::Wnd List of all members.

Signal Types

typedef boost::signal< void(int, int, int, int)> ScrolledSignalType
typedef boost::signal< void(int, int, int, int)> ScrolledAndStoppedSignalType

Slot Types

typedef ScrolledSignalType::slot_type ScrolledSlotType
typedef ScrolledAndStoppedSignalType::slot_type ScrolledAndStoppedSlotType

Accessors

ScrolledSignalType ScrolledSignal
ScrolledAndStoppedSignalType ScrolledAndStoppedSignal
virtual Pt MinUsableSize () const
std::pair< int, int > PosnRange () const
std::pair< int, int > ScrollRange () const
int LineSize () const
int PageSize () const
Clr InteriorColor () const
Orientation ScrollOrientation () const

Structors

 Scroll (int x, int y, int w, int h, Orientation orientation, Clr color, Clr interior, Flags< WndFlag > flags=CLICKABLE|REPEAT_BUTTON_DOWN)

Mutators

virtual void Render ()
virtual void LButtonDown (const Pt &pt, Flags< ModKey > mod_keys)
virtual void LButtonUp (const Pt &pt, Flags< ModKey > mod_keys)
virtual void LClick (const Pt &pt, Flags< ModKey > mod_keys)
virtual void MouseHere (const Pt &pt, Flags< ModKey > mod_keys)
virtual void SizeMove (const Pt &ul, const Pt &lr)
virtual void Disable (bool b=true)
virtual void SetColor (Clr c)
void SetInteriorColor (Clr c)
void SizeScroll (int min, int max, int line, int page)
void SetMax (int max)
void SetMin (int min)
void SetLineSize (int line)
void SetPageSize (int page)
void ScrollTo (int p)
void ScrollLineIncr ()
void ScrollLineDecr ()
void ScrollPageIncr ()
void ScrollPageDecr ()
virtual void DefineAttributes (WndEditor *editor)

Structors

 Scroll ()

Accessors

int TabSpace () const
int TabWidth () const
ScrollRegion RegionUnder (const Pt &pt)
ButtonTabButton () const
ButtonIncrButton () const
ButtonDecrButton () const

Mutators

virtual bool EventFilter (Wnd *w, const WndEvent &event)

Public Types

enum  ScrollRegion {
  SBR_NONE,
  SBR_PAGE_DN,
  SBR_PAGE_UP
}

Detailed Description

This is a basic scrollbar control.

The range of the values the scrollbar represents is [m_range_min, m_range_max]. However, m_posn can only range over [m_range_min, m_range_max - m_page_sz], because the tab has a logical width of m_page_sz. So the region of the scrollbar's range being viewed at any one time is [m_posn, m_posn + m_page_sz]. (m_posn + m_page_sz is actually the last + 1 element of the range.) The parent of the control is notified of a scroll via ScrolledSignalType signals; these are emitted from the Scroll*() functions and the UpdatePosn() function. This should cover every instance in which m_posn is altered. The parent can poll the control to get its current view area with a call to GetPosnRange(). An increase in a vertical scroll is down, and a decrease is up; since GG assumes the y-coordinates are downwardly increasing. The rather plain default buttons and tab can be replaced by any Button-derived controls desired. However, if you want to serialize a Scroll that has custom buttons and/or tab, you must make sure they are properly registered. See the boost serialization documentation for details.

Definition at line 49 of file Scroll.h.


Member Typedef Documentation

typedef boost::signal<void (int, int, int, int)> GG::Scroll::ScrolledSignalType

emitted whenever the scrollbar is moved; the upper and lower extents of the tab and the upper and lower bounds of the scroll's range are indicated, respectively

Definition at line 60 of file Scroll.h.

typedef boost::signal<void (int, int, int, int)> GG::Scroll::ScrolledAndStoppedSignalType

emitted when the scrollbar's tab is stopped after being dragged, the scrollbar is adjusted using the keyboard, or the scrollbar is moved programmatically; the upper and lower extents of the tab and the upper and lower bounds of the scroll's range are indicated, respectively

Definition at line 61 of file Scroll.h.

typedef ScrolledSignalType::slot_type GG::Scroll::ScrolledSlotType

type of functor(s) invoked on a ScrolledSignalType

Definition at line 65 of file Scroll.h.

typedef ScrolledAndStoppedSignalType::slot_type GG::Scroll::ScrolledAndStoppedSlotType

type of functor(s) invoked on a ScrolledAndStoppedSignalType

Definition at line 66 of file Scroll.h.


Member Enumeration Documentation

enum GG::Scroll::ScrollRegion

the clickable regions of a Scroll

Enumerator:
SBR_NONE 
SBR_PAGE_DN 
SBR_PAGE_UP 

Definition at line 53 of file Scroll.h.


Constructor & Destructor Documentation

GG::Scroll::Scroll ( int  x,
int  y,
int  w,
int  h,
Orientation  orientation,
Clr  color,
Clr  interior,
Flags< WndFlag >  flags = CLICKABLE|REPEAT_BUTTON_DOWN 
)

ctor.

GG::Scroll::Scroll (  )  [protected]

defalt ctor


Member Function Documentation

virtual Pt GG::Scroll::MinUsableSize (  )  const [virtual]

returns the size of the minimum bounding box that can enclose the Wnd and still show all of its elements, plus enough room for interaction with those elements (if applicable).

For example, a TextControl's MinUsableSize() is just the area of its text, and a Scroll's RenderableMinSize() is the combined sizes of its up-button, down-button, and tab (plus a bit of room in which to drag the tab).

Reimplemented from GG::Wnd.

std::pair<int, int> GG::Scroll::PosnRange (  )  const

range currently being viewed

std::pair<int, int> GG::Scroll::ScrollRange (  )  const

defined possible range of control

int GG::Scroll::LineSize (  )  const

returns the current line size

int GG::Scroll::PageSize (  )  const

returns the current page size

Clr GG::Scroll::InteriorColor (  )  const

returns the color used to render the interior of the Scroll

Orientation GG::Scroll::ScrollOrientation (  )  const

returns the orientation of the Scroll

virtual void GG::Scroll::Render (  )  [virtual]

draws this Wnd.

Note that Wnds being dragged for a drag-and-drop operation are rendered twice -- once in-place as normal, once in the location of the drag operation, attached to the cursor. Such Wnds may wish to render themselves differently in those two cases. To determine which render is being performed, they can call GUI::GetGUI()->RenderingDragDropWnds().

Implements GG::Control.

virtual void GG::Scroll::LButtonDown ( const Pt pt,
Flags< ModKey >  mod_keys 
) [virtual]

respond to left button down msg.

A window receives this whenever any input device button changes from up to down while over the window.

Note:
If this Wnd was created with the REPEAT_BUTTON_DOWN flag, this method may be called multiple times during a single button press-release cycle.
See also:
GG::GUI

Reimplemented from GG::Wnd.

virtual void GG::Scroll::LButtonUp ( const Pt pt,
Flags< ModKey >  mod_keys 
) [virtual]

respond to release of left mouse button outside this Wnd, if it was originally depressed over this Wnd.

A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends, even if the cursor is not currently over the window when this happens.

Reimplemented from GG::Wnd.

virtual void GG::Scroll::LClick ( const Pt pt,
Flags< ModKey >  mod_keys 
) [virtual]

respond to release of left mouse button over this Wnd, if it was also originally depressed over this Wnd.

A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends over its area as well.

Reimplemented from GG::Wnd.

virtual void GG::Scroll::MouseHere ( const Pt pt,
Flags< ModKey >  mod_keys 
) [virtual]

respond to cursor moving about within the Wnd, or to cursor lingering within the Wnd for a long period of time.

A MouseHere() message will not be generated the first time the cursor enters the window's area. In that case, a MouseEnter() message is generated.

Reimplemented from GG::Wnd.

virtual void GG::Scroll::SizeMove ( const Pt ul,
const Pt lr 
) [virtual]

resizes and/or moves window to new upper-left and lower right boundaries

Reimplemented from GG::Wnd.

virtual void GG::Scroll::Disable ( bool  b = true  )  [virtual]

disables/enables the control; disabled controls appear greyed

Reimplemented from GG::Control.

virtual void GG::Scroll::SetColor ( Clr  c  )  [virtual]

sets the color of the control

Reimplemented from GG::Control.

void GG::Scroll::SetInteriorColor ( Clr  c  ) 

sets the color painted into the client area of the control

void GG::Scroll::SizeScroll ( int  min,
int  max,
int  line,
int  page 
)

sets the logical ranges of the control, and the logical increment values

void GG::Scroll::SetMax ( int  max  ) 

sets the maximum value of the scroll

void GG::Scroll::SetMin ( int  min  ) 

sets the minimum value of the scroll

void GG::Scroll::SetLineSize ( int  line  ) 

sets the size of a line in the scroll. This is the number of logical units the tab moves when either of the up or down buttons is pressed.

void GG::Scroll::SetPageSize ( int  page  ) 

sets the size of a line page in the scroll. This is the number of logical units the tab moves when either of the page-up or page-down areas is clicked.

void GG::Scroll::ScrollTo ( int  p  ) 

scrolls the control to a certain spot

void GG::Scroll::ScrollLineIncr (  ) 

scrolls the control down (or right) by a line

void GG::Scroll::ScrollLineDecr (  ) 

scrolls the control up (or left) by a line

void GG::Scroll::ScrollPageIncr (  ) 

scrolls the control down (or right) by a page

void GG::Scroll::ScrollPageDecr (  ) 

scrolls the control up (or left) by a page

virtual void GG::Scroll::DefineAttributes ( WndEditor *  editor  )  [virtual]

provides the attributes of this object that are appropriate for a user to edit in a WndEditor; see WndEditor for details.

Reimplemented from GG::Control.

int GG::Scroll::TabSpace (  )  const [protected]

returns the space the tab has to move about in (the control's width less the width of the incr & decr buttons)

int GG::Scroll::TabWidth (  )  const [protected]

returns the calculated width of the tab, based on PageSize() and the logical size of the control, in pixels

ScrollRegion GG::Scroll::RegionUnder ( const Pt pt  )  [protected]

determines whether a pt is in the incr or decr or tab buttons, or in PgUp/PgDn regions in between

Button* GG::Scroll::TabButton (  )  const [protected]

returns the button representing the tab

Button* GG::Scroll::IncrButton (  )  const [protected]

returns the increase button (line down/line right)

Button* GG::Scroll::DecrButton (  )  const [protected]

returns the decrease button (line up/line left)

virtual bool GG::Scroll::EventFilter ( Wnd w,
const WndEvent event 
) [protected, virtual]

handles an WndEvent destined for Wnd w, but which this Wnd is allowed to handle first.

Returns true if this filter processed the message.

Reimplemented from GG::Wnd.


Member Data Documentation

ScrolledSignalType GG::Scroll::ScrolledSignal [mutable]

the scrolled signal object for this Scroll

Definition at line 86 of file Scroll.h.

ScrolledAndStoppedSignalType GG::Scroll::ScrolledAndStoppedSignal [mutable]

the scrolled-and-stopped signal object for this Scroll

Definition at line 87 of file Scroll.h.


The documentation for this class was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2