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::UIComponent VCF::AbstractView VCF::Component VCF::View VCF::ObjectWithCallbacks VCF::Object List of all members.

Public Member Functions

 ComboBoxControl ()
virtual ~ComboBoxControl ()
void init ()
SelectionChanged ListModelgetListModel ()
 returns the ListModel currently associated with it.
void setListModel (ListModel *model)
virtual void paint (GraphicsContext *context)
 the overriden paint method
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
ListIteminsertItem (const uint32 &index, const String &caption, const uint32 imageIndex=0)
 adds a new ListItem.
ListItemaddItem (const String &caption, const uint32 imageIndex=0)
ListItemgetListItem (const uint32 &index)
void setListItem (const uint32 &index, ListItem *item)
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)
virtual bool generatePropertyValue (const String &fullPropertyName, Property *property, VariantData *value, String &strValue)
virtual void setViewModel (Model *viewModel)
 sets a new model for the view Once set, the control fires a ControlModelChanged event.
ListBoxControlgetListBox ()

Public Attributes

VCF::Delegate ItemDelegate

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_
bool arrowPressed_
Rect viewRect_
bool mouseOver_
ComboBoxStyleType comboBoxStyle_
TextControledit_
ListBoxControllistBox_
uint32 dropDownCount_
double dropDownWidth_
bool dropDownExtendFullScreen_
bool discreteScroll_
bool dropDownSelected_
bool autoLookup_
bool autoLookupIgnoreCase_
bool internalModelChange_

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.

Note that as of the April 2008 this class is deprecated and should not be used. Instead please use the DropDownControl which does the same thing, only uses a native control wrapper. The next release of the Framework will get rid of this class completely.

Event Delegates for this class:
  • ComboBoxControl::SelectionChanged
Deprecated:
See also:
DropDownControl


Constructor & Destructor Documentation

VCF::ComboBoxControl::ComboBoxControl  ) 
 

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


Member Function Documentation

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

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.

virtual bool VCF::ComboBoxControl::generatePropertyValue const String fullPropertyName,
Property property,
VariantData value,
String strValue
[virtual]
 

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  ) 
 

ListBoxControl* VCF::ComboBoxControl::getListBox  ) 
 

ListItem* VCF::ComboBoxControl::getListItem const uint32 index  ) 
 

SelectionChanged 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  ) 
 

Reimplemented from VCF::CustomControl.

ListItem* VCF::ComboBoxControl::insertItem const uint32 index,
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

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::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::setListItem const uint32 index,
ListItem item
 

void VCF::ComboBoxControl::setListModel ListModel model  ) 
 

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

virtual void VCF::ComboBoxControl::setViewModel Model viewModel  )  [virtual]
 

sets a new model for the view Once set, the control fires a ControlModelChanged event.

Reimplemented from VCF::Control.

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]
 

bool VCF::ComboBoxControl::internalModelChange_ [protected]
 

VCF::Delegate VCF::ComboBoxControl::ItemDelegate
 

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

ListBoxControl* VCF::ComboBoxControl::listBox_ [protected]
 

bool VCF::ComboBoxControl::mouseOver_ [protected]
 

Rect VCF::ComboBoxControl::viewRect_ [protected]
 


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