Package ocempgui :: Package widgets :: Package components :: Module ListItem :: Class ListItem
[show private | hide private]
[frames | no frames]

Type ListItem

object --+
         |
        ListItem

Known Subclasses:
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)
  get_style(self)
L.get_style () -> Style
  has_changed(self)
L.has_changed () -> None
  set_collection(self, collection)
L.set_collection (...) -> None
  set_dirty(self, dirty)
L.set_dirty (...) -> None
  _select(self, selected)
L._select (...) -> None
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
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

collection

The collection the ListItem is attached to.
Get Method:
unknown-696517884(...)
Set Method:
unknown-696517940(...)

dirty

Indicates, whether the ListItem needs to be redrawn.
Get Method:
unknown-696518164(...)
Set Method:
unknown-696518220(...)

selected

The selection state of the ListItem.
Get Method:
unknown-696517996(...)
Set Method:
unknown-696518052(...)

style

The style of the ListItem.
Get Method:
unknown-696518108(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:45 2008 http://epydoc.sf.net