libcdos-fw
CFComboBox.h
1 // Copyright 2017, CDOS.
2 // All rights reserved.
3 //
4 // Author: CDOS Support Team <support_os@sari.ac.cn>
5 //
6 // A widget used to choose from a list of items.
7 #ifndef __CF_COMBOBOX_H__
8 #define __CF_COMBOBOX_H__
9 
10 #include "Gui/CFBin.h"
11 #include "Gui/CFEntry.h"
12 #include "Gui/CFEnums.h"
13 #include <gdkmm.h>
14 
15 CF_NAMESPACE_BEGIN
16 
17 class CFComboBox : public CFBin {
18 public:
22  explicit CFComboBox(bool has_entry = false);
23 
24  ~CFComboBox();
25 
32  void setWrapWidth(int width);
33 
40  int getWrapWidth();
41 
42 
49  void setRowSpanColumn(int row_span);
50 
55  int getRowSpanColumn();
56 
57 
64  void setColumnSpanColumn(int column_span);
65 
70  int getColumnSpanColumn();
71 
79  void setAddTearoffs(bool add_tearoffs = true);
80 
89  bool getAddTearoffs();
90 
91 
102  Glib::ustring getTitle();
103 
110  void setTitle(const Glib::ustring& title);
111 
121  bool getFocusOnClick();
122 
133  void setFocusOnClick(bool focus_on_click = true);
134 
135  /* get/set active item */
136 
145  int getActiveRowNumber();
146 
152  void setActive(int index);
153 
157  void unsetActive();
158 
161  void unsetRowSeparatorFunc();
162 
163 
170  void setButtonSensitivity(CFSensitivityType sensitivity);
171 
182 
183 
188  bool getHasEntry();
189 
200  void setEntryTextColumn(int text_column);
201 
202 
208  int getEntryTextColumn();
209 
210 
216  void setPopupFixedWidth(bool fixed = true);
217 
223  bool getPopupFixedWidth();
224 
225 
231  void popup();
232 
239  void popup(const Glib::RefPtr<Gdk::Device>& device);
240 
247  void popdown();
248 
254  int getIdColumn();
255 
262  void setIdColumn(int id_column);
263 
278  Glib::ustring getActiveId();
279 
294  void getActiveId(const Glib::ustring& active_id);
295 
305  bool setActiveId(const Glib::ustring& active_id);
306 
309  CFEntry* getEntry();
310 };
311 
312 CF_NAMESPACE_END
313 
314 #endif // __CF_COMBOBOX_H__
int getWrapWidth()
Returns the wrap width which is used to determine the number of columns for the popup menu...
bool getPopupFixedWidth()
Gets whether the popup uses a fixed width matching the allocated width of the combo box...
void setAddTearoffs(bool add_tearoffs=true)
Sets whether the popup menu should have a tearoff menu item.
void popdown()
Hides the menu or dropdown list of combo_box.
Glib::ustring getActiveId()
Returns the ID of the active row of combo_box.
int getColumnSpanColumn()
Returns the column with column span information for combo_box.
void setRowSpanColumn(int row_span)
Sets the column with row span information for combo_box to be row_span.
void setIdColumn(int id_column)
Sets the model column which combo_box should use to get string IDs for values from.
void setFocusOnClick(bool focus_on_click=true)
Sets whether the combo box will grab focus when it is clicked with the mouse.
Definition: CFEntry.h:8
Definition: CFComboBox.h:17
void setTitle(const Glib::ustring &title)
Sets the menu’s title in tearoff mode.
int getEntryTextColumn()
Returns the column which combo_box is using to get the strings from to display in the internal entry...
int getIdColumn()
Returns the column which combo_box is using to get string IDs for values from.
CFBin 一个只允许容纳一个控件的容器类.
Definition: CFBin.h:14
bool getFocusOnClick()
Returns whether the combo box grabs focus when it is clicked with the mouse.
int getRowSpanColumn()
Returns the column with row span information for combo_box.
CFEntry * getEntry()
bool getHasEntry()
Returns whether the combo box has an entry.
void unsetRowSeparatorFunc()
Causes no separators to be drawn.
int getActiveRowNumber()
Returns the index of the currently active item, or -1 if there’s no active item. ...
void setWrapWidth(int width)
Sets the wrap width of combo_box to be width.
void setActive(int index)
Sets the active item of combo_box to be the item at index.
Glib::ustring getTitle()
Gets the current title of the menu in tearoff mode.
CFSensitivityType getButtonSensitivity()
Returns whether the combo box sets the dropdown button sensitive or not when there are no items in th...
void popup()
Pops up the menu or dropdown list of combo_box.
CFSensitivityType
Definition: CFEnums.h:193
bool getAddTearoffs()
Gets the current title of the menu in tearoff mode.
void setButtonSensitivity(CFSensitivityType sensitivity)
Sets whether the dropdown button of the combo box should be always sensitive (CFSENSITIVITY_ON), never sensitive (CFSENSITIVITY_OFF) or only if there is at least one item to display (CFSENSITIVITY_AUTO).
void unsetActive()
Causes no item to be active.
void setEntryTextColumn(int text_column)
Sets the model column which combo_box should use to get strings from to be text_column.
CFComboBox(bool has_entry=false)
Creates a new empty ComboBox, optionally with an entry.
void setColumnSpanColumn(int column_span)
Sets the column with column span information for combo_box to be column_span.
void setPopupFixedWidth(bool fixed=true)
Specifies whether the popup’s width should be a fixed width matching the allocated width of the comb...
bool setActiveId(const Glib::ustring &active_id)
Changes the active row of the combo box to the one that has an ID equal to active_id.