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::UIComponent VCF::Component VCF::ObjectWithCallbacks VCF::Object VCF::ColumnItem VCF::ListItem VCF::MenuItem VCF::TableCellItem VCF::TabPage VCF::ToolbarItem VCF::TreeItem VCF::DefaultMenuItem VCF::DefaultTableCellItem VCF::DefaultTabPage VCF::SeparatorMenuItem List of all members.

Public Member Functions

 Item ()
virtual ~Item ()
virtual bool containsPoint (Point *pt) const
 This is called to determine if a given point is within the bounds of the item.
virtual Rect getBounds ()
 returns the Bounds for the Item or NULL if not applicable.
virtual void setBounds (const Rect &bounds)
virtual int32 getStateImageIndex () const
 This image index represents the state of an particular item separate from whether or not it is selected.
virtual void setStateImageIndex (const int32 &index)
virtual int32 getImageIndex () const
virtual void setImageIndex (const int32 &imageIndex)
void * getData () const
 Returns some application defined data.
void setData (void *data)
 Sets the application defined data.
virtual bool canPaint () const
 indicates whether the item can paint itself.
virtual void paint (GraphicsContext *context, Rect *paintRect)
bool isSelected () const
virtual void setSelected (const bool &selected)
uint32 getDisplayState () const
 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 setDisplayState (const uint32 &state)
 Sets the state for the item.
void setChecked (const bool &val)
bool isChecked () const
bool isUnchecked () const
void setRadioPressed (const bool &val)
bool isRadioPressed () const
bool isRadioUnpressed () const
ModelgetModel () const
 Returns the model that this item belongs to.
virtual void setModel (Model *model)
 Sets the model that this item is a part of.
ControlgetControl () const
 All items may have a control that "owns" them.
virtual void setControl (Control *control)
 Sets the owning control for this item.
FontgetFont ()
bool isFontDefault ()
 Indicates that the default font for this item should be used.
void setFont (Font *val)
VariantData getKeyValue () const
void setKeyValue (const VariantData &val)

Protected Member Functions

void stateChanged ()

Protected Attributes

void * data_
Rect bounds_
bool selected_
int32 imageIndex_
Fontfont_
uint32 displayState_
Modelmodel_
ControlowningControl_
VariantDatakeyVal_

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's possible that in order to calculate the item's index the 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.


Constructor & Destructor Documentation

VCF::Item::Item  )  [inline]
 

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


Member Function Documentation

virtual bool VCF::Item::canPaint  )  const [inline, 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.

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

virtual bool VCF::Item::containsPoint Point pt  )  const [inline, 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.

virtual Rect VCF::Item::getBounds  )  [inline, virtual]
 

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

Control* VCF::Item::getControl  )  const [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.

void* VCF::Item::getData  )  const [inline]
 

Returns some application defined data.

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

uint32 VCF::Item::getDisplayState  )  const [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.

Font * VCF::Item::getFont  )  [inline]
 

virtual int32 VCF::Item::getImageIndex  )  const [inline, virtual]
 

VariantData VCF::Item::getKeyValue  )  const [inline]
 

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

Returns the model that this item belongs to.

virtual int32 VCF::Item::getStateImageIndex  )  const [inline, 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.

Reimplemented in VCF::TreeItem.

bool VCF::Item::isChecked  )  const [inline]
 

Reimplemented in VCF::DefaultMenuItem, and VCF::MenuItem.

bool VCF::Item::isFontDefault  )  [inline]
 

Indicates that the default font for this item should be used.

It's also an indicator that the font is NULL and no attempts at modifications have been attempted.

bool VCF::Item::isRadioPressed  )  const [inline]
 

bool VCF::Item::isRadioUnpressed  )  const [inline]
 

bool VCF::Item::isSelected  )  const [inline]
 

Reimplemented in VCF::DefaultMenuItem.

bool VCF::Item::isUnchecked  )  const [inline]
 

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

Reimplemented in VCF::ColumnItem, VCF::DefaultMenuItem, VCF::DefaultTableCellItem, VCF::DefaultTabPage, and VCF::ToolbarItem.

virtual void VCF::Item::setBounds const Rect bounds  )  [inline, virtual]
 

void VCF::Item::setChecked const bool &  val  )  [inline]
 

Reimplemented in VCF::DefaultMenuItem, VCF::MenuItem, 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.

void VCF::Item::setData void *  data  )  [inline]
 

Sets the application defined data.

virtual void VCF::Item::setDisplayState const uint32 state  )  [inline, virtual]
 

Sets the state for the item.

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

void VCF::Item::setFont Font val  )  [inline]
 

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

Reimplemented in VCF::DefaultMenuItem, and VCF::ToolbarItem.

void VCF::Item::setKeyValue const VariantData val  )  [inline]
 

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.

void VCF::Item::setRadioPressed const bool &  val  )  [inline]
 

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

Reimplemented in VCF::DefaultMenuItem, VCF::ToolbarItem, and VCF::TreeItem.

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

Reimplemented in VCF::ToolbarItem, and VCF::TreeItem.

void VCF::Item::stateChanged  )  [inline, protected]
 


Member Data Documentation

Rect VCF::Item::bounds_ [protected]
 

void* VCF::Item::data_ [protected]
 

uint32 VCF::Item::displayState_ [protected]
 

Font* VCF::Item::font_ [protected]
 

int32 VCF::Item::imageIndex_ [protected]
 

VariantData* VCF::Item::keyVal_ [protected]
 

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

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

bool VCF::Item::selected_ [protected]
 


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