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

VCF::ToolbarItem Class Reference

#include <vcf/ApplicationKit/Toolbar.h>

Inheritance diagram for VCF::ToolbarItem:

VCF::Item VCF::Button VCF::Component VCF::ObjectWithEvents VCF::Object List of all members.

Public Types

enum  {
  tbCaptionChanged = 200431, tbTooltipChanged, tbSelected, tbDimensionsChanged,
  tbAdded, tbRemoved, tbStateChanged, tbImageIndexChanged,
  tbStateImageIndexChanged, tbIndexChanged, tbItemControlAdded, tbItemClicked,
  tbItemUpdate, tbGroupChanged, tbCheckChanged
}
enum  ToolbarItemState {
  tisNone = 0, tisSeparator = 0x01, tisSelected = 0x10, tisPressed = 0x20,
  tisEnabled = 0x40, tisGrouped = 0x100, tisChecked = 0x200
}

Public Member Functions

 ToolbarItem ()
virtual void addButtonClickHandler (EventHandler *handler)
 Adds a new EventHandler for button click events.
virtual void removeButtonClickHandler (EventHandler *handler)
 Removes an EventHandler for button click events.
virtual void click ()
 This represents the user pressing the button, which then invokes whatever command is associated with the button.
virtual void setDefault (const bool &defaultButton)
 sets this button as the default button.
virtual bool isDefault ()
virtual bool containsPoint (Point *pt)
 This is called to determine if a given point is within the bounds of the item.
virtual RectgetBounds ()
 returns the Bounds for the Item or NULL if not applicable.
virtual void setBounds (Rect *bounds)
virtual int32 getStateImageIndex ()
 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 uint32 getIndex ()
 Returns the index of the item within it's model.
virtual int32 getImageIndex ()
virtual void setImageIndex (const int32 &imageIndex)
virtual void setIndex (const uint32 &index)
virtual void * getData ()
 Returns some application defined data.
virtual void setData (void *data)
 Sets the application defined data.
virtual void setState (const int32 &state)
 Sets the state for the item.
virtual bool canPaint ()
 indicates whether the item can paint itself.
virtual void paint (GraphicsContext *context, Rect *paintRect)
virtual bool isSelected ()
virtual void setSelected (const bool &selected)
void setWidth (const double &val)
String getCaption ()
void setCaption (const String &val)
String getTooltip ()
void setTooltip (const String &val)
void setAsSeparator ()
void setPressed (bool val)
void setItemControl (Control *control)
ControlgetItemControl ()
bool isEnabled ()
void setEnabled (const bool &val)
void internal_setBounds (const Rect &bounds)
 Utility method - not meant for public use.
void setGrouped (const bool &val)
bool isGrouped ()
void setChecked (const bool &val)
bool isChecked ()
virtual bool updateAction ()
 Calling this triggers an update event to be fired.
virtual void handleEvent (Event *event)
 generic handler method for events.

Public Attributes

VCF::Delegate ItemClicked
VCF::Delegate ItemUpdate

Protected Attributes

ControlitemControl_
void * data_
int32 imageIndex_
int32 imageStateIndex_
Rect bounds_
String caption_
String tooltip_

Member Enumeration Documentation

anonymous enum
 

Enumerator:
tbCaptionChanged 
tbTooltipChanged 
tbSelected 
tbDimensionsChanged 
tbAdded 
tbRemoved 
tbStateChanged 
tbImageIndexChanged 
tbStateImageIndexChanged 
tbIndexChanged 
tbItemControlAdded 
tbItemClicked 
tbItemUpdate 
tbGroupChanged 
tbCheckChanged 

enum VCF::ToolbarItem::ToolbarItemState
 

Enumerator:
tisNone 
tisSeparator 
tisSelected 
tisPressed 
tisEnabled 
tisGrouped 
tisChecked 


Constructor & Destructor Documentation

VCF::ToolbarItem::ToolbarItem  ) 
 


Member Function Documentation

virtual void VCF::ToolbarItem::addButtonClickHandler EventHandler handler  )  [inline, virtual]
 

Adds a new EventHandler for button click events.

Implements VCF::Button.

virtual bool VCF::ToolbarItem::canPaint  )  [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.

Implements VCF::Item.

virtual void VCF::ToolbarItem::click  )  [virtual]
 

This represents the user pressing the button, which then invokes whatever command is associated with the button.

It should be called in the implementing controls class whenever the control is "clicked" on (see Control::mouseClick() ), it can also be called programmatically as well.

Implements VCF::Button.

virtual bool VCF::ToolbarItem::containsPoint Point pt  )  [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.

Implements VCF::Item.

virtual Rect* VCF::ToolbarItem::getBounds  )  [inline, virtual]
 

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

Implements VCF::Item.

String VCF::ToolbarItem::getCaption  )  [inline]
 

virtual void* VCF::ToolbarItem::getData  )  [inline, virtual]
 

Returns some application defined data.

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

Implements VCF::Item.

virtual int32 VCF::ToolbarItem::getImageIndex  )  [inline, virtual]
 

Implements VCF::Item.

virtual uint32 VCF::ToolbarItem::getIndex  )  [virtual]
 

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

Implements VCF::Item.

Control* VCF::ToolbarItem::getItemControl  )  [inline]
 

virtual int32 VCF::ToolbarItem::getStateImageIndex  )  [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.

Implements VCF::Item.

String VCF::ToolbarItem::getTooltip  )  [inline]
 

virtual void VCF::ToolbarItem::handleEvent Event event  )  [virtual]
 

generic handler method for events.

All UI events are sent here and then dispatched accordingly to a more specific event handler. If an Application class is present, then it is given a chance to "see" the event first before delegating it to the Component.

All events are dispatched by their type so it is important to correctly identify the event objects type if you would like it to be dispatched correctly. The method will call the appropriate component method, like afterCreate(), beforeDestroy(), etc.

Parameters:
Event based on the value returned by Event::getType(),

Reimplemented from VCF::Component.

void VCF::ToolbarItem::internal_setBounds const Rect bounds  ) 
 

Utility method - not meant for public use.

bool VCF::ToolbarItem::isChecked  ) 
 

virtual bool VCF::ToolbarItem::isDefault  )  [inline, virtual]
 

Implements VCF::Button.

bool VCF::ToolbarItem::isEnabled  ) 
 

bool VCF::ToolbarItem::isGrouped  ) 
 

virtual bool VCF::ToolbarItem::isSelected  )  [virtual]
 

Implements VCF::Item.

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

Implements VCF::Item.

virtual void VCF::ToolbarItem::removeButtonClickHandler EventHandler handler  )  [inline, virtual]
 

Removes an EventHandler for button click events.

Implements VCF::Button.

void VCF::ToolbarItem::setAsSeparator  ) 
 

virtual void VCF::ToolbarItem::setBounds Rect bounds  )  [virtual]
 

Implements VCF::Item.

void VCF::ToolbarItem::setCaption const String val  ) 
 

void VCF::ToolbarItem::setChecked const bool &  val  ) 
 

virtual void VCF::ToolbarItem::setData void *  data  )  [inline, virtual]
 

Sets the application defined data.

Implements VCF::Item.

virtual void VCF::ToolbarItem::setDefault const bool &  defaultButton  )  [inline, virtual]
 

sets this button as the default button.

A default button will have it's click() event called whenever the enter key is hit.

Implements VCF::Button.

void VCF::ToolbarItem::setEnabled const bool &  val  ) 
 

void VCF::ToolbarItem::setGrouped const bool &  val  ) 
 

virtual void VCF::ToolbarItem::setImageIndex const int32 imageIndex  )  [virtual]
 

Implements VCF::Item.

virtual void VCF::ToolbarItem::setIndex const uint32 index  )  [virtual]
 

Implements VCF::Item.

void VCF::ToolbarItem::setItemControl Control control  ) 
 

void VCF::ToolbarItem::setPressed bool  val  ) 
 

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

Implements VCF::Item.

virtual void VCF::ToolbarItem::setState const int32 state  )  [virtual]
 

Sets the state for the item.

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

Reimplemented from VCF::Item.

virtual void VCF::ToolbarItem::setStateImageIndex const int32 index  )  [virtual]
 

Implements VCF::Item.

void VCF::ToolbarItem::setTooltip const String val  ) 
 

void VCF::ToolbarItem::setWidth const double &  val  ) 
 

virtual bool VCF::ToolbarItem::updateAction  )  [virtual]
 

Calling this triggers an update event to be fired.

The default behaviour is to see if the component has an action associated with it, and then calls the action's update() method.

Returns:
bool the method returns true if the component has an action and the action's update() method is called. Otherwise it returns false.
See also:
Action::update()

Reimplemented from VCF::Component.


Member Data Documentation

Rect VCF::ToolbarItem::bounds_ [protected]
 

String VCF::ToolbarItem::caption_ [protected]
 

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

int32 VCF::ToolbarItem::imageIndex_ [protected]
 

int32 VCF::ToolbarItem::imageStateIndex_ [protected]
 

VCF::Delegate VCF::ToolbarItem::ItemClicked
 

Control* VCF::ToolbarItem::itemControl_ [protected]
 

VCF::Delegate VCF::ToolbarItem::ItemUpdate
 

String VCF::ToolbarItem::tooltip_ [protected]
 


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