Package: gtk

Class gtk-combo-box-text

Superclasses

Documented Subclasses

None

Direct Slots

None

Details

A gtk-combo-box-text is a simple variant of gtk-combo-box that hides the model-view complexity for simple text-only use cases.

To create a gtk-combo-box-text, use the gtk-combo-box-text-new or gtk-combo-box-text-new-with-entry functions.

You can add items to a gtk-combo-box-text with the gtk-combo-box-text-append-text, gtk-combo-box-text-insert-text or gtk-combo-box-text-prepend-text functions and remove options with the gtk-combo-box-text-remove function.

If the gtk-combo-box-text contains an entry via the has-entry property, its contents can be retrieved using the gtk-combo-box-text-get-active-text function. The entry itself can be accessed by calling the gtk-bin-get-child function on the combo box.

You should not call the gtk-combo-box-model slot access function or attempt to pack more cells into this combo box via its gtk-cell-layout interface.

GtkComboBoxText as GtkBuildable

The gtk-combo-box-text implementation of the gtk-buildable interface supports adding items directly using the <items> element and specifying <item> elements for each item. Each <item> element supports the regular translation attributes "translatable", "context" and "comments".

Example: A UI definition fragment specifying gtk-combo-box-text items
 <object class="GtkComboBoxText">
   <items>
     <item translatable="yes">Factory</item>
     <item translatable="yes">Home</item>
     <item translatable="yes">Subway</item>
   </items>
 </object>    

CSS nodes

 combobox
 ╰── box.linked
     ├── entry.combo
     ├── button.combo
     ╰── window.popup    
gtk-combo-box-text has a single CSS node with name combobox. It adds the style class .combo to the main CSS nodes of its entry and button children, and the .linked class to the node of its internal box.
 

Inherited Slot Access Functions

See also

2013-8-15