Crazy Eddie's GUI System
0.8.4
|
Base class for item list widgets. More...
Public Types | |
enum | SortMode { Ascending, Descending, UserSort } |
Sort modes for ItemListBase. | |
typedef bool(* | SortCallback )(const ItemEntry *a, const ItemEntry *b) |
Public Member Functions | |
size_t | getItemCount (void) const |
Return number of items attached to the list. | |
ItemEntry * | getItemFromIndex (size_t index) const |
Return the item at index position index. | |
size_t | getItemIndex (const ItemEntry *item) const |
Return the index of ItemEntry item. | |
ItemEntry * | findItemWithText (const String &text, const ItemEntry *start_item) |
Search the list for an item with the specified text. | |
bool | isItemInList (const ItemEntry *item) const |
Return whether the specified ItemEntry is in the List. | |
bool | isAutoResizeEnabled () const |
Return whether this window is automatically resized to fit its content. | |
bool | isSortEnabled (void) const |
Returns 'true' if the list is sorted. | |
SortMode | getSortMode (void) const |
Get sort mode. | |
SortCallback | getSortCallback (void) const |
Get user sorting callback. | |
virtual void | initialiseComponents (void) |
Initialise the Window based object ready for use. | |
void | resetList (void) |
Remove all items from the list. | |
void | addItem (ItemEntry *item) |
Add the given ItemEntry to the list. | |
void | insertItem (ItemEntry *item, const ItemEntry *position) |
Insert an item into the list before a specified item already in the list. | |
void | removeItem (ItemEntry *item) |
Removes the given item from the list. If the item is has the 'DestroyedByParent' property set to 'true', the item will be deleted. | |
void | handleUpdatedItemData (bool resort=false) |
Causes the list to update it's internal state after changes have been made to one or more attached ItemEntry objects. | |
void | setAutoResizeEnabled (bool setting) |
Set whether or not this ItemListBase widget should automatically resize to fit its content. | |
virtual void | sizeToContent (void) |
Resize the ItemListBase to exactly fit the content that is attached to it. Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering items. | |
virtual void | endInitialisation (void) |
Triggers a ListContentsChanged event. These are not fired during initialisation for optimization purposes. | |
void | performChildWindowLayout (bool nonclient_sized_hint=false, bool client_sized_hint=false) |
Rectf | getItemRenderArea (void) const |
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering list items. | |
Window * | getContentPane (void) const |
Returns a pointer to the window that all items are directed too. | |
virtual void | notifyItemClicked (ItemEntry *) |
Notify this ItemListBase that the given item was just clicked. Internal function - NOT to be used from client code. | |
virtual void | notifyItemSelectState (ItemEntry *, bool) |
Notify this ItemListBase that the given item just changed selection state. Internal function - NOT to be used from client code. | |
void | setSortEnabled (bool setting) |
Set whether the list should be sorted (by text). | |
void | setSortMode (SortMode mode) |
Set mode to be used when sorting the list. | |
void | setSortCallback (SortCallback cb) |
Set a user callback as sorting function. | |
void | sortList (bool relayout=true) |
Sort the list. | |
ItemListBase (const String &type, const String &name) | |
Constructor for ItemListBase base class. | |
virtual | ~ItemListBase (void) |
Destructor for ItemListBase base class. | |
Static Public Attributes | |
static const String | EventNamespace |
Namespace for global events. | |
static const String | EventListContentsChanged |
static const String | EventSortEnabledChanged |
static const String | EventSortModeChanged |
Protected Types | |
typedef std::vector< ItemEntry *CEGUI_VECTOR_ALLOC(ItemEntry *) | ItemEntryList ) |
Protected Member Functions | |
virtual void | sizeToContent_impl (void) |
Resize the ItemListBase to exactly fit the content that is attached to it. Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering items. | |
virtual Sizef | getContentSize () const =0 |
Returns the Size in unclipped pixels of the content attached to this ItemListBase that is attached to it. | |
virtual void | layoutItemWidgets ()=0 |
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering list items. | |
bool | resetList_impl (void) |
Remove all items from the list. | |
virtual bool | validateWindowRenderer (const WindowRenderer *renderer) const |
Function used in checking if a WindowRenderer is valid for this window. | |
SortCallback | getRealSortCallback (void) const |
Returns the SortCallback that's really going to be used for the sorting operation. | |
virtual void | onListContentsChanged (WindowEventArgs &e) |
Handler called internally when the list contents are changed. | |
virtual void | onSortEnabledChanged (WindowEventArgs &e) |
Handler called internally when sorting gets enabled. | |
virtual void | onSortModeChanged (WindowEventArgs &e) |
Handler called internally when the sorting mode is changed. | |
virtual void | onParentSized (ElementEventArgs &e) |
Handler called when this window's parent window has been resized. If this window is the root / GUI Sheet window, this call will be made when the display size changes. | |
virtual bool | handle_PaneChildRemoved (const EventArgs &e) |
Handler to manage items being removed from the content pane. If there is one! | |
Protected Attributes | |
ItemEntryList | d_listItems |
list of items in the list. | |
bool | d_autoResize |
Pointer to the content pane (for items), 0 if we're not using one. | |
Window * | d_pane |
True if this ItemListBase is sorted. False if not. | |
bool | d_sortEnabled |
The current sorting mode applied if sorting is enabled. | |
SortMode | d_sortMode |
The user sort callback or 0 if none. | |
SortCallback | d_sortCallback |
True if the list needs to be resorted. | |
bool | d_resort |
Base class for item list widgets.
void CEGUI::ItemListBase::addItem | ( | ItemEntry * | item | ) |
ItemEntry* CEGUI::ItemListBase::findItemWithText | ( | const String & | text, |
const ItemEntry * | start_item | ||
) |
Search the list for an item with the specified text.
text | String object containing the text to be searched for. |
start_item | ItemEntry where the search is to begin, the search will not include item. If item is NULL, the search will begin from the first item in the list. |
InvalidRequestException | thrown if item is not attached to this list box. |
Window* CEGUI::ItemListBase::getContentPane | ( | void | ) | const [inline] |
Returns a pointer to the window that all items are directed too.
virtual Sizef CEGUI::ItemListBase::getContentSize | ( | ) | const [protected, pure virtual] |
Returns the Size in unclipped pixels of the content attached to this ItemListBase that is attached to it.
Implemented in CEGUI::ItemListbox, CEGUI::PopupMenu, and CEGUI::Menubar.
size_t CEGUI::ItemListBase::getItemCount | ( | void | ) | const [inline] |
Return number of items attached to the list.
ItemEntry* CEGUI::ItemListBase::getItemFromIndex | ( | size_t | index | ) | const |
Return the item at index position index.
index | Zero based index of the item to be returned. |
InvalidRequestException | thrown if index is out of range. |
size_t CEGUI::ItemListBase::getItemIndex | ( | const ItemEntry * | item | ) | const |
Return the index of ItemEntry item.
item | Pointer to a ItemEntry whos zero based index is to be returned. |
InvalidRequestException | thrown if item is not attached to this list. |
Rectf CEGUI::ItemListBase::getItemRenderArea | ( | void | ) | const |
virtual bool CEGUI::ItemListBase::handle_PaneChildRemoved | ( | const EventArgs & | e | ) | [protected, virtual] |
Handler to manage items being removed from the content pane. If there is one!
Reimplemented in CEGUI::ItemListbox.
void CEGUI::ItemListBase::handleUpdatedItemData | ( | bool | resort = false | ) |
Causes the list to update it's internal state after changes have been made to one or more attached ItemEntry objects.
It should not be necessary to call this from client code, as the ItemEntries themselves call it if their parent is an ItemListBase.
resort | 'true' to redo the list sorting as well. 'false' to only do layout and perhaps auto resize. (defaults to 'false') |
virtual void CEGUI::ItemListBase::initialiseComponents | ( | void | ) | [virtual] |
Initialise the Window based object ready for use.
Reimplemented from CEGUI::Window.
Reimplemented in CEGUI::ScrolledItemListBase.
void CEGUI::ItemListBase::insertItem | ( | ItemEntry * | item, |
const ItemEntry * | position | ||
) |
Insert an item into the list before a specified item already in the list.
Note that if the list is sorted, the item may not end up in the requested position.
item | Pointer to the ItemEntry to be inserted. Note that it is the passed object that is added to the list, a copy is not made. If this parameter is NULL, nothing happens. |
position | Pointer to a ItemEntry that item is to be inserted before. If this parameter is NULL, the item is inserted at the start of the list. |
bool CEGUI::ItemListBase::isAutoResizeEnabled | ( | ) | const [inline] |
Return whether this window is automatically resized to fit its content.
bool CEGUI::ItemListBase::isItemInList | ( | const ItemEntry * | item | ) | const |
virtual void CEGUI::ItemListBase::layoutItemWidgets | ( | ) | [protected, pure virtual] |
Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering list items.
Setup size and position for the item widgets attached to this ItemListBase
Implemented in CEGUI::ItemListbox, CEGUI::PopupMenu, and CEGUI::Menubar.
virtual void CEGUI::ItemListBase::onParentSized | ( | ElementEventArgs & | e | ) | [protected, virtual] |
Handler called when this window's parent window has been resized. If this window is the root / GUI Sheet window, this call will be made when the display size changes.
e | WindowEventArgs object whose 'window' pointer field is set the the window that caused the event; this is typically either this window's parent window, or NULL to indicate the screen size has changed. |
Reimplemented from CEGUI::Window.
void CEGUI::ItemListBase::performChildWindowLayout | ( | bool | nonclient_sized_hint = false , |
bool | client_sized_hint = false |
||
) | [virtual] |
Layout child window content.
Laying out of child content includes:
The system may call this at various times (like when a window is resized for example), and it may be invoked directly where required.
nonclient_sized_hint | Hint that the non-client area rectangle has changed size. |
client_sized_hint | Hint that the client area rectangle has changed size. |
Reimplemented from CEGUI::Window.
void CEGUI::ItemListBase::removeItem | ( | ItemEntry * | item | ) |
Removes the given item from the list. If the item is has the 'DestroyedByParent' property set to 'true', the item will be deleted.
item | Pointer to the ItemEntry that is to be removed. If item is not attached to this list then nothing will happen. |
void CEGUI::ItemListBase::resetList | ( | void | ) |
Remove all items from the list.
Note that this will cause items, which does not have the 'DestroyedByParent' property set to 'false', to be deleted.
bool CEGUI::ItemListBase::resetList_impl | ( | void | ) | [protected] |
Remove all items from the list.
void CEGUI::ItemListBase::setAutoResizeEnabled | ( | bool | setting | ) |
Set whether or not this ItemListBase widget should automatically resize to fit its content.
setting | Boolean value that if true enables automatic resizing, if false disables automatic resizing. |
void CEGUI::ItemListBase::setSortCallback | ( | SortCallback | cb | ) |
Set a user callback as sorting function.
mode | SortCallback |
void CEGUI::ItemListBase::setSortMode | ( | SortMode | mode | ) |
Set mode to be used when sorting the list.
mode | SortMode enum. |
virtual void CEGUI::ItemListBase::sizeToContent | ( | void | ) | [inline, virtual] |
Resize the ItemListBase to exactly fit the content that is attached to it. Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering items.
virtual void CEGUI::ItemListBase::sizeToContent_impl | ( | void | ) | [protected, virtual] |
Resize the ItemListBase to exactly fit the content that is attached to it. Return a Rect object describing, in un-clipped pixels, the window relative area that is to be used for rendering items.
void CEGUI::ItemListBase::sortList | ( | bool | relayout = true | ) |
Sort the list.
relayout | True if the item layout should be redone after the sorting. False to only sort the internal list. Nothing more. |
This parameter defaults to true and should generally not be used in client code.
virtual bool CEGUI::ItemListBase::validateWindowRenderer | ( | const WindowRenderer * | renderer | ) | const [protected, virtual] |
Function used in checking if a WindowRenderer is valid for this window.
renderer | Window renderer that will be checked (it can be null!) |
Reimplemented from CEGUI::Window.
ItemEntryList CEGUI::ItemListBase::d_listItems [protected] |
list of items in the list.
True if this ItemListBase widget should automatically resize to fit its content. False if not.
const String CEGUI::ItemListBase::EventListContentsChanged [static] |
Event fired when the contents of the list is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ItemListBase whose contents has changed.
const String CEGUI::ItemListBase::EventSortEnabledChanged [static] |
Event fired when the sort enabled state of the list is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ItemListBase whose sort enabled mode has been changed.
const String CEGUI::ItemListBase::EventSortModeChanged [static] |
Event fired when the sort mode of the list is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the ItemListBase whose sorting mode has been changed.