ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_ComboBox

Combobox component
Contained in: global
Derived from: CL_Component
Derived by: none
Group: GUI (Controls)

#include <ClanLib/gui.h>


public function member index:

Construction:

CL_ComboBox(const CL_ComponentOptions& options, CL_Component* parent, CL_StyleManager* style = NULL);
CL_ComboBox(const CL_Rect& pos, CL_Component* parent, CL_StyleManager* style = NULL);
virtual ~CL_ComboBox();

Attributes:

int get_count() const;
std::list<std::string>& get_items() const;
std::string get_current_text() const;
std::string get_text(int index) const;
int get_current_item() const;
bool is_selected(int index) const;

Operations:

int insert_item(const std::string& text, int index = -1);
void remove_item(int index);
void change_item(const std::string& text, int index);
void set_current_item(int index);
void clear_selection();
void sort(bool ascending = true);
void clear();

Signals:

CL_Signal_v1<int>& sig_activated();
CL_Signal_v1<int>& sig_highlighted();
 

private function member index:

Implementation:

CL_ComboBox(const CL_ComboBox& copy);
 

Description:


Function Member Descriptions:

CL_ComboBox::CL_ComboBox - ComboBox constructor
CL_ComboBox(const CL_ComponentOptions& options, CL_Component* parent, CL_StyleManager* style = NULL);


CL_ComboBox::CL_ComboBox - ComboBox constructor
CL_ComboBox(const CL_Rect& pos, CL_Component* parent, CL_StyleManager* style = NULL);


CL_ComboBox::change_item - Replaces the item at position index with a text.
void change_item(const std::string& text, int index);


CL_ComboBox::clear - Removes all combobox items.
void clear();


CL_ComboBox::clear_selection - Deselect current selected item.
void clear_selection();


CL_ComboBox::get_count - Returns the number of items in the combobox.
int get_count() const;


CL_ComboBox::get_current_item - Returns the index of the current combobox item.
int get_current_item() const;


CL_ComboBox::get_current_text - Returns the current text item.
std::string get_current_text() const;


CL_ComboBox::get_items - Returns all items in the list.
std::list<std::string>& get_items() const;


CL_ComboBox::get_text - Returns the text item at a given index.
std::string get_text(int index) const;


CL_ComboBox::insert_item - Inserts a text item at position index.
The item will be appended if index is negative.
int insert_item(const std::string& text, int index = -1);


CL_ComboBox::is_selected - Returns true if item index is selected. Returns false if it is not selected or if there is an error.
bool is_selected(int index) const;


CL_ComboBox::remove_item - Removes and deletes the item at position index.
If index is equal to currentItem(), a new item gets highlighted and the highlighted() signal is emitted.
void remove_item(int index);


CL_ComboBox::set_current_item - Sets the current combobox item. This is the item to be displayed on the combobox button.
void set_current_item(int index);


CL_ComboBox::sig_activated - This signal is emitted when a new item has been activated (selected).
CL_Signal_v1<int>& sig_activated();
int index - The position of the item in the popup list.



CL_ComboBox::sig_highlighted - This signal is emitted when a new item has been highlighted.
CL_Signal_v1<int>& sig_highlighted();
int index - The position of the item in the popup list.



CL_ComboBox::sort - Sorts the items in ascending order, if ascending is true, or descending otherwise.
void sort(bool ascending = true);


CL_ComboBox::~CL_ComboBox - ComboBox destructor
virtual ~CL_ComboBox();



Variable Member Descriptions: