|
Drag[en]gine Script Module DragonScript 1.35
|
Default implementation of ListModel. More...
Public Member Functions | |
| void | add (Object element) |
| Add element. | |
| void | addAll (Array content) |
| Add elements from array. | |
| void | addListener (ListModelListener listener) |
| Add listener. | |
| Array | collect (Block ablock) |
| Return array with content for which block returns true. | |
| Object | find (Block ablock) |
| Find first object for which block returns true. | |
| Object | getAt (int index) |
| Element at index. | |
| bool | getAutoSelect () |
| Automatically select items. | |
| Array | getContent () |
| Get content as array. | |
| int | getCount () |
| Number of elements. | |
| int | getSelected () |
| Index of the selected element or -1 if there is no selected element. | |
| bool | has (Object element) |
| Element is present. | |
| void | insert (int index, Object element) |
| Insert element at index. | |
| void | insertAll (int index, Array content) |
| Insert elements from array at index. | |
| void | move (Object object, int index) |
| Move element to new location. | |
| void | moveIndex (int indexFrom, int indexTo) |
| Move element to new location. | |
| DefaultListModel | new () |
| Create default list model. | |
| DefaultListModel | new (Array content) |
| Create default list model with initial content. | |
| void | notifyContentChanged (int indexFrom, int indexTo) |
| Notify all that the content of the model in the given range changed. | |
| void | remove (Object element) |
| Remove element. | |
| void | removeArray (Array content) |
| Remove elements from array. | |
| void | removeFrom (int index) |
| Remove element. | |
| void | removeListener (ListModelListener listener) |
| Remove listener. | |
| void | removeRange (int firstIndex, int lastIndex) |
| Remove elements from range. | |
| void | setAll (Array elements) |
| Replaces all elements. | |
| void | setAt (int index, Object element) |
| Set element at index. | |
| void | setAutoSelect (bool autoSelect) |
| Set to automatically select items. | |
| void | setContent (Array content) |
| Set content from array. | |
| void | setRange (int firstIndex, int lastIndex, Array elements) |
| Replaces elements in range. | |
| void | setSelected (int index) |
| Set index of selected element or -1 if none is no selected element. | |
| void | setSelectedElement (Object element) |
| Set selected element. | |
| void | sort () |
| Sort elements using element compare() method. | |
| Public Member Functions inherited from Dragengine.Gui.ListModel | |
| int | indexOf (Object element) |
| Index of element or -1 if absent. | |
Default implementation of ListModel.
Added support to set Auto-Select mode. Default is enabled as before version 1.5 . If enabled adding and removing items ensures an item is selected if the list is not empty. If disabled the user is responsible to set the selection after adding or removing items. If disabled and the selected item is removed the selection will be cleared.
| void Dragengine.Gui.DefaultListModel.add | ( | Object | element | ) |
Add element.
After adding a content changed event is send to listeners. If you have to set many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.
References setRange().
Referenced by getAt(), and removeArray().
| void Dragengine.Gui.DefaultListModel.addAll | ( | Array | content | ) |
Add elements from array.
After adding a content changed event is send to listeners. If you have to add many elements addAll() instead of add() for performance reasons.
References getCount(), and new().
Referenced by getContent(), moveIndex(), notifyContentChanged(), and sort().
| void Dragengine.Gui.DefaultListModel.addListener | ( | ListModelListener | listener | ) |
| Array Dragengine.Gui.DefaultListModel.collect | ( | Block | ablock | ) |
Return array with content for which block returns true.
Block is called with argument Object and has to return bool. Returns Array of Object.
References insert().
Referenced by notifyContentChanged().
| Object Dragengine.Gui.DefaultListModel.find | ( | Block | ablock | ) |
Find first object for which block returns true.
Block is called with argument Object and has to return bool.
Referenced by notifyContentChanged().
| Object Dragengine.Gui.DefaultListModel.getAt | ( | int | index | ) |
Element at index.
| EOutOfBounds | index is less than 0 or larger than or equal to getCount(). |
Implements Dragengine.Gui.ListModel.
References add(), remove(), and removeListener().
Referenced by Dragengine.Gui.EditBindingsListModel.forEachEntry(), moveIndex(), notifyContentChanged(), Dragengine.Gui.EditBindingsListModel.notifyElementsAdded(), setAt(), setRange(), and Dragengine.Gui.EditBindingsListModel.updateBindings().
| bool Dragengine.Gui.DefaultListModel.getAutoSelect | ( | ) |
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.
References insertAll(), and setSelected().
Referenced by notifyContentChanged().
| Array Dragengine.Gui.DefaultListModel.getContent | ( | ) |
Get content as array.
References addAll(), and getCount().
| int Dragengine.Gui.DefaultListModel.getCount | ( | ) |
Number of elements.
Implements Dragengine.Gui.ListModel.
References addListener(), and new().
Referenced by addAll(), getContent(), move(), notifyContentChanged(), Dragengine.Gui.EditBindingsListModel.notifyContentChanged(), removeListener(), setAt(), setSelectedElement(), sort(), and Dragengine.Gui.EditBindingsListModel.updateBindings().
| int Dragengine.Gui.DefaultListModel.getSelected | ( | ) |
Index of the selected element or -1 if there is no selected element.
Implements Dragengine.Gui.ListModel.
References setSelected().
Referenced by notifyContentChanged().
| bool Dragengine.Gui.DefaultListModel.has | ( | Object | element | ) |
Element is present.
Implements Dragengine.Gui.ListModel.
Referenced by removeFrom(), and removeRange().
| void Dragengine.Gui.DefaultListModel.insert | ( | int | index, |
| Object | element ) |
Insert element at index.
After inserting a content changed event is send to listeners. If you have to insert many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.
| EOutOfBounds | index is less than 0 or larger than getCount(). |
References notifyContentChanged(), and setAt().
Referenced by collect().
| void Dragengine.Gui.DefaultListModel.insertAll | ( | int | index, |
| Array | content ) |
Insert elements from array at index.
After inserting a content changed event is send to listeners. If you have to insert many elements insertAll() instead of insert() for performance reasons.
| EOutOfBounds | index is less than 0 or larger than getCount(). |
Referenced by getAutoSelect(), and setSelected().
| void Dragengine.Gui.DefaultListModel.move | ( | Object | object, |
| int | index ) |
Move element to new location.
Same as calling remove(Object) and insert(int,Object) but sending only one change notification for the entire range of content between the two positions.
References getCount(), new(), and setAll().
Referenced by notifyContentChanged(), and setAutoSelect().
| void Dragengine.Gui.DefaultListModel.moveIndex | ( | int | indexFrom, |
| int | indexTo ) |
Move element to new location.
Same as calling remove(Object) and insert(int,Object) but sending only one change notification for the entire range of content between the two positions.
References addAll(), getAt(), and notifyContentChanged().
Referenced by notifyContentChanged(), and setAutoSelect().
| DefaultListModel Dragengine.Gui.DefaultListModel.new | ( | ) |
Create default list model.
References new().
Referenced by addAll(), addListener(), getCount(), move(), new(), and notifyContentChanged().
| DefaultListModel Dragengine.Gui.DefaultListModel.new | ( | Array | content | ) |
Create default list model with initial content.
| void Dragengine.Gui.DefaultListModel.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.
Reimplemented in Dragengine.Gui.EditBindingsListModel.
References addAll(), collect(), find(), getAt(), getAutoSelect(), getCount(), getSelected(), Dragengine.Gui.ListModel.indexOf(), move(), moveIndex(), new(), notifyContentChanged(), setAutoSelect(), setSelected(), setSelectedElement(), and sort().
Referenced by insert(), moveIndex(), notifyContentChanged(), and setAll().
| void Dragengine.Gui.DefaultListModel.remove | ( | Object | element | ) |
Remove element.
After removing a content changed event is send to listeners. If you have to remove many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.
| EOutOfBounds | Element is absent. |
Referenced by getAt().
| void Dragengine.Gui.DefaultListModel.removeArray | ( | Array | content | ) |
Remove elements from array.
After removing a content changed event is send to listeners.
| EOutOfBounds | Element is absent. |
References add().
| void Dragengine.Gui.DefaultListModel.removeFrom | ( | int | index | ) |
Remove element.
After removing a content changed event is send to listeners. If you have to remove many elements at once performance problems can arise due to each change causing widgets to relayout. If this is the case use one of the mass editing methods.
| EOutOfBounds | index is less than 0 or larger than or equal getCount(). |
References has(), and Dragengine.Gui.ListModel.indexOf().
| void Dragengine.Gui.DefaultListModel.removeListener | ( | ListModelListener | listener | ) |
| void Dragengine.Gui.DefaultListModel.removeRange | ( | int | firstIndex, |
| int | lastIndex ) |
Remove elements from range.
After removing a content changed event is send to listeners.
| EOutOfBounds | firstIndex is less than 0 or larger than or equal getCount(). |
| EOutOfBounds | lastIndex is less than 0 or larger than or equal getCount(). |
| EInvalidParam | lastIndex is less than firstIndex. |
References has().
| void Dragengine.Gui.DefaultListModel.setAll | ( | Array | elements | ) |
Replaces all elements.
If range is not empty a content changed event is send to listeners. Use this method if you need to change all elements at once to cause only one change notification resulting in widgets to relayout once instead of multiple times.
| EInvalidParam | Number of elements in elements does not equal number of elements in the model. |
References notifyContentChanged().
Referenced by move().
| void Dragengine.Gui.DefaultListModel.setAt | ( | int | index, |
| Object | element ) |
Set element at index.
If element at index changed a content changed event is send to listeners. Changing many elements at once can cause performance problems due to each change causing widgets to relayout. If this is a problem use one of the mass editing methods.
| EOutOfBounds | index is less than 0 or larger than or equal to getCount(). |
References getAt(), and getCount().
Referenced by insert(), and setRange().
| void Dragengine.Gui.DefaultListModel.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.
References move(), and moveIndex().
Referenced by notifyContentChanged().
| void Dragengine.Gui.DefaultListModel.setContent | ( | Array | content | ) |
Set content from array.
If count of elements in content is equal to getCount() operates like setAll() sending a single content changed notification unless both counts are 0. If the counts are different replaces the content as if removeAll() and addAll() is called. If elements are present sends first an elements removed notification. Then if content contains any elements an elements added notification is send.
If you just want to replace all elements without changing the number of elements use setAll().
| void Dragengine.Gui.DefaultListModel.setRange | ( | int | firstIndex, |
| int | lastIndex, | ||
| Array | elements ) |
Replaces elements in range.
If range is not empty a content changed event is send to listeners. Use this method if you need to change multiple elements at once to cause only one change notification resulting in widgets to relayout once instead of multiple times.
| EOutOfBounds | firstIndex is less than 0 or larger than or equal getCount(). |
| EOutOfBounds | lastIndex is less than 0 or larger than or equal getCount(). |
| EInvalidParam | lastIndex is less than firstIndex. |
| EInvalidParam | Number of elements in elements does not equal number of elements in range. |
References getAt(), and setAt().
Referenced by add().
| void Dragengine.Gui.DefaultListModel.setSelected | ( | int | index | ) |
Set index of selected element or -1 if none is no selected element.
Implements Dragengine.Gui.ListModel.
References insertAll().
Referenced by getAutoSelect(), getSelected(), and notifyContentChanged().
| void Dragengine.Gui.DefaultListModel.setSelectedElement | ( | Object | element | ) |
Set selected element.
Behaves the same as calling setSelected(indexOf(element)).
References getCount().
Referenced by notifyContentChanged().
| void Dragengine.Gui.DefaultListModel.sort | ( | ) |
Sort elements using element compare() method.
References addAll(), and getCount().
Referenced by notifyContentChanged().