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

VCF::ComboBoxControl Class Reference

A combo box control is a control that is used to display a selection from a list of choices in a single field. More...

#include <vcf/ApplicationKit/ComboBoxControl.h>

Inheritance diagram for VCF::ComboBoxControl:

VCF::CustomControl VCF::Control VCF::Component VCF::AbstractView VCF::ObjectWithEvents VCF::View VCF::Object List of all members.

Public Member Functions

 ComboBoxControl ()
virtual ~ComboBoxControl ()
void init ()
 This is going to be removed from the bext release.
ListModelgetListModel ()
 returns the ListModel currently associated with it.
void setListModel (ListModel *model)
 sets the ListModel for the Control.
virtual void paint (GraphicsContext *context)
 the overriden paint method
void onListModelContentsChanged (ListModelEvent *event)
void onItemAdded (ListModelEvent *event)
void onItemDeleted (ListModelEvent *event)
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 mouseEnter (MouseEvent *event)
 Called when the mouse first enters the control's bounds.
virtual void mouseLeave (MouseEvent *event)
 Called when the mouse leaves the control's bounds.
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
ListItemgetSelectedItem ()
 returns the currently selected item.
void setSelectedItem (ListItem *selectedItem)
 sets the currently selected item.
void setSelectedItemIndex (const uint32 &selectedIndex)
 sets the currently selected item as specified by the index.
ComboBoxStyleType getComboBoxStyle ()
 returns the combo box style.
void setComboBoxStyle (const ComboBoxStyleType &comboBoxStyle)
 sets the style of the combo box
ListItemaddItem (const String &caption, const uint32 imageIndex=0)
 adds a new ListItem.
void addItem (ListItem *item)
 adds a new ListItem.
void setDropDownCount (const uint32 &dropDownCount)
 sets the drop down count.
uint32 getDropDownCount ()
 returns the current drop down count
void setDropDownWidth (const uint32 &dropDownCount)
 sets the drop down width.
uint32 getDropDownWidth ()
 returns the current drop down witdh
void setDropDownExtendFullScreen (const bool &dropDownExtendFullScreen)
 sets true to allow the drop down list to extend to the full screen height
bool getDropDownExtendFullScreen ()
 returns true if the drop down list is allowed to extend to the full screen height
void setDiscreteScroll (const bool &discreteScroll)
 sets true to allow the drop down list to be scrolled only by discrete amounts.
bool getDiscreteScroll ()
 returns true if only a scrolling by discrete amounts are allowed.
void setDropDownSelected (const bool &dropDownSelected)
 sets if the item has been selected through the drop down list ( i.e.
bool getDropDownSelected ()
 returns the current state telling if the item has been selected by clicking the drop down list
ListItemlookupItem (const String &text, const bool &ignoreCase=false)
 lookup for an item in the dropdown list starting by a given text string.
void setAutoLookup (const bool &autoLookup)
 sets if the autoLookup of typed items is enabled
bool getAutoLookup ()
 returns the current state telling if the autoLookup is enabled
void setAutoLookupIgnoreCase (const bool &ignoreCase)
 sets if the autoLookup is done ignoring then letter's case
bool getAutoLookupIgnoreCase ()
 returns the current state telling if the autoLookup is done ignoring then letter's case
virtual bool keepsArrowKeys ()
 This function determines whether or not the control should have precedence and prevent the the arrow keys from switching focus to another control.
void setEnabled (const bool &enabled)
 sets whether the control is enabled or not.
String getCurrentText ()
virtual void setCurrentText (const String &text)
Rect getEditBounds ()
virtual double getPreferredHeight ()
 returns the preferred height for this control.
virtual void selectItems (const bool &select)

Public Attributes

VCF::Delegate SelectionChanged

Protected Member Functions

void onDropDownLostFocus (WindowEvent *event)
void closeDropDown (Event *event)
void onEditKeyPressed (KeyboardEvent *event)
void onEditReturnKeyPressed (KeyboardEvent *event)
void onFocusGained (FocusEvent *event)
void onPostSelect (ItemEvent *e)
virtual void destroy ()
 called by the free() method.
void updateEditBounds ()

Protected Attributes

WindowdropDown_
ListModellistModel_
ListItemselectedItem_
uint32 selectedIndex_
bool arrowPressed_
Rect viewRect_
bool mouseOver_
ComboBoxStyleType comboBoxStyle_
TextControledit_
uint32 dropDownCount_
double dropDownWidth_
bool dropDownExtendFullScreen_
bool discreteScroll_
bool dropDownSelected_
bool autoLookup_
bool autoLookupIgnoreCase_

Detailed Description

A combo box control is a control that is used to display a selection from a list of choices in a single field.

When the down arrow is clicked on a popup list is displayed that shows all the possible choices for the control.

The ComboBoxControl uses the ListModel, same abstract model as the ListBoxControl and ListViewControl controls, to store it's presentation data in.

Event Delegates for this class:


Constructor & Destructor Documentation

VCF::ComboBoxControl::ComboBoxControl  ) 
 

virtual VCF::ComboBoxControl::~ComboBoxControl  )  [virtual]
 


Member Function Documentation

void VCF::ComboBoxControl::addItem ListItem item  ) 
 

adds a new ListItem.

This method simply calls the models ListModel::addItem() method.

Parameters:
ListItem the item top be added to the control's ListModel

ListItem* VCF::ComboBoxControl::addItem const String caption,
const uint32  imageIndex = 0
 

adds a new ListItem.

This method simply calls the models ListModel::addItem() method and returns the newly created ListItem. Currently the default implementation creates a DefaultListItem to add.

Parameters:
String the caption of the new item
uint32 th image index of the new item. The default value is 0
Returns:
ListItem the newly added item

void VCF::ComboBoxControl::closeDropDown Event event  )  [protected]
 

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

called by the free() method.

Should be overriden and any clean up code performed here

Reimplemented from VCF::Control.

bool VCF::ComboBoxControl::getAutoLookup  )  [inline]
 

returns the current state telling if the autoLookup is enabled

bool VCF::ComboBoxControl::getAutoLookupIgnoreCase  )  [inline]
 

returns the current state telling if the autoLookup is done ignoring then letter's case

ComboBoxStyleType VCF::ComboBoxControl::getComboBoxStyle  )  [inline]
 

returns the combo box style.

The style may be cbsDropDown, which means the entry in the combo box field is non editable, or cbsDropDownWithEdit, which means the user can edit the fields data.

Returns:
ComboBoxStyleType the current style of the ComboBoxControl

String VCF::ComboBoxControl::getCurrentText  ) 
 

bool VCF::ComboBoxControl::getDiscreteScroll  )  [inline]
 

returns true if only a scrolling by discrete amounts are allowed.

uint32 VCF::ComboBoxControl::getDropDownCount  )  [inline]
 

returns the current drop down count

bool VCF::ComboBoxControl::getDropDownExtendFullScreen  )  [inline]
 

returns true if the drop down list is allowed to extend to the full screen height

bool VCF::ComboBoxControl::getDropDownSelected  )  [inline]
 

returns the current state telling if the item has been selected by clicking the drop down list

uint32 VCF::ComboBoxControl::getDropDownWidth  )  [inline]
 

returns the current drop down witdh

Rect VCF::ComboBoxControl::getEditBounds  ) 
 

ListModel* VCF::ComboBoxControl::getListModel  ) 
 

returns the ListModel currently associated with it.

Returns:
ListModel the list model for the control

virtual double VCF::ComboBoxControl::getPreferredHeight  )  [virtual]
 

returns the preferred height for this control.

This is used when determing the height of the control when it is first created. Override it to provide a different value that is more acceptable for your control's initial display size.

Reimplemented from VCF::Control.

ListItem* VCF::ComboBoxControl::getSelectedItem  ) 
 

returns the currently selected item.

Returns:
ListItem the currently selected tiem. If nothing is selected then the return value will be NULL.

void VCF::ComboBoxControl::init  ) 
 

This is going to be removed from the bext release.

Deprecated:

Reimplemented from VCF::CustomControl.

virtual bool VCF::ComboBoxControl::keepsArrowKeys  )  [inline, virtual]
 

This function determines whether or not the control should have precedence and prevent the the arrow keys from switching focus to another control.

Typically this will return false, with the exception of keyboard entry controls like the TextControl. To prevent the tab key from causing a the framework to switch to another control, override this and return true.

Returns:
bool returns false, indicating the framework can go ahead and switch the focus to the next tabbed control when appropriate, otherwise if it returns true the control will keep the tabbed key event and process it

Reimplemented from VCF::Control.

virtual void VCF::ComboBoxControl::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.

ListItem* VCF::ComboBoxControl::lookupItem const String text,
const bool &  ignoreCase = false
 

lookup for an item in the dropdown list starting by a given text string.

Parameters:
const String& text, the string to lookup
const bool& ignoreCase, true if the lettercase is ignored in the search
Returns:
ListItem*, the item in the list starting with the given text.

virtual void VCF::ComboBoxControl::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::ComboBoxControl::mouseEnter MouseEvent event  )  [virtual]
 

Called when the mouse first enters the control's bounds.

override this to provide specific behaviours when the control is first entered, like highlighting the control

Reimplemented from VCF::Control.

virtual void VCF::ComboBoxControl::mouseLeave MouseEvent event  )  [virtual]
 

Called when the mouse leaves the control's bounds.

override this to provide specific behaviours when the control is left, like highlighting the control

Reimplemented from VCF::Control.

virtual void VCF::ComboBoxControl::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::ComboBoxControl::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.

void VCF::ComboBoxControl::onDropDownLostFocus WindowEvent event  )  [protected]
 

void VCF::ComboBoxControl::onEditKeyPressed KeyboardEvent event  )  [protected]
 

void VCF::ComboBoxControl::onEditReturnKeyPressed KeyboardEvent event  )  [protected]
 

void VCF::ComboBoxControl::onFocusGained FocusEvent event  )  [protected]
 

void VCF::ComboBoxControl::onItemAdded ListModelEvent event  ) 
 

void VCF::ComboBoxControl::onItemDeleted ListModelEvent event  ) 
 

void VCF::ComboBoxControl::onListModelContentsChanged ListModelEvent event  ) 
 

void VCF::ComboBoxControl::onPostSelect ItemEvent e  )  [protected]
 

virtual void VCF::ComboBoxControl::paint GraphicsContext context  )  [virtual]
 

the overriden paint method

Reimplemented from VCF::CustomControl.

virtual void VCF::ComboBoxControl::selectItems const bool &  select  )  [virtual]
 

void VCF::ComboBoxControl::setAutoLookup const bool &  autoLookup  ) 
 

sets if the autoLookup of typed items is enabled

Parameters:
bool state telling if the autoLookup is enabled

void VCF::ComboBoxControl::setAutoLookupIgnoreCase const bool &  ignoreCase  ) 
 

sets if the autoLookup is done ignoring then letter's case

Parameters:
bool state telling if the autoLookup is done ignoring then letter's case

void VCF::ComboBoxControl::setComboBoxStyle const ComboBoxStyleType comboBoxStyle  ) 
 

sets the style of the combo box

Parameters:
ComboBoxStyleType the new style of the ComboBoxControl

virtual void VCF::ComboBoxControl::setCurrentText const String text  )  [virtual]
 

void VCF::ComboBoxControl::setDiscreteScroll const bool &  discreteScroll  ) 
 

sets true to allow the drop down list to be scrolled only by discrete amounts.

Parameters:
bool,true if only discrete amounts are allowed.

void VCF::ComboBoxControl::setDropDownCount const uint32 dropDownCount  ) 
 

sets the drop down count.

This is used to specify how many items are visible in the drop down list before scrollbars become neccessary

Parameters:
uint32 the new drop down count

void VCF::ComboBoxControl::setDropDownExtendFullScreen const bool &  dropDownExtendFullScreen  ) 
 

sets true to allow the drop down list to extend to the full screen height

Parameters:
bool the new state of drop down list extension

void VCF::ComboBoxControl::setDropDownSelected const bool &  dropDownSelected  ) 
 

sets if the item has been selected through the drop down list ( i.e.

manually by the user ) or through calls by source code by using the function setSelectedItem

Parameters:
bool state telling if selected by the drop down list ( for reset )

void VCF::ComboBoxControl::setDropDownWidth const uint32 dropDownCount  ) 
 

sets the drop down width.

This is used to specify the width of the drop down list if the user prefers it bigger then the ComboBoxControl's width itself

Parameters:
uint32 the new drop down witdh

void VCF::ComboBoxControl::setEnabled const bool &  enabled  ) 
 

sets whether the control is enabled or not.

Parameters:
bool true if the control is enabled, otherwise false.

Reimplemented from VCF::Control.

void VCF::ComboBoxControl::setListModel ListModel model  ) 
 

sets the ListModel for the Control.

If there was a previous ListModel already associated with the control, then the old ListModel's release() method will be called prior to setting the new ListModel. The control will call the newly set ListModel's addRef() after setting.

Parameters:
ListModel the new model to set for this control

void VCF::ComboBoxControl::setSelectedItem ListItem selectedItem  ) 
 

sets the currently selected item.

Causes a SelectionChanged event to be fired.

Parameters:
ListItem the item to be selected

void VCF::ComboBoxControl::setSelectedItemIndex const uint32 selectedIndex  ) 
 

sets the currently selected item as specified by the index.

Causes a SelectionChanged event to be fired.

Parameters:
uint32 the index of the item to be selected

void VCF::ComboBoxControl::updateEditBounds  )  [protected]
 


Member Data Documentation

bool VCF::ComboBoxControl::arrowPressed_ [protected]
 

bool VCF::ComboBoxControl::autoLookup_ [protected]
 

bool VCF::ComboBoxControl::autoLookupIgnoreCase_ [protected]
 

ComboBoxStyleType VCF::ComboBoxControl::comboBoxStyle_ [protected]
 

bool VCF::ComboBoxControl::discreteScroll_ [protected]
 

Window* VCF::ComboBoxControl::dropDown_ [protected]
 

uint32 VCF::ComboBoxControl::dropDownCount_ [protected]
 

bool VCF::ComboBoxControl::dropDownExtendFullScreen_ [protected]
 

bool VCF::ComboBoxControl::dropDownSelected_ [protected]
 

double VCF::ComboBoxControl::dropDownWidth_ [protected]
 

TextControl* VCF::ComboBoxControl::edit_ [protected]
 

ListModel* VCF::ComboBoxControl::listModel_ [protected]
 

bool VCF::ComboBoxControl::mouseOver_ [protected]
 

uint32 VCF::ComboBoxControl::selectedIndex_ [protected]
 

ListItem* VCF::ComboBoxControl::selectedItem_ [protected]
 

VCF::Delegate VCF::ComboBoxControl::SelectionChanged
 

Event Delegate:
SelectionChanged this is fired when the selection changes in the combo box.
event class: ItemEvent
event type: ITEM_EVENT_SELECTED

Rect VCF::ComboBoxControl::viewRect_ [protected]
 


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