#include <DropDownList.h>
Inheritance diagram for GG::DropDownList:
Signal Types | |
typedef boost::signal< void(int)> | SelChangedSignalType |
Slot Types | |
typedef SelChangedSignalType::slot_type | SelChangedSlotType |
Accessors | |
SelChangedSignalType | SelChangedSignal |
const Row * | CurrentItem () const |
int | CurrentItemIndex () const |
bool | Empty () const |
const Row & | GetItem (int n) const |
bool | Selected (int n) const |
Clr | InteriorColor () const |
int | DropHeight () const |
Flags< ListBoxStyle > | Style () const |
int | NumRows () const |
int | NumCols () const |
int | SortCol () const |
int | ColWidth (int n) const |
Alignment | ColAlignment (int n) const |
Alignment | RowAlignment (int n) const |
virtual Pt | ClientUpperLeft () const |
virtual Pt | ClientLowerRight () const |
Structors | |
DropDownList (int x, int y, int w, int h, int drop_ht, Clr color, Flags< WndFlag > flags=CLICKABLE) | |
~DropDownList () | |
Mutators | |
virtual void | Render () |
virtual void | LClick (const Pt &pt, Flags< ModKey > mod_keys) |
virtual void | KeyPress (Key key, Flags< ModKey > mod_keys) |
virtual void | SizeMove (const Pt &ul, const Pt &lr) |
virtual void | SetColor (Clr c) |
int | Insert (Row *row, int at=-1) |
Row * | Erase (int idx) |
void | Clear () |
Row & | GetRow (int n) |
void | Select (int row) |
void | SetInteriorColor (Clr c) |
void | SetDropHeight (int h) |
void | SetStyle (Flags< ListBoxStyle > s) |
void | SetNumCols (int n) |
void | SetSortCol (int n) |
void | SetColWidth (int n, int w) |
void | LockColWidths () |
void | UnLockColWidths () |
void | SetColAlignment (int n, Alignment align) |
void | SetRowAlignment (int n, Alignment align) |
virtual void | DefineAttributes (WndEditor *editor) |
Structors | |
DropDownList () | |
Mutators | |
ListBox * | LB () |
Public Types | |
typedef ListBox::Row | Row |
DropDownList is based upon GG::ListBox, but has significant restrictions over the functionality of GG::ListBox. Specifically, all list items must have the same height, list items may not have subrows, and there is no dragging or dropping. Though any Control-derived object may be placed in an item cell, the items are only interactive in the drop-down list; the currently selected item is displayed only. In the DropDownList constructor, there is no "h" height parameter as there is in the other Wnd-derived class contructors. The "row_ht" parameter takes the place of "h", but it has a slightly different meaning. A cell-margin and the thickness of the border around the DropDownList are added to "row_ht" to determine the actual height of the control. All subequent resizing calls will lock the height of the control to this calculated height. The "drop_ht" parameter determines the vertical size of the drop-down list. Most of the ListBox interface is duplicated in DropDownList. Though you can still set the alignment, etc. of individual rows, as in ListBox, the currently-selected row will have the same alignment, etc. when displayed in the control in its unopened state. This may look quite ugly.
Definition at line 50 of file DropDownList.h.
typedef ListBox::Row GG::DropDownList::Row |
This is a single item in a dropdown list.
Definition at line 54 of file DropDownList.h.
typedef boost::signal<void (int)> GG::DropDownList::SelChangedSignalType |
emitted when a new item is selected; the int parameter will be -1 when no item is selected
Definition at line 57 of file DropDownList.h.
typedef SelChangedSignalType::slot_type GG::DropDownList::SelChangedSlotType |
GG::DropDownList::DropDownList | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
int | drop_ht, | |||
Clr | color, | |||
Flags< WndFlag > | flags = CLICKABLE | |||
) |
basic ctor.
DropDownList retains ownership of lb, if it is non-null.
GG::DropDownList::~DropDownList | ( | ) |
dtor
GG::DropDownList::DropDownList | ( | ) | [protected] |
default ctor
const Row* GG::DropDownList::CurrentItem | ( | ) | const |
returns a pointer to the currently selected list item (returns 0 if none is selected)
int GG::DropDownList::CurrentItemIndex | ( | ) | const |
returns the list index of the currently selected list item (returns -1 if none is selected)
bool GG::DropDownList::Empty | ( | ) | const |
returns true when the list is empty
const Row& GG::DropDownList::GetItem | ( | int | n | ) | const |
returns a const reference to the row at index n; not range-checked
bool GG::DropDownList::Selected | ( | int | n | ) | const |
returns true if row n is selected
Clr GG::DropDownList::InteriorColor | ( | ) | const |
returns the color painted into the client area of the control
int GG::DropDownList::DropHeight | ( | ) | const |
returns the height of the drop-down list
Flags<ListBoxStyle> GG::DropDownList::Style | ( | ) | const |
returns the style flags of the list
int GG::DropDownList::NumRows | ( | ) | const |
returns the total number of items in the list
int GG::DropDownList::NumCols | ( | ) | const |
returns the total number of columns in each list item
int GG::DropDownList::SortCol | ( | ) | const |
returns the index of the column used to sort items, when sorting is enabled.
int GG::DropDownList::ColWidth | ( | int | n | ) | const |
returns the width of column n in pixels; not range-checked
Alignment GG::DropDownList::ColAlignment | ( | int | n | ) | const |
returns the alignment of column n; must be LIST_LEFT, LIST_CENTER, or LIST_RIGHT; not range-checked
Alignment GG::DropDownList::RowAlignment | ( | int | n | ) | const |
returns the alignment of row n; must be LIST_TOP, LIST_VCENTER, or LIST_BOTTOM; not range-checked
virtual Pt GG::DropDownList::ClientUpperLeft | ( | ) | const [virtual] |
returns upper-left corner of window's client area in screen coordinates (or of the entire area, if no client area is specified).
Virtual because different windows have different shapes (and so ways of calculating client area)
Reimplemented from GG::Wnd.
virtual Pt GG::DropDownList::ClientLowerRight | ( | ) | const [virtual] |
returns (one pixel past) lower-right corner of window's client area in screen coordinates (or of the entire area, if no client area is specified).
Virtual because different windows have different shapes (and so ways of calculating client area)
Reimplemented from GG::Wnd.
virtual void GG::DropDownList::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 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 down-keystrokes (focus window only).
A window may receive KeyPress() messages passed up to it from its children. For instance, Control-derived classes pass KeyPress() messages to their Parent() windows by default.
Reimplemented from GG::Control.
resizes the control, ensuring the proper height is maintained based on the list's row height
Reimplemented from GG::Wnd.
virtual void GG::DropDownList::SetColor | ( | Clr | c | ) | [virtual] |
int GG::DropDownList::Insert | ( | Row * | row, | |
int | at = -1 | |||
) |
insertion sorts row into the list, or inserts into an unsorted list before index at; returns index of insertion point. This Row becomes the property of the DropDownList and should not be deleted or inserted into any other DropDownLists
Row* GG::DropDownList::Erase | ( | int | idx | ) |
removes and returns the row at index idx from the list, or 0 if no such row exists
void GG::DropDownList::Clear | ( | ) |
empties the list
Row& GG::DropDownList::GetRow | ( | int | n | ) |
returns a reference to the Row at row index n; not range-checked
void GG::DropDownList::Select | ( | int | row | ) |
selects row-item row in the list
void GG::DropDownList::SetInteriorColor | ( | Clr | c | ) |
sets the color painted into the client area of the control
void GG::DropDownList::SetDropHeight | ( | int | h | ) |
sets the height of the drop-down list
void GG::DropDownList::SetStyle | ( | Flags< ListBoxStyle > | s | ) |
sets the style flags for the list to s (invalidates currently selected item).
void GG::DropDownList::SetNumCols | ( | int | n | ) |
sets the number of columns in each list item to n; if no column widths exist before this call, proportional widths are calulated and set, otherwise no column widths are set
void GG::DropDownList::SetSortCol | ( | int | n | ) |
sets the index of the column used to sort rows when sorting is enabled (invalidates currently selected item); not range-checked
void GG::DropDownList::SetColWidth | ( | int | n, | |
int | w | |||
) |
sets the width of column
to w; not range-checked
void GG::DropDownList::LockColWidths | ( | ) |
fixes the column widths; by default, an empty list will take on the number of columns of its first added row.
void GG::DropDownList::UnLockColWidths | ( | ) |
allows the number of columns to be determined by the first row added to an empty ListBox
void GG::DropDownList::SetColAlignment | ( | int | n, | |
Alignment | align | |||
) |
sets the alignment of column n to align; not range-checked
void GG::DropDownList::SetRowAlignment | ( | int | n, | |
Alignment | align | |||
) |
sets the alignment of the Row at row index n to align; not range-checked
virtual void GG::DropDownList::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.
ListBox* GG::DropDownList::LB | ( | ) | [protected] |
returns the ListBox used to render the selected row and the popup list
the selection change signal object for this DropDownList
Definition at line 99 of file DropDownList.h.