Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Item Class Reference

The Item class can be used represent a single element in a model. More...

#include <vcf/ApplicationKit/Item.h>

Inheritance diagram for VCF::Item:

VCF::Component VCF::ObjectWithEvents VCF::Object VCF::ColumnItem VCF::ListItem VCF::MenuItem VCF::TableCellItem VCF::TabPage VCF::ToolbarItem VCF::TreeItem VCF::DefaultColumnItem VCF::DefaultListItem VCF::DefaultMenuItem VCF::DefaultTableCellItem VCF::DefaultTabPage VCF::DefaultTreeItem VCF::SeparatorMenuItem List of all members.

Public Types

enum  ItemDisplayState {
  idsNone = 0x0000, idsChecked = 0x0005, idsUnChecked = 0x0006, idsRadioUnpressed = 0x0007,
  idsRadioPressed = 0x0008, idsCanPaint = 0x0010
}
 these are a general set of enumeration masks that can be used to describe the items state above and beyond whether the item is selected More...

Public Member Functions

 Item ()
virtual ~Item ()
void addItemPaintHandler (EventHandler *handler)
void addItemChangedHandler (EventHandler *handler)
void addItemSelectedHandler (EventHandler *handler)
void addItemAddedHandler (EventHandler *handler)
void addItemDeletedHandler (EventHandler *handler)
void removeItemPaintHandler (EventHandler *handler)
void removeItemChangedHandler (EventHandler *handler)
void removeItemSelectedHandler (EventHandler *handler)
void removeItemAddedHandler (EventHandler *handler)
void removeItemDeletedHandler (EventHandler *handler)
virtual bool containsPoint (Point *pt)=0
 This is called to determine if a given point is within the bounds of the item.
virtual RectgetBounds ()=0
 returns the Bounds for the Item or NULL if not applicable.
virtual void setBounds (Rect *bounds)=0
virtual int32 getStateImageIndex ()=0
 This image index represents the state of an particular item separate from whether or not it is selected.
virtual void setStateImageIndex (const int32 &index)=0
virtual uint32 getIndex ()=0
 Returns the index of the item within it's model.
virtual int32 getImageIndex ()=0
virtual void setImageIndex (const int32 &imageIndex)=0
virtual void setIndex (const uint32 &index)=0
virtual void * getData ()=0
 Returns some application defined data.
virtual void setData (void *data)=0
 Sets the application defined data.
virtual bool canPaint ()=0
 indicates whether the item can paint itself.
virtual void paint (GraphicsContext *context, Rect *paintRect)=0
virtual bool isSelected ()=0
virtual void setSelected (const bool &selected)=0
int32 getState ()
 Represents the current state of the item that is entirely item specific as well as specific to the control that is hosting the item(s).
virtual void setState (const int32 &state)
 Sets the state for the item.
ModelgetModel ()
 Returns the model that this item belongs to.
virtual void setModel (Model *model)
 Sets the model that this item is a part of.
ControlgetControl ()
 All items may have a control that "owns" them.
virtual void setControl (Control *control)
 Sets the owning control for this item.

Public Attributes

VCF::Delegate ItemPaint
VCF::Delegate ItemChanged
VCF::Delegate ItemSelected
VCF::Delegate ItemAdded
VCF::Delegate ItemDeleted

Protected Attributes

int32 itemState_
Modelmodel_
ControlowningControl_

Detailed Description

The Item class can be used represent a single element in a model.

It's useful because as a component it gets all the automatic persistance abilities of a component and the ability to easily edit it at design time through a visual form editor (like the VCF Builder).

The Item class has a number of virtual methods that must be implemented, but the exact methods of implementation may vary widely. For example it possible that in order to calculate the item's index hte item may simply carry around a member variable that stores the index. An alternate approach would be to query the model the item is attached to and ask the model for the item's index position.


Member Enumeration Documentation

enum VCF::Item::ItemDisplayState
 

these are a general set of enumeration masks that can be used to describe the items state above and beyond whether the item is selected

Enumerator:
idsNone 
idsChecked 
idsUnChecked 
idsRadioUnpressed 
idsRadioPressed 
idsCanPaint 


Constructor & Destructor Documentation

VCF::Item::Item  )  [inline]
 

virtual VCF::Item::~Item  )  [inline, virtual]
 


Member Function Documentation

void VCF::Item::addItemAddedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::addItemChangedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::addItemDeletedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::addItemPaintHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::addItemSelectedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

virtual bool VCF::Item::canPaint  )  [pure virtual]
 

indicates whether the item can paint itself.

In general this is often false, but when true, the control that contains the item should call the item's paint() method whenever the item needs repainting.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual bool VCF::Item::containsPoint Point pt  )  [pure virtual]
 

This is called to determine if a given point is within the bounds of the item.

The bounds may be slightly different than what is returned by getBounds(). For example, an item may not support getBounds(), but may have a non-rectangular region and may implement containsPoint() accordingly.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual Rect* VCF::Item::getBounds  )  [pure virtual]
 

returns the Bounds for the Item or NULL if not applicable.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

Control* VCF::Item::getControl  )  [inline]
 

All items may have a control that "owns" them.

so in a ListControl, the ListItem::getControl() would return the ListControl the items were part of. The control for item must match with the view control of the item's model.

Reimplemented in VCF::DefaultTabPage.

virtual void* VCF::Item::getData  )  [pure virtual]
 

Returns some application defined data.

This can be anything you want, hence the void* storage.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual int32 VCF::Item::getImageIndex  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual uint32 VCF::Item::getIndex  )  [pure virtual]
 

Returns the index of the item within it's model.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

Model* VCF::Item::getModel  )  [inline]
 

Returns the model that this item belongs to.

int32 VCF::Item::getState  )  [inline]
 

Represents the current state of the item that is entirely item specific as well as specific to the control that is hosting the item(s).

Some controls will completely ignore this value.

virtual int32 VCF::Item::getStateImageIndex  )  [pure virtual]
 

This image index represents the state of an particular item separate from whether or not it is selected.

Typically it is offset horizontally from the regular image that getImageIndex() represents. This image is frequently used to represent check marks for things like tree or list controls.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual bool VCF::Item::isSelected  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, VCF::TableCellItem, and VCF::ToolbarItem.

virtual void VCF::Item::paint GraphicsContext context,
Rect paintRect
[pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

void VCF::Item::removeItemAddedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::removeItemChangedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::removeItemDeletedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::removeItemPaintHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

void VCF::Item::removeItemSelectedHandler EventHandler handler  )  [inline]
 

Deprecated:
  • these are here for backwards compatibility purposes only - they'll be going away in the next release.

virtual void VCF::Item::setBounds Rect bounds  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual void VCF::Item::setControl Control control  )  [inline, virtual]
 

Sets the owning control for this item.

It's made virtual so that subclasses can override the behaviour if they need to.

Reimplemented in VCF::DefaultTabPage, and VCF::DefaultTreeItem.

virtual void VCF::Item::setData void *  data  )  [pure virtual]
 

Sets the application defined data.

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual void VCF::Item::setImageIndex const int32 imageIndex  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual void VCF::Item::setIndex const uint32 index  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.

virtual void VCF::Item::setModel Model model  )  [inline, virtual]
 

Sets the model that this item is a part of.

Subclasses may need or want to customize this.

Reimplemented in VCF::DefaultTableCellItem, and VCF::DefaultTreeItem.

virtual void VCF::Item::setSelected const bool &  selected  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, VCF::TableCellItem, and VCF::ToolbarItem.

virtual void VCF::Item::setState const int32 state  )  [inline, virtual]
 

Sets the state for the item.

This is made virtual to allow subclasses to customize the behaviour.

Reimplemented in VCF::ToolbarItem.

virtual void VCF::Item::setStateImageIndex const int32 index  )  [pure virtual]
 

Implemented in VCF::DefaultColumnItem, VCF::DefaultListItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, VCF::DefaultTreeItem, and VCF::ToolbarItem.


Member Data Documentation

VCF::Delegate VCF::Item::ItemAdded
 

VCF::Delegate VCF::Item::ItemChanged
 

VCF::Delegate VCF::Item::ItemDeleted
 

VCF::Delegate VCF::Item::ItemPaint
 

VCF::Delegate VCF::Item::ItemSelected
 

int32 VCF::Item::itemState_ [protected]
 

Model* VCF::Item::model_ [protected]
 

Control* VCF::Item::owningControl_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information