Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

combobox.h

Go to the documentation of this file.
00001 /*
00002         ClanGUI, copyrights by various people. Have a look in the CREDITS file.
00003         
00004         This sourcecode is distributed using the Library GNU Public Licence,
00005         version 2 or (at your option) any later version. Please read LICENSE
00006         for details.
00007 */
00008 
00010 
00011 #ifndef header_combobox
00012 #define header_combobox
00013 
00014 #include "component.h"
00015 
00016 class CL_ComboBox : public CL_Component
00017 //: Combobox component
00018 {
00019 public:
00021         CL_ComboBox(
00022                 const CL_ComponentOptions &options,
00023                 CL_Component *parent,
00024                 CL_StyleManager *style = NULL);
00025 
00026         CL_ComboBox(
00027                 const CL_Rect &pos,
00028                 CL_Component *parent,
00029                 CL_StyleManager *style = NULL);
00030 
00031         virtual ~CL_ComboBox();
00032 
00034 public:
00035         int get_count() const;
00036         //: Returns the number of items in the combobox.
00037 
00038         std::list<std::string> &get_items() const;
00039         //: Returns all items in the list.
00040 
00041         std::string get_current_text() const;
00042         //: Returns the current text item. 
00043 
00044         std::string get_text(int index) const;
00045         //: Returns the text item at a given index.
00046 
00047         int get_current_item() const;
00048         //: Returns the index of the current combobox item.
00049 
00050         bool is_selected(int index) const;
00051         //: Returns true if item index is selected. Returns false if it is not selected or if there is an error.
00052 
00054 public:
00055         int insert_item(const std::string &text, int index = -1);
00056         //: Inserts a text item at position index. 
00057         // The item will be appended if index is negative.
00058 
00059         void remove_item(int index);
00060         //: Removes and deletes the item at position index.
00061         // If index is equal to currentItem(), a new item gets highlighted and the highlighted() signal is emitted. 
00062 
00063         void change_item(const std::string &text, int index);
00064         //: Replaces the item at position index with a text.
00065 
00066         void set_current_item(int index);
00067         //: Sets the current combobox item. This is the item to be displayed on the combobox button. 
00068 
00069         void clear_selection();
00070         //: Deselect current selected item.
00071 
00072         void sort(bool ascending = true);
00073         //: Sorts the items in ascending order, if ascending is true, or descending otherwise. 
00074 
00075         void clear();
00076         //: Removes all combobox items. 
00077 
00079 public:
00080         CL_Signal_v1<int> &sig_activated();
00081         //: This signal is emitted when a new item has been activated (selected).
00083 
00084         CL_Signal_v1<int> &sig_highlighted();
00085         //: This signal is emitted when a new item has been highlighted.
00087 
00089 private:
00090         CL_ComboBox(const CL_ComboBox &copy) : CL_Component(NULL, NULL) { return; } // disallow copy construction.
00091         class CL_ComboBox_Generic *impl;
00092 };  
00093 
00094 #endif

Generated at Wed Apr 4 19:53:59 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001