CtkComboBox

CtkComboBox — A widget used to choose from a list of items

Functions

CtkWidget * ctk_combo_box_new ()
CtkWidget * ctk_combo_box_new_with_entry ()
CtkWidget * ctk_combo_box_new_with_model ()
CtkWidget * ctk_combo_box_new_with_model_and_entry ()
CtkWidget * ctk_combo_box_new_with_area ()
CtkWidget * ctk_combo_box_new_with_area_and_entry ()
gint ctk_combo_box_get_wrap_width ()
void ctk_combo_box_set_wrap_width ()
gint ctk_combo_box_get_row_span_column ()
void ctk_combo_box_set_row_span_column ()
gint ctk_combo_box_get_column_span_column ()
void ctk_combo_box_set_column_span_column ()
gint ctk_combo_box_get_active ()
void ctk_combo_box_set_active ()
gboolean ctk_combo_box_get_active_iter ()
void ctk_combo_box_set_active_iter ()
gint ctk_combo_box_get_id_column ()
void ctk_combo_box_set_id_column ()
const gchar * ctk_combo_box_get_active_id ()
gboolean ctk_combo_box_set_active_id ()
CtkTreeModel * ctk_combo_box_get_model ()
void ctk_combo_box_set_model ()
void ctk_combo_box_popup_for_device ()
void ctk_combo_box_popup ()
void ctk_combo_box_popdown ()
AtkObject * ctk_combo_box_get_popup_accessible ()
CtkTreeViewRowSeparatorFunc ctk_combo_box_get_row_separator_func ()
void ctk_combo_box_set_row_separator_func ()
void ctk_combo_box_set_add_tearoffs ()
gboolean ctk_combo_box_get_add_tearoffs ()
void ctk_combo_box_set_title ()
const gchar * ctk_combo_box_get_title ()
void ctk_combo_box_set_focus_on_click ()
gboolean ctk_combo_box_get_focus_on_click ()
void ctk_combo_box_set_button_sensitivity ()
CtkSensitivityType ctk_combo_box_get_button_sensitivity ()
gboolean ctk_combo_box_get_has_entry ()
void ctk_combo_box_set_entry_text_column ()
gint ctk_combo_box_get_entry_text_column ()
void ctk_combo_box_set_popup_fixed_width ()
gboolean ctk_combo_box_get_popup_fixed_width ()

Properties

int active Read / Write
char * active-id Read / Write
gboolean add-tearoffs Read / Write
CtkSensitivityType button-sensitivity Read / Write
CtkCellArea * cell-area Read / Write / Construct Only
int column-span-column Read / Write
int entry-text-column Read / Write
gboolean has-entry Read / Write / Construct Only
gboolean has-frame Read / Write
int id-column Read / Write
CtkTreeModel * model Read / Write
gboolean popup-fixed-width Read / Write
gboolean popup-shown Read
int row-span-column Read / Write
char * tearoff-title Read / Write
int wrap-width Read / Write

Signals

void changed Run Last
char* format-entry-text Run Last
void move-active Action
gboolean popdown Action
void popup Action

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkBin
                    ╰── CtkComboBox
                        ├── CtkAppChooserButton
                        ╰── CtkComboBoxText

Implemented Interfaces

CtkComboBox implements AtkImplementorIface, CtkBuildable, CtkCellLayout and CtkCellEditable.

Includes

#include <ctk/ctk.h>

Description

A CtkComboBox is a widget that allows the user to choose from a list of valid choices. The CtkComboBox displays the selected choice. When activated, the CtkComboBox displays a popup which allows the user to make a new choice. The style in which the selected value is displayed, and the style of the popup is determined by the current theme. It may be similar to a Windows-style combo box.

The CtkComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since CtkComboBox implements the CtkCellLayout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure.

To allow the user to enter values not in the model, the “has-entry” property allows the CtkComboBox to contain a CtkEntry. This entry can be accessed by calling ctk_bin_get_child() on the combo box.

For a simple list of textual choices, the model-view API of CtkComboBox can be a bit overwhelming. In this case, CtkComboBoxText offers a simple alternative. Both CtkComboBox and CtkComboBoxText can contain an entry.

CSS nodes

1
2
3
4
5
6
7
combobox
├── box.linked
   ╰── button.combo
       ╰── box
           ├── cellview
           ╰── arrow
╰── window.popup

A normal combobox contains a box with the .linked class, a button with the .combo class and inside those buttons, there are a cellview and an arrow.

1
2
3
4
5
6
7
combobox
├── box.linked
   ├── entry.combo
   ╰── button.combo
       ╰── box
           ╰── arrow
╰── window.popup

A CtkComboBox with an entry has a single CSS node with name combobox. It contains a box with the .linked class. That box contains an entry and a button, both with the .combo class added. The button also contains another node with name arrow.

Functions

ctk_combo_box_new ()

CtkWidget *
ctk_combo_box_new (void);

Creates a new empty CtkComboBox.

Returns

A new CtkComboBox.

Since: 2.4


ctk_combo_box_new_with_entry ()

CtkWidget *
ctk_combo_box_new_with_entry (void);

Creates a new empty CtkComboBox with an entry.

Returns

A new CtkComboBox.

Since: 2.24


ctk_combo_box_new_with_model ()

CtkWidget *
ctk_combo_box_new_with_model (CtkTreeModel *model);

Creates a new CtkComboBox with the model initialized to model .

Parameters

model

A CtkTreeModel.

 

Returns

A new CtkComboBox.

Since: 2.4


ctk_combo_box_new_with_model_and_entry ()

CtkWidget *
ctk_combo_box_new_with_model_and_entry
                               (CtkTreeModel *model);

Creates a new empty CtkComboBox with an entry and with the model initialized to model .

Parameters

model

A CtkTreeModel

 

Returns

A new CtkComboBox

Since: 2.24


ctk_combo_box_new_with_area ()

CtkWidget *
ctk_combo_box_new_with_area (CtkCellArea *area);

Creates a new empty CtkComboBox using area to layout cells.

Parameters

area

the CtkCellArea to use to layout cell renderers

 

Returns

A new CtkComboBox.


ctk_combo_box_new_with_area_and_entry ()

CtkWidget *
ctk_combo_box_new_with_area_and_entry (CtkCellArea *area);

Creates a new empty CtkComboBox with an entry.

The new combo box will use area to layout cells.

Parameters

area

the CtkCellArea to use to layout cell renderers

 

Returns

A new CtkComboBox.


ctk_combo_box_get_wrap_width ()

gint
ctk_combo_box_get_wrap_width (CtkComboBox *combo_box);

Returns the wrap width which is used to determine the number of columns for the popup menu. If the wrap width is larger than 1, the combo box is in table mode.

Parameters

combo_box

A CtkComboBox

 

Returns

the wrap width.

Since: 2.6


ctk_combo_box_set_wrap_width ()

void
ctk_combo_box_set_wrap_width (CtkComboBox *combo_box,
                              gint width);

Sets the wrap width of combo_box to be width . The wrap width is basically the preferred number of columns when you want the popup to be layed out in a table.

Parameters

combo_box

A CtkComboBox

 

width

Preferred number of columns

 

Since: 2.4


ctk_combo_box_get_row_span_column ()

gint
ctk_combo_box_get_row_span_column (CtkComboBox *combo_box);

Returns the column with row span information for combo_box .

Parameters

combo_box

A CtkComboBox

 

Returns

the row span column.

Since: 2.6


ctk_combo_box_set_row_span_column ()

void
ctk_combo_box_set_row_span_column (CtkComboBox *combo_box,
                                   gint row_span);

Sets the column with row span information for combo_box to be row_span . The row span column contains integers which indicate how many rows an item should span.

Parameters

combo_box

A CtkComboBox.

 

row_span

A column in the model passed during construction.

 

Since: 2.4


ctk_combo_box_get_column_span_column ()

gint
ctk_combo_box_get_column_span_column (CtkComboBox *combo_box);

Returns the column with column span information for combo_box .

Parameters

combo_box

A CtkComboBox

 

Returns

the column span column.

Since: 2.6


ctk_combo_box_set_column_span_column ()

void
ctk_combo_box_set_column_span_column (CtkComboBox *combo_box,
                                      gint column_span);

Sets the column with column span information for combo_box to be column_span . The column span column contains integers which indicate how many columns an item should span.

Parameters

combo_box

A CtkComboBox

 

column_span

A column in the model passed during construction

 

Since: 2.4


ctk_combo_box_get_active ()

gint
ctk_combo_box_get_active (CtkComboBox *combo_box);

Returns the index of the currently active item, or -1 if there’s no active item. If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this function returns ctk_tree_path_get_indices (path)[0], where path is the CtkTreePath of the active item.

Parameters

combo_box

A CtkComboBox

 

Returns

An integer which is the index of the currently active item, or -1 if there’s no active item.

Since: 2.4


ctk_combo_box_set_active ()

void
ctk_combo_box_set_active (CtkComboBox *combo_box,
                          gint index_);

Sets the active item of combo_box to be the item at index .

Parameters

combo_box

A CtkComboBox

 

index_

An index in the model passed during construction, or -1 to have no active item

 

Since: 2.4


ctk_combo_box_get_active_iter ()

gboolean
ctk_combo_box_get_active_iter (CtkComboBox *combo_box,
                               CtkTreeIter *iter);

Sets iter to point to the currently active item, if any item is active. Otherwise, iter is left unchanged.

Parameters

combo_box

A CtkComboBox

 

iter

A CtkTreeIter.

[out]

Returns

TRUE if iter was set, FALSE otherwise

Since: 2.4


ctk_combo_box_set_active_iter ()

void
ctk_combo_box_set_active_iter (CtkComboBox *combo_box,
                               CtkTreeIter *iter);

Sets the current active item to be the one referenced by iter , or unsets the active item if iter is NULL.

Parameters

combo_box

A CtkComboBox

 

iter

The CtkTreeIter, or NULL.

[allow-none]

Since: 2.4


ctk_combo_box_get_id_column ()

gint
ctk_combo_box_get_id_column (CtkComboBox *combo_box);

Returns the column which combo_box is using to get string IDs for values from.

Parameters

combo_box

A CtkComboBox

 

Returns

A column in the data source model of combo_box .

Since: 3.0


ctk_combo_box_set_id_column ()

void
ctk_combo_box_set_id_column (CtkComboBox *combo_box,
                             gint id_column);

Sets the model column which combo_box should use to get string IDs for values from. The column id_column in the model of combo_box must be of type G_TYPE_STRING.

Parameters

combo_box

A CtkComboBox

 

id_column

A column in model to get string IDs for values from

 

Since: 3.0


ctk_combo_box_get_active_id ()

const gchar *
ctk_combo_box_get_active_id (CtkComboBox *combo_box);

Returns the ID of the active row of combo_box . This value is taken from the active row and the column specified by the “id-column” property of combo_box (see ctk_combo_box_set_id_column()).

The returned value is an interned string which means that you can compare the pointer by value to other interned strings and that you must not free it.

If the “id-column” property of combo_box is not set, or if no row is active, or if the active row has a NULL ID value, then NULL is returned.

Parameters

combo_box

a CtkComboBox

 

Returns

the ID of the active row, or NULL.

[nullable]

Since: 3.0


ctk_combo_box_set_active_id ()

gboolean
ctk_combo_box_set_active_id (CtkComboBox *combo_box,
                             const gchar *active_id);

Changes the active row of combo_box to the one that has an ID equal to active_id , or unsets the active row if active_id is NULL. Rows having a NULL ID string cannot be made active by this function.

If the “id-column” property of combo_box is unset or if no row has the given ID then the function does nothing and returns FALSE.

Parameters

combo_box

a CtkComboBox

 

active_id

the ID of the row to select, or NULL.

[allow-none]

Returns

TRUE if a row with a matching ID was found. If a NULL active_id was given to unset the active row, the function always returns TRUE.

Since: 3.0


ctk_combo_box_get_model ()

CtkTreeModel *
ctk_combo_box_get_model (CtkComboBox *combo_box);

Returns the CtkTreeModel which is acting as data source for combo_box .

Parameters

combo_box

A CtkComboBox

 

Returns

A CtkTreeModel which was passed during construction.

[transfer none]

Since: 2.4


ctk_combo_box_set_model ()

void
ctk_combo_box_set_model (CtkComboBox *combo_box,
                         CtkTreeModel *model);

Sets the model used by combo_box to be model . Will unset a previously set model (if applicable). If model is NULL, then it will unset the model.

Note that this function does not clear the cell renderers, you have to call ctk_cell_layout_clear() yourself if you need to set up different cell renderers for the new model.

Parameters

combo_box

A CtkComboBox

 

model

A CtkTreeModel.

[allow-none]

Since: 2.4


ctk_combo_box_popup_for_device ()

void
ctk_combo_box_popup_for_device (CtkComboBox *combo_box,
                                CdkDevice *device);

Pops up the menu or dropdown list of combo_box , the popup window will be grabbed so only device and its associated pointer/keyboard are the only CdkDevices able to send events to it.

Parameters

combo_box

a CtkComboBox

 

device

a CdkDevice

 

Since: 3.0


ctk_combo_box_popup ()

void
ctk_combo_box_popup (CtkComboBox *combo_box);

Pops up the menu or dropdown list of combo_box .

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Before calling this, combo_box must be mapped, or nothing will happen.

Parameters

combo_box

a CtkComboBox

 

Since: 2.4


ctk_combo_box_popdown ()

void
ctk_combo_box_popdown (CtkComboBox *combo_box);

Hides the menu or dropdown list of combo_box .

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Parameters

combo_box

a CtkComboBox

 

Since: 2.4


ctk_combo_box_get_popup_accessible ()

AtkObject *
ctk_combo_box_get_popup_accessible (CtkComboBox *combo_box);

Gets the accessible object corresponding to the combo box’s popup.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Parameters

combo_box

a CtkComboBox

 

Returns

the accessible object corresponding to the combo box’s popup.

[transfer none]

Since: 2.6


ctk_combo_box_get_row_separator_func ()

CtkTreeViewRowSeparatorFunc
ctk_combo_box_get_row_separator_func (CtkComboBox *combo_box);

Returns the current row separator function.

[skip]

Parameters

combo_box

a CtkComboBox

 

Returns

the current row separator function.

Since: 2.6


ctk_combo_box_set_row_separator_func ()

void
ctk_combo_box_set_row_separator_func (CtkComboBox *combo_box,
                                      CtkTreeViewRowSeparatorFunc func,
                                      gpointer data,
                                      GDestroyNotify destroy);

Sets the row separator function, which is used to determine whether a row should be drawn as a separator. If the row separator function is NULL, no separators are drawn. This is the default value.

Parameters

combo_box

a CtkComboBox

 

func

a CtkTreeViewRowSeparatorFunc

 

data

user data to pass to func , or NULL.

[allow-none]

destroy

destroy notifier for data , or NULL.

[allow-none]

Since: 2.6


ctk_combo_box_set_add_tearoffs ()

void
ctk_combo_box_set_add_tearoffs (CtkComboBox *combo_box,
                                gboolean add_tearoffs);

ctk_combo_box_set_add_tearoffs has been deprecated since version 3.10 and should not be used in newly-written code.

Sets whether the popup menu should have a tearoff menu item.

Parameters

combo_box

a CtkComboBox

 

add_tearoffs

TRUE to add tearoff menu items

 

Since: 2.6


ctk_combo_box_get_add_tearoffs ()

gboolean
ctk_combo_box_get_add_tearoffs (CtkComboBox *combo_box);

ctk_combo_box_get_add_tearoffs has been deprecated since version 3.10 and should not be used in newly-written code.

Gets the current value of the :add-tearoffs property.

Parameters

combo_box

a CtkComboBox

 

Returns

the current value of the :add-tearoffs property.


ctk_combo_box_set_title ()

void
ctk_combo_box_set_title (CtkComboBox *combo_box,
                         const gchar *title);

ctk_combo_box_set_title has been deprecated since version 3.10 and should not be used in newly-written code.

Sets the menu’s title in tearoff mode.

Parameters

combo_box

a CtkComboBox

 

title

a title for the menu in tearoff mode

 

Since: 2.10


ctk_combo_box_get_title ()

const gchar *
ctk_combo_box_get_title (CtkComboBox *combo_box);

ctk_combo_box_get_title has been deprecated since version 3.10 and should not be used in newly-written code.

Gets the current title of the menu in tearoff mode. See ctk_combo_box_set_add_tearoffs().

Parameters

combo_box

a CtkComboBox

 

Returns

the menu’s title in tearoff mode. This is an internal copy of the string which must not be freed.

Since: 2.10


ctk_combo_box_set_focus_on_click ()

void
ctk_combo_box_set_focus_on_click (CtkComboBox *combo,
                                  gboolean focus_on_click);

ctk_combo_box_set_focus_on_click has been deprecated since version 3.20 and should not be used in newly-written code.

Use ctk_widget_set_focus_on_click() instead

Sets whether the combo box will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

Parameters

combo

a CtkComboBox

 

focus_on_click

whether the combo box grabs focus when clicked with the mouse

 

Since: 2.6


ctk_combo_box_get_focus_on_click ()

gboolean
ctk_combo_box_get_focus_on_click (CtkComboBox *combo);

ctk_combo_box_get_focus_on_click has been deprecated since version 3.20 and should not be used in newly-written code.

Use ctk_widget_get_focus_on_click() instead

Returns whether the combo box grabs focus when it is clicked with the mouse. See ctk_combo_box_set_focus_on_click().

Parameters

combo

a CtkComboBox

 

Returns

TRUE if the combo box grabs focus when it is clicked with the mouse.

Since: 2.6


ctk_combo_box_set_button_sensitivity ()

void
ctk_combo_box_set_button_sensitivity (CtkComboBox *combo_box,
                                      CtkSensitivityType sensitivity);

Sets whether the dropdown button of the combo box should be always sensitive (CTK_SENSITIVITY_ON), never sensitive (CTK_SENSITIVITY_OFF) or only if there is at least one item to display (CTK_SENSITIVITY_AUTO).

Parameters

combo_box

a CtkComboBox

 

sensitivity

specify the sensitivity of the dropdown button

 

Since: 2.14


ctk_combo_box_get_button_sensitivity ()

CtkSensitivityType
ctk_combo_box_get_button_sensitivity (CtkComboBox *combo_box);

Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

Parameters

combo_box

a CtkComboBox

 

Returns

CTK_SENSITIVITY_ON if the dropdown button is sensitive when the model is empty, CTK_SENSITIVITY_OFF if the button is always insensitive or CTK_SENSITIVITY_AUTO if it is only sensitive as long as the model has one item to be selected.

Since: 2.14


ctk_combo_box_get_has_entry ()

gboolean
ctk_combo_box_get_has_entry (CtkComboBox *combo_box);

Returns whether the combo box has an entry.

Parameters

combo_box

a CtkComboBox

 

Returns

whether there is an entry in combo_box .

Since: 2.24


ctk_combo_box_set_entry_text_column ()

void
ctk_combo_box_set_entry_text_column (CtkComboBox *combo_box,
                                     gint text_column);

Sets the model column which combo_box should use to get strings from to be text_column . The column text_column in the model of combo_box must be of type G_TYPE_STRING.

This is only relevant if combo_box has been created with “has-entry” as TRUE.

Parameters

combo_box

A CtkComboBox

 

text_column

A column in model to get the strings from for the internal entry

 

Since: 2.24


ctk_combo_box_get_entry_text_column ()

gint
ctk_combo_box_get_entry_text_column (CtkComboBox *combo_box);

Returns the column which combo_box is using to get the strings from to display in the internal entry.

Parameters

combo_box

A CtkComboBox.

 

Returns

A column in the data source model of combo_box .

Since: 2.24


ctk_combo_box_set_popup_fixed_width ()

void
ctk_combo_box_set_popup_fixed_width (CtkComboBox *combo_box,
                                     gboolean fixed);

Specifies whether the popup’s width should be a fixed width matching the allocated width of the combo box.

Parameters

combo_box

a CtkComboBox

 

fixed

whether to use a fixed popup width

 

Since: 3.0


ctk_combo_box_get_popup_fixed_width ()

gboolean
ctk_combo_box_get_popup_fixed_width (CtkComboBox *combo_box);

Gets whether the popup uses a fixed width matching the allocated width of the combo box.

Parameters

combo_box

a CtkComboBox

 

Returns

TRUE if the popup uses a fixed width

Since: 3.0

Types and Values

struct CtkComboBox

struct CtkComboBox;

struct CtkComboBoxClass

struct CtkComboBoxClass {
  CtkBinClass parent_class;

  /* signals */
  void     (* changed)           (CtkComboBox *combo_box);
  gchar   *(* format_entry_text) (CtkComboBox *combo_box,
                                  const gchar *path);
};

Members

changed ()

Signal is emitted when the active item is changed.

 

format_entry_text ()

Signal which allows you to change how the text displayed in a combo box’s entry is displayed.

 

Property Details

The “active” property

  “active”                   int

The item which is currently active. If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this property has the value ctk_tree_path_get_indices (path)[0], where path is the CtkTreePath of the active item.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.4


The “active-id” property

  “active-id”                char *

The value of the ID column of the active row.

Owner: CtkComboBox

Flags: Read / Write

Default value: NULL

Since: 3.0


The “add-tearoffs” property

  “add-tearoffs”             gboolean

The add-tearoffs property controls whether generated menus have tearoff menu items.

Note that this only affects menu style combo boxes.

CtkComboBox:add-tearoffs has been deprecated since version 3.10 and should not be used in newly-written code.

Owner: CtkComboBox

Flags: Read / Write

Default value: FALSE

Since: 2.6


The “button-sensitivity” property

  “button-sensitivity”       CtkSensitivityType

Whether the dropdown button is sensitive when the model is empty.

Owner: CtkComboBox

Flags: Read / Write

Default value: CTK_SENSITIVITY_AUTO

Since: 2.14


The “cell-area” property

  “cell-area”                CtkCellArea *

The CtkCellArea used to layout cell renderers for this combo box.

If no area is specified when creating the combo box with ctk_combo_box_new_with_area() a horizontally oriented CtkCellAreaBox will be used.

Owner: CtkComboBox

Flags: Read / Write / Construct Only

Since: 3.0


The “column-span-column” property

  “column-span-column”       int

If this is set to a non-negative value, it must be the index of a column of type G_TYPE_INT in the model. The value in that column for each item will determine how many columns that item will span in the popup. Therefore, values in this column must be greater than zero, and the sum of an item’s column position + span should not exceed “wrap-width”.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.4


The “entry-text-column” property

  “entry-text-column”        int

The column in the combo box's model to associate with strings from the entry if the combo was created with “has-entry” = TRUE.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.24


The “has-entry” property

  “has-entry”                gboolean

Whether the combo box has an entry.

Owner: CtkComboBox

Flags: Read / Write / Construct Only

Default value: FALSE

Since: 2.24


The “has-frame” property

  “has-frame”                gboolean

The has-frame property controls whether a frame is drawn around the entry.

Owner: CtkComboBox

Flags: Read / Write

Default value: TRUE

Since: 2.6


The “id-column” property

  “id-column”                int

The column in the combo box's model that provides string IDs for the values in the model, if != -1.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 3.0


The “model” property

  “model”                    CtkTreeModel *

The model from which the combo box takes the values shown in the list.

Owner: CtkComboBox

Flags: Read / Write

Since: 2.4


The “popup-fixed-width” property

  “popup-fixed-width”        gboolean

Whether the popup's width should be a fixed width matching the allocated width of the combo box.

Owner: CtkComboBox

Flags: Read / Write

Default value: TRUE

Since: 3.0


The “popup-shown” property

  “popup-shown”              gboolean

Whether the combo boxes dropdown is popped up. Note that this property is mainly useful, because it allows you to connect to notify::popup-shown.

Owner: CtkComboBox

Flags: Read

Default value: FALSE

Since: 2.10


The “row-span-column” property

  “row-span-column”          int

If this is set to a non-negative value, it must be the index of a column of type G_TYPE_INT in the model. The value in that column for each item will determine how many rows that item will span in the popup. Therefore, values in this column must be greater than zero.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 2.4


The “tearoff-title” property

  “tearoff-title”            char *

A title that may be displayed by the window manager when the popup is torn-off.

CtkComboBox:tearoff-title has been deprecated since version 3.10 and should not be used in newly-written code.

Owner: CtkComboBox

Flags: Read / Write

Default value: NULL

Since: 2.10


The “wrap-width” property

  “wrap-width”               int

If wrap-width is set to a positive value, items in the popup will be laid out along multiple columns, starting a new row on reaching the wrap width.

Owner: CtkComboBox

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Since: 2.4

Signal Details

The “changed” signal

void
user_function (CtkComboBox *widget,
               gpointer     user_data)

The changed signal is emitted when the active item is changed. The can be due to the user selecting a different item from the list, or due to a call to ctk_combo_box_set_active_iter(). It will also be emitted while typing into the entry of a combo box with an entry.

Parameters

widget

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.4


The “format-entry-text” signal

char*
user_function (CtkComboBox *combo,
               char        *path,
               gpointer     user_data)

For combo boxes that are created with an entry (See CtkComboBox:has-entry).

A signal which allows you to change how the text displayed in a combo box's entry is displayed.

Connect a signal handler which returns an allocated string representing path . That string will then be used to set the text in the combo box's entry. The default signal handler uses the text from the CtkComboBox::entry-text-column model column.

Here's an example signal handler which fetches data from the model and displays it in the entry.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
static gchar*
format_entry_text_callback (CtkComboBox *combo,
                            const gchar *path,
                            gpointer     user_data)
{
  CtkTreeIter iter;
  CtkTreeModel model;
  gdouble      value;

  model = ctk_combo_box_get_model (combo);

  ctk_tree_model_get_iter_from_string (model, &iter, path);
  ctk_tree_model_get (model, &iter,
                      THE_DOUBLE_VALUE_COLUMN, &value,
                      -1);

  return g_strdup_printf ("%g", value);
}

Parameters

combo

the object which received the signal

 

path

the CtkTreePath string from the combo box's current model to format text for

 

user_data

user data set when the signal handler was connected.

 

Returns

a newly allocated string representing path for the current CtkComboBox model.

[transfer full]

Flags: Run Last

Since: 3.4


The “move-active” signal

void
user_function (CtkComboBox  *widget,
               CtkScrollType scroll_type,
               gpointer      user_data)

The ::move-active signal is a keybinding signal which gets emitted to move the active selection.

Parameters

widget

the object that received the signal

 

scroll_type

a CtkScrollType

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.12


The “popdown” signal

gboolean
user_function (CtkComboBox *button,
               gpointer     user_data)

The ::popdown signal is a keybinding signal which gets emitted to popdown the combo box list.

The default bindings for this signal are Alt+Up and Escape.

Parameters

button

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.12


The “popup” signal

void
user_function (CtkComboBox *widget,
               gpointer     user_data)

The ::popup signal is a keybinding signal which gets emitted to popup the combo box list.

The default binding for this signal is Alt+Down.

Parameters

widget

the object that received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.12

See Also

CtkComboBoxText, CtkTreeModel, CtkCellRenderer