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

VCF::ListBoxControl Class Reference

#include <vcf/ApplicationKit/ListBoxControl.h>

Inheritance diagram for VCF::ListBoxControl:

VCF::ListControl VCF::Control VCF::ListController VCF::UIComponent VCF::AbstractView VCF::Component VCF::View VCF::ObjectWithCallbacks VCF::Object List of all members.

Public Types

enum  ListBoxControlEvents { lbeItemStateChangeRequested = CUSTOM_EVENT_TYPES + ITEM_CONST + 100 }

Public Member Functions

 ListBoxControl ()
 ListBoxControl (ListModel *listModel)
virtual ~ListBoxControl ()
void setSelectedItem (ListItem *item)
virtual void setLargeImageList (ImageList *imageList)
virtual void setSmallImageList (ImageList *imageList)
virtual void setStateImageList (ImageList *imageList)
virtual Rect getItemImageRect (const uint32 &index)
virtual void selectItem (const uint32 &index)
virtual Enumerator< uint32 > * getSelectedItemsByIndex ()
Enumerator< ListItem * > * getSelectedItems ()
virtual void rangeSelect (const Rect &selectionRect)
virtual uint32 getFocusedItem ()
virtual uint32 getSelectedItem ()
virtual bool allowsMultiSelect ()
virtual void setAllowsMultiSelect (const bool &allowsMultiSelect)
virtual uint32 hitTest (const Point &point)
virtual Rect getItemRect (ListItem *item)
virtual void rangeSelect (const bool &isSelected, ListItem *first, ListItem *last)
virtual void paint (GraphicsContext *ctx)
 Paints the control.
virtual void mouseDown (MouseEvent *event)
 Called when one (or more) of the mouse buttons are held down.
virtual void mouseMove (MouseEvent *event)
 Called when the mouse moves over the control.
virtual void mouseUp (MouseEvent *event)
 Called when one (or more) of the mouse buttons are released.
virtual void mouseClick (MouseEvent *event)
 Called when one or mouse buttons are held down and immediately released ( a "mouse click" ).
virtual void mouseDblClick (MouseEvent *event)
 Called when one or mouse buttons are held down and immediately released ( a "mouse double click" ) twice, within some specific time period, as determined on the windowing system.
virtual void keyDown (KeyboardEvent *event)
 called when the user presses the key down
virtual void keyUp (KeyboardEvent *event)
 called when the user releases the key
virtual void keyPressed (KeyboardEvent *event)
 called when the user simply presses the key and represents a full key cycle having occurred, in other words the key has been pressed down and then released
double getDefaultItemHeight ()
void setDefaultItemHeight (const double &defaultItemHeight)
bool getAllowsExtendedSelect ()
void setAllowsExtendedSelect (const bool &allowsExtendedSelect)
 Enables/disables the ability to have extended selection functionality, by handling Ctrl + mouseDown and Shift + mouseDown.
void setLeftGutter (const double &leftgutter)
 Sets the spacing between the innermost-edge of the left border and the beginning of the Item captions when scrolled all the way to the left.
double getLeftGutter ()
void setRightGutter (const double &rightgutter)
 Sets the spacing between the innermost-edge of the right border and the end of the longest Item caption when scrolled all the way to the right.
double getRightGutter ()
void setTextBounded (const bool &istextbounded)
void deselectAllItems ()
void eraseFromSelectedItems (ListItem *item)
virtual void setScrollable (Scrollable *scrollable)
 sets the scrollable for the listbox control, and sets it for a discrete scrolling, item by item.
bool stateHitTest (Point *point, ListItem *item)
void setUseColorForBackground (const bool &val)
 sets if we want to use the control's color to draw the control's background; otherwise the theme background is drawn.
bool getUseColorForBackground ()
 gets if we use the control's color to draw the control's background
virtual void handleEvent (Event *event)
 This gets called by the ControlPeer for any windowing system mouse events, as well as for any windowing system keyboard events and for any windowing system events like size changes, position changes, etc.

Public Attributes

VCF::Delegate ItemDelegate
 ItemStateChangeRequested

Protected Member Functions

virtual void destroy ()
 called by the free() method.
void paintSelectionRect (GraphicsContext *ctx, Rect *rect, ListItem *item)
ListItemfindSingleSelectedItem (Point *pt)
void selectionChanged (ListItem *item)
void paintItem (GraphicsContext *ctx, Rect &itemRect, double currentTop, Color *selectedTextColor, const Rect &bounds, double scrollWidth, double offsetX, ListItem *item)
void paintItemState (GraphicsContext *ctx, Rect &itemRect, ListItem *item)
void paintItemImage (GraphicsContext *ctx, Rect &itemRect, ListItem *item)
Rect getStateRect (ListItem *item)
void recalcBoundsForItem (ListItem *item)
void removeItem (ListItem *item, const uint32 &itemIndex)
virtual void onItemAdded (ListModelEvent *event)
virtual void onItemDeleted (ListModelEvent *event)

Protected Attributes

double defaultItemHeight_
double currentMaxWidth_
double currentMaxHeight_
double leftGutter_
double rightGutter_
bool textBounded_
bool allowsMultiSelect_
bool allowsExtendedSelect_
Array< ListItem * > selectedItems_
Array< uint32selectedIndices_
double stateItemIndent_
bool useColorForBackground_

Member Enumeration Documentation

enum VCF::ListBoxControl::ListBoxControlEvents
 

Enumerator:
lbeItemStateChangeRequested 


Constructor & Destructor Documentation

VCF::ListBoxControl::ListBoxControl  ) 
 

VCF::ListBoxControl::ListBoxControl ListModel listModel  ) 
 

virtual VCF::ListBoxControl::~ListBoxControl  )  [virtual]
 


Member Function Documentation

virtual bool VCF::ListBoxControl::allowsMultiSelect  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::deselectAllItems  ) 
 

virtual void VCF::ListBoxControl::destroy  )  [protected, virtual]
 

called by the free() method.

Should be overriden and any clean up code performed here

Reimplemented from VCF::Control.

void VCF::ListBoxControl::eraseFromSelectedItems ListItem item  ) 
 

ListItem* VCF::ListBoxControl::findSingleSelectedItem Point pt  )  [protected]
 

bool VCF::ListBoxControl::getAllowsExtendedSelect  )  [inline]
 

double VCF::ListBoxControl::getDefaultItemHeight  )  [inline]
 

virtual uint32 VCF::ListBoxControl::getFocusedItem  )  [virtual]
 

Reimplemented from VCF::ListControl.

virtual Rect VCF::ListBoxControl::getItemImageRect const uint32 index  )  [virtual]
 

Reimplemented from VCF::ListControl.

virtual Rect VCF::ListBoxControl::getItemRect ListItem item  )  [virtual]
 

Reimplemented from VCF::ListControl.

double VCF::ListBoxControl::getLeftGutter  )  [inline]
 

double VCF::ListBoxControl::getRightGutter  )  [inline]
 

virtual uint32 VCF::ListBoxControl::getSelectedItem  )  [virtual]
 

Reimplemented from VCF::ListControl.

Enumerator<ListItem*>* VCF::ListBoxControl::getSelectedItems  ) 
 

virtual Enumerator<uint32>* VCF::ListBoxControl::getSelectedItemsByIndex  )  [virtual]
 

Reimplemented from VCF::ListControl.

Rect VCF::ListBoxControl::getStateRect ListItem item  )  [protected]
 

bool VCF::ListBoxControl::getUseColorForBackground  )  [inline]
 

gets if we use the control's color to draw the control's background

Returns:
bool, true if we use the control's color, false if it uses the theme background.

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

This gets called by the ControlPeer for any windowing system mouse events, as well as for any windowing system keyboard events and for any windowing system events like size changes, position changes, etc.

Once inside the event the Control determines the type, and behaves accordingly, as well as notifying any appropriate listeners.

Reimplemented from VCF::ListControl.

virtual uint32 VCF::ListBoxControl::hitTest const Point point  )  [virtual]
 

Reimplemented from VCF::ListControl.

virtual void VCF::ListBoxControl::keyDown KeyboardEvent event  )  [virtual]
 

called when the user presses the key down

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::keyPressed KeyboardEvent event  )  [virtual]
 

called when the user simply presses the key and represents a full key cycle having occurred, in other words the key has been pressed down and then released

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::keyUp KeyboardEvent event  )  [virtual]
 

called when the user releases the key

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::mouseClick MouseEvent event  )  [virtual]
 

Called when one or mouse buttons are held down and immediately released ( a "mouse click" ).

override this to provide specific behaviours when a mouse click occurs

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::mouseDblClick MouseEvent event  )  [virtual]
 

Called when one or mouse buttons are held down and immediately released ( a "mouse double click" ) twice, within some specific time period, as determined on the windowing system.

override this to provide specific behaviours when a mouse double click occurs

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::mouseDown MouseEvent event  )  [virtual]
 

Called when one (or more) of the mouse buttons are held down.

override this to provide specific behaviours when the mouse buttons are held down

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::mouseMove MouseEvent event  )  [virtual]
 

Called when the mouse moves over the control.

override this to provide specific behaviours when the mouse moves over the control.

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::mouseUp MouseEvent event  )  [virtual]
 

Called when one (or more) of the mouse buttons are released.

override this to provide specific behaviours when the mouse buttons are released.

Reimplemented from VCF::Control.

virtual void VCF::ListBoxControl::onItemAdded ListModelEvent event  )  [protected, virtual]
 

Reimplemented from VCF::ListControl.

virtual void VCF::ListBoxControl::onItemDeleted ListModelEvent event  )  [protected, virtual]
 

Reimplemented from VCF::ListControl.

virtual void VCF::ListBoxControl::paint GraphicsContext ctx  )  [virtual]
 

Paints the control.

Called by the underlying windowing system whenever the control needs to be painted. Note that in some cases the GraphicsContext passed in to this method may not be the same pointer as the GraphicsContext that the control holds itself. During the paint() method you should only use the context value for all your drawing and not the one returned in getContext(). The value returned by getContext() should be used for drawing that takes place outside of the paint() method.

If the control allows paint notification, then the framework will fire an event to the BeforeControlPainted delegate prior to calling the control's paint() method. After the paint() method has returned, if the control allows paint notification, the framework will fire an event to the AfterControlPainted delegate. This allows outside observers to take part in the paint cycle, but beware that this does come at a bit of a cost, so use this feature sparingly.

Note: This should NEVER be called by programmers using the VCF, it will be called for you during the course of your applications native event loop, and is only here for providing custom drawing routines for controls. In other words: you implement it, you never call it yourself.

See also:
getAllowPaintNotification

Implements VCF::Control.

void VCF::ListBoxControl::paintItem GraphicsContext ctx,
Rect itemRect,
double  currentTop,
Color selectedTextColor,
const Rect bounds,
double  scrollWidth,
double  offsetX,
ListItem item
[protected]
 

void VCF::ListBoxControl::paintItemImage GraphicsContext ctx,
Rect itemRect,
ListItem item
[protected]
 

void VCF::ListBoxControl::paintItemState GraphicsContext ctx,
Rect itemRect,
ListItem item
[protected]
 

void VCF::ListBoxControl::paintSelectionRect GraphicsContext ctx,
Rect rect,
ListItem item
[protected]
 

virtual void VCF::ListBoxControl::rangeSelect const bool &  isSelected,
ListItem first,
ListItem last
[virtual]
 

virtual void VCF::ListBoxControl::rangeSelect const Rect selectionRect  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::recalcBoundsForItem ListItem item  )  [protected]
 

void VCF::ListBoxControl::removeItem ListItem item,
const uint32 itemIndex
[protected]
 

void VCF::ListBoxControl::selectionChanged ListItem item  )  [protected]
 

virtual void VCF::ListBoxControl::selectItem const uint32 index  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::setAllowsExtendedSelect const bool &  allowsExtendedSelect  ) 
 

Enables/disables the ability to have extended selection functionality, by handling Ctrl + mouseDown and Shift + mouseDown.

Item pointers are automatically added and removed from the selectedItems_ container as they are selected and deselected, respectively.

If you set allowsExtendedSelect to true, allowsMultiSelect_ is automatically set to true for you. Therefore, don't forget to set allowsMultiSelect to false if you want to switch from extended selection behaviour to single selection behavior.

virtual void VCF::ListBoxControl::setAllowsMultiSelect const bool &  allowsMultiSelect  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::setDefaultItemHeight const double &  defaultItemHeight  ) 
 

virtual void VCF::ListBoxControl::setLargeImageList ImageList imageList  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::setLeftGutter const double &  leftgutter  ) 
 

Sets the spacing between the innermost-edge of the left border and the beginning of the Item captions when scrolled all the way to the left.

Default value is currently 2.0

void VCF::ListBoxControl::setRightGutter const double &  rightgutter  ) 
 

Sets the spacing between the innermost-edge of the right border and the end of the longest Item caption when scrolled all the way to the right.

Default value is currently 2.0

virtual void VCF::ListBoxControl::setScrollable Scrollable scrollable  )  [virtual]
 

sets the scrollable for the listbox control, and sets it for a discrete scrolling, item by item.

Reimplemented from VCF::Control.

void VCF::ListBoxControl::setSelectedItem ListItem item  )  [inline]
 

virtual void VCF::ListBoxControl::setSmallImageList ImageList imageList  )  [virtual]
 

Reimplemented from VCF::ListControl.

virtual void VCF::ListBoxControl::setStateImageList ImageList imageList  )  [virtual]
 

Reimplemented from VCF::ListControl.

void VCF::ListBoxControl::setTextBounded const bool &  istextbounded  ) 
 

void VCF::ListBoxControl::setUseColorForBackground const bool &  val  )  [inline]
 

sets if we want to use the control's color to draw the control's background; otherwise the theme background is drawn.

Parameters:
const bool&, true if we use the control's color, false if we draw the theme background.

bool VCF::ListBoxControl::stateHitTest Point point,
ListItem item
 


Member Data Documentation

bool VCF::ListBoxControl::allowsExtendedSelect_ [protected]
 

bool VCF::ListBoxControl::allowsMultiSelect_ [protected]
 

double VCF::ListBoxControl::currentMaxHeight_ [protected]
 

double VCF::ListBoxControl::currentMaxWidth_ [protected]
 

double VCF::ListBoxControl::defaultItemHeight_ [protected]
 

VCF::Delegate VCF::ListBoxControl::ItemDelegate
 

Reimplemented from VCF::ListControl.

VCF::ListBoxControl::ItemStateChangeRequested
 

double VCF::ListBoxControl::leftGutter_ [protected]
 

double VCF::ListBoxControl::rightGutter_ [protected]
 

Array<uint32> VCF::ListBoxControl::selectedIndices_ [protected]
 

Array<ListItem*> VCF::ListBoxControl::selectedItems_ [protected]
 

double VCF::ListBoxControl::stateItemIndent_ [protected]
 

bool VCF::ListBoxControl::textBounded_ [protected]
 

bool VCF::ListBoxControl::useColorForBackground_ [protected]
 


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