| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Package components :: Module ListItem :: Class ListItem |
|
object --+
|
ListItem
TextListItem
ListItem () -> ListItem
Creates a new ListItem suitable for the usage in list or tree widgets.
The ListItem class is an abstract class for list implementations.
It is not able to react upon events nor has the flexibility and
capabilities a widget inheriting from the BaseWidget class has, but
provides a minimalistic set of methods to make it suitable for lists
of nearly any type.
ListItems support a 'style' attribute and get_style() method, which
enable them to use different look than default one. The 'style'
attribute of a ListItem usually defaults to a None value and can be
set using the get_style() method. This causes the ListItem internals
to setup the specific style for it and can be accessed through the
'style' attribute later on. A detailled documentation of the style
can be found in the Style class.
if not listitem.style:
listitem.get_style () # Setup the style internals first.
listitem.style['font']['size'] = 18
listitem.get_style ()['font']['name'] = Arial
The ListItem supports a selection state using the 'selected'
attribute. This indicates, whether the ListItem was selected or not.
listitem.selected = False
listitem.selected = True
ListItems can be set in a dirty state, which indicates, that they
need to be updated. The 'dirty' attribute and set_dirty() method
take care of this and automatically invoke the bound has_changed()
method of the ListItem. In user code, 'dirty' usually does not need
to be modified manually.
listitem.dirty = True
listitem.set_dirty (True)
The ListItem can be bound to or unbounds from a ListItemCollection
using the 'collection' attribute or set_collection() method. This
usually invokes the append() or remove() method of the collection,
so that it can invoke its list_changed() method.
listitem.collection = my_collection
listitem.set_collection (None)
Attributes:
style - The style to use for drawing the ListItem.
selected - Indicates, whether the ListItem is currently selected.
collection - The ListItemCollection, the ListItem is attached to.
dirty - Indicates, that the ListItem needs to be updated.
| Method Summary | |
|---|---|
__init__(self)
| |
L.get_style () -> Style | |
L.has_changed () -> None | |
L.set_collection (...) -> None | |
L.set_dirty (...) -> None | |
L._select (...) -> None | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
collection: The collection the ListItem is attached to. | |
dirty: Indicates, whether the ListItem needs to be redrawn. | |
selected: The selection state of the ListItem. | |
style: The style of the ListItem. | |
| Method Details |
|---|
get_style(self)L.get_style () -> Style Gets the style for the ListItem. Gets the style associated with the ListItem. If the ListItem had no style before, a new one will be created for it. More information about how a style looks like can be found in the Style class documentation. |
has_changed(self)L.has_changed () -> None Called, when the item has been changed and needs to be refreshed. This method will invoke the item_changed() notifier slot of the attached collection. |
set_collection(self, collection)L.set_collection (...) -> None Sets the collection the ListItem is attached to. Sets the 'collection' attribute of the ListItem to the passed argument and appends it to the collection if not already done. Raises an Exception, if the argument is already attached to a collection. |
set_dirty(self, dirty)L.set_dirty (...) -> None Marks the ListItem as dirty. Marks the ListItem as dirty. |
_select(self, selected=True)L._select (...) -> None Internal select handler, which causes the parent to update. |
| Property Details |
|---|
collectionThe collection the ListItem is attached to.
|
dirtyIndicates, whether the ListItem needs to be redrawn.
|
selectedThe selection state of the ListItem.
|
styleThe style of the ListItem.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:45 2008 | http://epydoc.sf.net |