Drag[en]gine Script Module DragonScript
1.23
|
Shared implementation of ListModel. More...
Public Member Functions | |
void | addListener (ListModelListener listener) |
Add listener. More... | |
SharedListModel | destructor () |
Destroy shared list model. More... | |
Object | getAt (int index) |
Element at index. More... | |
int | getCount () |
Count of elements. More... | |
ListModel | getModel () |
Linked model. More... | |
int | getSelected () |
Index of the selected element or -1 if there is no selected element. More... | |
bool | has (Object element) |
Element is present. More... | |
int | indexOf (Object element) |
Index of element or -1 if absent. More... | |
SharedListModel | new (ListModel model) |
Create shared list model linked to ListModel. More... | |
void | notifyContentChanged (int indexFrom, int indexTo) |
Notify all that the content of the model in the given range changed. More... | |
void | removeListener (ListModelListener listener) |
Remove listener. More... | |
void | setAutoSelect (bool autoSelect) |
Set to automatically select items. More... | |
void | setSelected (int index) |
Set index of selected element or -1 if none is no selected element. More... | |
void | setSelectedElement (Object element) |
Set selected element. More... | |
Public Attributes | |
bool | pAutoSelect |
Array | pListeners |
ListModel | pModel |
int | pSelected |
Object | pSelectedObject |
SharedModelListener | pSharedModelListener |
Shared implementation of ListModel.
ListModel implementation allowing to use another ListModel instance as shared model. This allows to use the same ListModel across multiple SharedListModel but with different selection state. This reduces coding effort and improves UI performance.
The typical use case is to use a globally accessible DefaultListModel storing the data you want to display in different parts of the UI using ComboBox or ListBox. Then for each ComboBox and ListBox use an instance of SharedListModel linked to the global DefaultListModel. Now you can changed the global DefaultListModel and all ComboBox and ListBox linked to it by SharedListModel are updated automatically while keeping their unique selection state.
void Dragengine.Gui.SharedListModel.addListener | ( | ListModelListener | listener | ) |
Add listener.
Implements Dragengine.Gui.ListModel.
SharedListModel Dragengine.Gui.SharedListModel.destructor | ( | ) |
Destroy shared list model.
Object Dragengine.Gui.SharedListModel.getAt | ( | int | index | ) |
Element at index.
EOutOfBounds | index is less than 0 or larger than or equal to getCount(). |
Implements Dragengine.Gui.ListModel.
int Dragengine.Gui.SharedListModel.getCount | ( | ) |
Count of elements.
Implements Dragengine.Gui.ListModel.
ListModel Dragengine.Gui.SharedListModel.getModel | ( | ) |
Linked model.
int Dragengine.Gui.SharedListModel.getSelected | ( | ) |
Index of the selected element or -1 if there is no selected element.
Implements Dragengine.Gui.ListModel.
bool Dragengine.Gui.SharedListModel.has | ( | Object | element | ) |
Element is present.
Implements Dragengine.Gui.ListModel.
int Dragengine.Gui.SharedListModel.indexOf | ( | Object | element | ) |
Index of element or -1 if absent.
Implements Dragengine.Gui.ListModel.
SharedListModel Dragengine.Gui.SharedListModel.new | ( | ListModel | model | ) |
Create shared list model linked to ListModel.
void Dragengine.Gui.SharedListModel.notifyContentChanged | ( | int | indexFrom, |
int | indexTo | ||
) |
Notify all that the content of the model in the given range changed.
indexFrom | Index of first element that changed |
indexTo | Index of last element that changed |
Implements Dragengine.Gui.ListModel.
void Dragengine.Gui.SharedListModel.removeListener | ( | ListModelListener | listener | ) |
Remove listener.
Implements Dragengine.Gui.ListModel.
void Dragengine.Gui.SharedListModel.setAutoSelect | ( | bool | autoSelect | ) |
Set to automatically select items.
If no item is selected and an item is added it is selected. If selected item is removed selects the next suitible item if the list is not empty.
If auto select is set to true while no item is selected the first item in the list is selected if the list is not empty.
void Dragengine.Gui.SharedListModel.setSelected | ( | int | index | ) |
Set index of selected element or -1 if none is no selected element.
Implements Dragengine.Gui.ListModel.
void Dragengine.Gui.SharedListModel.setSelectedElement | ( | Object | element | ) |
Set selected element.
Behaves the same as calling setSelected(indexOf(element)).
bool Dragengine.Gui.SharedListModel.pAutoSelect |
Array Dragengine.Gui.SharedListModel.pListeners |
ListModel Dragengine.Gui.SharedListModel.pModel |
int Dragengine.Gui.SharedListModel.pSelected |
Object Dragengine.Gui.SharedListModel.pSelectedObject |
SharedModelListener Dragengine.Gui.SharedListModel.pSharedModelListener |