#include <ListBox.h>
Inheritance diagram for GG::ListBox::Row:
Structors | |
Row () | |
Row (int w, int h, const std::string &drag_drop_data_type, Alignment align=ALIGN_VCENTER, int margin=2) | |
Accessors | |
SortKeyType | SortKey (int column) const |
size_t | size () const |
bool | empty () const |
Control * | operator[] (size_t n) const |
Control * | at (size_t n) const |
Alignment | RowAlignment () const |
Alignment | ColAlignment (int n) const |
int | ColWidth (int n) const |
int | Margin () const |
Control * | CreateControl (const std::string &str, const boost::shared_ptr< Font > &font, Clr color) const |
Control * | CreateControl (const SubTexture &st) const |
Mutators | |
virtual void | Render () |
void | push_back (Control *c) |
void | push_back (const std::string &str, const boost::shared_ptr< Font > &font, Clr color=CLR_BLACK) |
void | push_back (const std::string &str, const std::string &font_filename, int pts, Clr color=CLR_BLACK) |
void | push_back (const SubTexture &st) |
void | clear () |
void | resize (size_t n) |
void | SetCell (int n, Control *c) |
Control * | RemoveCell (int n) |
void | SetRowAlignment (Alignment align) |
void | SetColAlignment (int n, Alignment align) |
void | SetColWidth (int n, int width) |
void | SetColAlignments (const std::vector< Alignment > &aligns) |
void | SetColWidths (const std::vector< int > &widths) |
void | SetMargin (int margin) |
Public Types | |
typedef std::string | SortKeyType |
A Row is primarily a container for Controls. Each cell in a Row contains pointer to a Control-derived object. As always, each such Control can be connected to arbitrary functionality using signals and slots. During dragging and dropping, the data type associated with a Row (DragDropDataType()) indicates to potential drop targets what type of data the Row represents; the target may accept or decline the drop based on the data type. Rows are stored in ListBoxes by reference, not copy; this means that you can subclass from Row to create your own custom Row types. This is the recommended method for associating a row with the non-GUI object that it represents. Note that all subclasses of Row must declare a SortKeyType, if it differs from std::string, and must provide a SortKey() method if it should differ from the default SortKey() that Row provides. Note that SortKey is not virtual; this part of its interface is used for compile-time polymorphism -- whatever sorter is used with a Row subclass must know the most-derived type of the Row subclass.
Definition at line 110 of file ListBox.h.
typedef std::string GG::ListBox::Row::SortKeyType |
GG::ListBox::Row::Row | ( | ) |
default ctor
GG::ListBox::Row::Row | ( | int | w, | |
int | h, | |||
const std::string & | drag_drop_data_type, | |||
Alignment | align = ALIGN_VCENTER , |
|||
int | margin = 2 | |||
) |
ctor
SortKeyType GG::ListBox::Row::SortKey | ( | int | column | ) | const |
returns the string by which this row may be sorted
size_t GG::ListBox::Row::size | ( | ) | const |
returns the number of Controls in this Row
bool GG::ListBox::Row::empty | ( | ) | const |
returns true iff there are 0 Controls in this Row
Control* GG::ListBox::Row::operator[] | ( | size_t | n | ) | const |
Control* GG::ListBox::Row::at | ( | size_t | n | ) | const |
Alignment GG::ListBox::Row::RowAlignment | ( | ) | const |
returns the vertical alignment of this Row
Alignment GG::ListBox::Row::ColAlignment | ( | int | n | ) | const |
int GG::ListBox::Row::ColWidth | ( | int | n | ) | const |
returns the width of the nth cell of this Row; not range checked
int GG::ListBox::Row::Margin | ( | ) | const |
returns the amount of space left between the contents of adjacent cells, in pixels
Control* GG::ListBox::Row::CreateControl | ( | const std::string & | str, | |
const boost::shared_ptr< Font > & | font, | |||
Clr | color | |||
) | const |
creates a "shrink-fit" TextControl from text, font, and color parameters
Control* GG::ListBox::Row::CreateControl | ( | const SubTexture & | st | ) | const |
creates a "shrink-fit" StaticGraphic Control from a SubTexture parameter
virtual void GG::ListBox::Row::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.
void GG::ListBox::Row::push_back | ( | Control * | c | ) |
void GG::ListBox::Row::push_back | ( | const std::string & | str, | |
const boost::shared_ptr< Font > & | font, | |||
Clr | color = CLR_BLACK | |||
) |
overload of push_back that creates a TextControl and adds it to the Row
void GG::ListBox::Row::push_back | ( | const std::string & | str, | |
const std::string & | font_filename, | |||
int | pts, | |||
Clr | color = CLR_BLACK | |||
) |
overload of push_back that creates a TextControl and adds it to the Row
void GG::ListBox::Row::push_back | ( | const SubTexture & | st | ) |
overload of push_back that creates a StaticGraphic Control and adds it to the Row
void GG::ListBox::Row::clear | ( | ) |
removes and deletes all cells in this Row
void GG::ListBox::Row::resize | ( | size_t | n | ) |
resizes the Row to have n cells
void GG::ListBox::Row::SetCell | ( | int | n, | |
Control * | c | |||
) |
Control* GG::ListBox::Row::RemoveCell | ( | int | n | ) |
void GG::ListBox::Row::SetRowAlignment | ( | Alignment | align | ) |
sets the vertical alignment of this Row
void GG::ListBox::Row::SetColAlignment | ( | int | n, | |
Alignment | align | |||
) |
void GG::ListBox::Row::SetColWidth | ( | int | n, | |
int | width | |||
) |
sets the width of the nth cell of this Row; not range checked
void GG::ListBox::Row::SetColAlignments | ( | const std::vector< Alignment > & | aligns | ) |
sets the horizontal alignment of all the Controls in this Row; not range checked
void GG::ListBox::Row::SetColWidths | ( | const std::vector< int > & | widths | ) |
sets all the widths of the cells of this Row; not range checked
void GG::ListBox::Row::SetMargin | ( | int | margin | ) |
sets the amount of space left between the contents of adjacent cells, in pixels