#include <Scroll.h>
Inheritance diagram for GG::Scroll:
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) |
Button * | TabButton () const |
Button * | IncrButton () const |
Button * | DecrButton () const |
Mutators | |
virtual bool | EventFilter (Wnd *w, const WndEvent &event) |
Public Types | |
enum | ScrollRegion { SBR_NONE, SBR_PAGE_DN, SBR_PAGE_UP } |
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.
typedef boost::signal<void (int, int, int, int)> GG::Scroll::ScrolledSignalType |
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
typedef ScrolledSignalType::slot_type GG::Scroll::ScrolledSlotType |
typedef ScrolledAndStoppedSignalType::slot_type GG::Scroll::ScrolledAndStoppedSlotType |
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
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
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.
respond to left button down msg.
A window receives this whenever any input device button changes from up to down while over the window.
Reimplemented from GG::Wnd.
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.
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.
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.
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] |
virtual void GG::Scroll::SetColor | ( | Clr | c | ) | [virtual] |
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)
ScrolledSignalType GG::Scroll::ScrolledSignal [mutable] |