Index

Package: Combo_Box

Description

package Gtk.Combo_Box is

A Gtk_Combo_Box is a widget that allows the user to choose from a list of valid choices. The Gtk_Combo_Box displays the selected choice. When activated, the Gtk_Combo_Box displays a popup which allows the user to make 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 Gtk_Option_Menu, or similar to a Windows-style combo box.

Unlike its predecessors Gtk.Combo.Gtk_Combo and Gtk.Option_Menu.Gtk_Option_Menu, the Gtk_Combo_Box 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 Gtk_Combo_Box implements the Gtk_Cell_Layout 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.

In addition to the model-view API, Gtk_Combo_Box offers a simple API which is suitable for text-only combo boxes, and hides the complexity of managing the data in a model.

Binding from C File version 2.16.6

<see>Gtk.Combo_Box_Entry</see>

Screenshot

gtk-combo_box.png

Packages

Implements_Cell_Layout (new Glib.Types.Implements)

Implements_Cell_Editable (new Glib.Types.Implements)

Classes

Gtk_Combo_Box_Record

type Gtk_Combo_Box_Record is new Gtk.Bin.Gtk_Bin_Record with null record;

Ancestors:

Immediate Children:

Primitive operations:

Get_Active_Iter
Get_Active_Text
Get_Add_Tearoffs
Get_Button_Sensitivity
Get_Column_Span_Column
Get_Entry_Text_Column
Get_Focus_On_Click
Get_Has_Entry
Get_Row_Separator_Func
Get_Row_Span_Column
Get_Wrap_Width
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)
Gtk.Bin.Get_Child (Inherited)
Gtk.Container.Add (Inherited)
Gtk.Container.Check_Resize (Inherited)
Gtk.Container.Child_Get_Property (Inherited)
Gtk.Container.Child_Set_Property (Inherited)
Gtk.Container.Child_Type (Inherited)
Gtk.Container.Forall (Inherited)
Gtk.Container.Foreach (Inherited)
Gtk.Container.Get_Border_Width (Inherited)
Gtk.Container.Get_Children (Inherited)
Gtk.Container.Get_Focus_Chain (Inherited)
Gtk.Container.Get_Focus_Child (Inherited)
Gtk.Container.Get_Focus_Hadjustment (Inherited)
Gtk.Container.Get_Focus_Vadjustment (Inherited)
Gtk.Container.Get_Resize_Mode (Inherited)
Gtk.Container.Propagate_Expose (Inherited)
Gtk.Container.Remove (Inherited)
Gtk.Container.Resize_Children (Inherited)
Gtk.Container.Set_Border_Width (Inherited)
Gtk.Container.Set_Focus_Chain (Inherited)
Gtk.Container.Set_Focus_Child (Inherited)
Gtk.Container.Set_Focus_Hadjustment (Inherited)
Gtk.Container.Set_Focus_Vadjustment (Inherited)
Gtk.Container.Set_Reallocate_Redraws (Inherited)
Gtk.Container.Set_Resize_Mode (Inherited)
Gtk.Container.Unset_Focus_Chain (Inherited)
Gtk.Widget.Activate (Inherited)
Gtk.Widget.Add_Accelerator (Inherited)
Gtk.Widget.Add_Events (Inherited)
Gtk.Widget.Add_Mnemonic_Label (Inherited)
Gtk.Widget.Can_Activate_Accel (Inherited)
Gtk.Widget.Child_Notify (Inherited)
Gtk.Widget.Class_Path (Inherited)
Gtk.Widget.Class_Path_Reversed (Inherited)
Gtk.Widget.Create_Pango_Context (Inherited)
Gtk.Widget.Create_Pango_Layout (Inherited)
Gtk.Widget.Destroy (Inherited)
Gtk.Widget.Draw (Inherited)
Gtk.Widget.Ensure_Style (Inherited)
Gtk.Widget.Error_Bell (Inherited)
Gtk.Widget.Flag_Is_Set (Inherited)
Gtk.Widget.Flags (Inherited)
Gtk.Widget.Freeze_Child_Notify (Inherited)
Gtk.Widget.Get_Allocation_Height (Inherited)
Gtk.Widget.Get_Allocation_Width (Inherited)
Gtk.Widget.Get_Allocation_X (Inherited)
Gtk.Widget.Get_Allocation_Y (Inherited)
Gtk.Widget.Get_Ancestor (Inherited)
Gtk.Widget.Get_Child_Requisition (Inherited)
Gtk.Widget.Get_Child_Visible (Inherited)
Gtk.Widget.Get_Colormap (Inherited)
Gtk.Widget.Get_Composite_Name (Inherited)
Gtk.Widget.Get_Direction (Inherited)
Gtk.Widget.Get_Events (Inherited)
Gtk.Widget.Get_Extension_Events (Inherited)
Gtk.Widget.Get_Has_Tooltip (Inherited)
Gtk.Widget.Get_Name (Inherited)
Gtk.Widget.Get_No_Show_All (Inherited)
Gtk.Widget.Get_Pango_Context (Inherited)
Gtk.Widget.Get_Parent (Inherited)
Gtk.Widget.Get_Parent_Window (Inherited)
Gtk.Widget.Get_Pointer (Inherited)
Gtk.Widget.Get_Root_Window (Inherited)
Gtk.Widget.Get_Size_Request (Inherited)
Gtk.Widget.Get_Snapshot (Inherited)
Gtk.Widget.Get_State (Inherited)
Gtk.Widget.Get_Style (Inherited)
Gtk.Widget.Get_Tooltip_Markup (Inherited)
Gtk.Widget.Get_Tooltip_Text (Inherited)
Gtk.Widget.Get_Tooltip_Window (Inherited)
Gtk.Widget.Get_Toplevel (Inherited)
Gtk.Widget.Get_Visual (Inherited)
Gtk.Widget.Get_Window (Inherited)
Gtk.Widget.Grab_Default (Inherited)
Gtk.Widget.Grab_Focus (Inherited)
Gtk.Widget.Has_Screen (Inherited)
Gtk.Widget.Hide (Inherited)
Gtk.Widget.Hide_All (Inherited)
Gtk.Widget.Input_Shape_Combine_Mask (Inherited)
Gtk.Widget.Intersect (Inherited)
Gtk.Widget.Is_Ancestor (Inherited)
Gtk.Widget.Is_Composited (Inherited)
Gtk.Widget.Is_Focus (Inherited)
Gtk.Widget.Keynav_Failed (Inherited)
Gtk.Widget.List_Mnemonic_Labels (Inherited)
Gtk.Widget.Map (Inherited)
Gtk.Widget.Mnemonic_Activate (Inherited)
Gtk.Widget.Modify_Base (Inherited)
Gtk.Widget.Modify_Bg (Inherited)
Gtk.Widget.Modify_Cursor (Inherited)
Gtk.Widget.Modify_Fg (Inherited)
Gtk.Widget.Modify_Font (Inherited)
Gtk.Widget.Modify_Text (Inherited)
Gtk.Widget.Path (Inherited)
Gtk.Widget.Path_Reversed (Inherited)
Gtk.Widget.Queue_Clear (Inherited)
Gtk.Widget.Queue_Clear_Area (Inherited)
Gtk.Widget.Queue_Draw (Inherited)
Gtk.Widget.Queue_Draw_Area (Inherited)
Gtk.Widget.Queue_Resize (Inherited)
Gtk.Widget.Queue_Resize_No_Redraw (Inherited)
Gtk.Widget.Realize (Inherited)
Gtk.Widget.Region_Intersect (Inherited)
Gtk.Widget.Remove_Accelerator (Inherited)
Gtk.Widget.Remove_Mnemonic_Label (Inherited)
Gtk.Widget.Render_Icon (Inherited)
Gtk.Widget.Reparent (Inherited)
Gtk.Widget.Reset_Rc_Styles (Inherited)
Gtk.Widget.Reset_Shapes (Inherited)
Gtk.Widget.Restore_Default_Style (Inherited)
Gtk.Widget.Send_Expose (Inherited)
Gtk.Widget.Set_Accel_Path (Inherited)
Gtk.Widget.Set_App_Paintable (Inherited)
Gtk.Widget.Set_Child_Visible (Inherited)
Gtk.Widget.Set_Colormap (Inherited)
Gtk.Widget.Set_Composite_Name (Inherited)
Gtk.Widget.Set_Direction (Inherited)
Gtk.Widget.Set_Double_Buffered (Inherited)
Gtk.Widget.Set_Events (Inherited)
Gtk.Widget.Set_Extension_Events (Inherited)
Gtk.Widget.Set_Flags (Inherited)
Gtk.Widget.Set_Has_Tooltip (Inherited)
Gtk.Widget.Set_Name (Inherited)
Gtk.Widget.Set_No_Show_All (Inherited)
Gtk.Widget.Set_Parent (Inherited)
Gtk.Widget.Set_Parent_Window (Inherited)
Gtk.Widget.Set_Redraw_On_Allocate (Inherited)
Gtk.Widget.Set_Scroll_Adjustments (Inherited)
Gtk.Widget.Set_Sensitive (Inherited)
Gtk.Widget.Set_Size_Request (Inherited)
Gtk.Widget.Set_State (Inherited)
Gtk.Widget.Set_Style (Inherited)
Gtk.Widget.Set_Tooltip_Markup (Inherited)
Gtk.Widget.Set_Tooltip_Text (Inherited)
Gtk.Widget.Set_Tooltip_Window (Inherited)
Gtk.Widget.Set_UPosition (Inherited)
Gtk.Widget.Set_USize (Inherited)
Gtk.Widget.Set_Window (Inherited)
Gtk.Widget.Shape_Combine_Mask (Inherited)
Gtk.Widget.Show (Inherited)
Gtk.Widget.Show_All (Inherited)
Gtk.Widget.Show_Now (Inherited)
Gtk.Widget.Size_Allocate (Inherited)
Gtk.Widget.Size_Request (Inherited)
Gtk.Widget.Style_Get_Property (Inherited)
Gtk.Widget.Thaw_Child_Notify (Inherited)
Gtk.Widget.Trigger_Tooltip_Query (Inherited)
Gtk.Widget.Unmap (Inherited)
Gtk.Widget.Unrealize (Inherited)
Gtk.Widget.Unset_Flags (Inherited)
Prepend_Text
Set_Active_Iter
Set_Add_Tearoffs
Set_Button_Sensitivity
Set_Column_Span_Column
Set_Entry_Text_Column
Set_Focus_On_Click
Set_Row_Separator_Func
Set_Row_Span_Column
Set_Wrap_Width

Types

Gtk_Combo_Box

type Gtk_Combo_Box is access all Gtk_Combo_Box_Record'Class;

Constants & Global variables

Add_Tearoffs_Property (Glib.Properties.Property_Boolean)

Add_Tearoffs_Property       : constant Glib.Properties.Property_Boolean;

Button_Sensitivity_Property (Glib.Properties.Property_Enum)

Button_Sensitivity_Property : constant Glib.Properties.Property_Enum;

Column_Span_Column_Property (Glib.Properties.Property_Int)

Column_Span_Column_Property : constant Glib.Properties.Property_Int;

Focus_On_Click_Property (Glib.Properties.Property_Boolean)

Focus_On_Click_Property     : constant Glib.Properties.Property_Boolean;

Popup_Shown_Property (Glib.Properties.Property_Boolean)

Popup_Shown_Property        : constant Glib.Properties.Property_Boolean;

Row_Span_Column_Property (Glib.Properties.Property_Int)

Row_Span_Column_Property    : constant Glib.Properties.Property_Int;

Tearoff_Title_Property (Glib.Properties.Property_String)

Tearoff_Title_Property      : constant Glib.Properties.Property_String;

Wrap_Width_Property (Glib.Properties.Property_Int)

Wrap_Width_Property         : constant Glib.Properties.Property_Int;

Appears_As_List_Property (Glib.Properties.Property_Boolean)

Appears_As_List_Property : constant Glib.Properties.Property_Boolean;

Arrow_Size_Property (Glib.Properties.Property_Int)

Arrow_Size_Property      : constant Glib.Properties.Property_Int;

Shadow_Type_Property (Glib.Properties.Property_Enum)

Shadow_Type_Property     : constant Glib.Properties.Property_Enum;

Signal_Changed (Glib.Signal_Name)

Signal_Changed : constant Glib.Signal_Name := "changed";

Subprograms & Entries

Gtk_New

procedure Gtk_New    
(Combo: out Gtk_Combo_Box);

Initialize

procedure Initialize 
(Combo: access Gtk_Combo_Box_Record'Class);
Creates or initializes a new empty combo

Gtk_New_With_Model

procedure Gtk_New_With_Model 
(Combo: out Gtk_Combo_Box;
Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class);

Initialize_With_Model

procedure Initialize_With_Model 
(Combo: access Gtk_Combo_Box_Record'Class;
Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class);
Creates or initializes a new combo initializes to Model.

Gtk_New_With_Entry

procedure Gtk_New_With_Entry 
(Combo: out Gtk_Combo_Box);

Initialize_With_Entry

procedure Initialize_With_Entry 
(Combo: access Gtk_Combo_Box_Record'Class);
Creates or initializes a new combo with entry

Gtk_New_With_Model_And_Entry

procedure Gtk_New_With_Model_And_Entry 
(Combo: out Gtk_Combo_Box;
Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class);

Initialize_With_Model_And_Entry

procedure Initialize_With_Model_And_Entry 
(Combo: access Gtk_Combo_Box_Record'Class;
Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class);
Creates or initializes a new combo with entry, initialized with Model

Get_Type

function Get_Type return Glib.GType;
Returns the internal value used for Gtk_Combo_Box widgets

Set_Model

procedure Set_Model 
(Combo_Box: access Gtk_Combo_Box_Record;
Model: Gtk.Tree_Model.Gtk_Tree_Model := null);

Get_Model

function Get_Model 
(Combo_Box: access Gtk_Combo_Box_Record) return Gtk.Tree_Model.Gtk_Tree_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 Gtk.Cell_Layout.Clear yourself if you need to set up different cell renderers for the new model.

Set_Active

procedure Set_Active 
(Combo_Box: access Gtk_Combo_Box_Record;
Index: Gint);

Get_Active

function Get_Active 
(Combo_Box: access Gtk_Combo_Box_Record) return Gint;
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 Gtk.Tree_Model.Get_Indices (Path)[0], where Path is the Gtk_Tree_Path of the active model.

Set_Active_Iter

procedure Set_Active_Iter 
(Combo_Box: access Gtk_Combo_Box_Record;
Iter: Gtk.Tree_Model.Gtk_Tree_Iter);

Get_Active_Iter

function Get_Active_Iter 
(Combo_Box: access Gtk_Combo_Box_Record) return Gtk.Tree_Model.Gtk_Tree_Iter;
Sets the current active item to be the one referenced by Iter. Iter must correspond to a path of depth one.

Set_Wrap_Width

procedure Set_Wrap_Width 
(Combo_Box: access Gtk_Combo_Box_Record;
Width: Gint);

Get_Wrap_Width

function Get_Wrap_Width 
(Combo_Box: access Gtk_Combo_Box_Record) return Gint;
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. This can be used for instance to display a matrix of color (a color palette to choose from). See also Set_Column_Span_Column

Set_Add_Tearoffs

procedure Set_Add_Tearoffs 
(Combo_Box: access Gtk_Combo_Box_Record;
Add_Tearoffs: Boolean);

Get_Add_Tearoffs

function Get_Add_Tearoffs 
(Combo_Box: access Gtk_Combo_Box_Record) return Boolean;
Sets whether the popup menu should have a tearoff menu item. Clicking on this menu will detach the combo into a floating window that the user can put anywhere on the screen.

Set_Button_Sensitivity

procedure Set_Button_Sensitivity 
(Combo_Box: access Gtk_Combo_Box_Record;
Sensitivity: Gtk.Enums.Gtk_Sensitivity_Type);

Get_Button_Sensitivity

function Get_Button_Sensitivity 
(Combo_Box: access Gtk_Combo_Box_Record) return Gtk.Enums.Gtk_Sensitivity_Type;
Sets whether the dropdown button of the combo box should be always sensitive (Gtk_Sensitivity_On), never sensitive (Gtk_Sensitivity_Off) or only if there is at least one item to display (Gtk_Sensitivity_Auto).

Get_Has_Entry

function Get_Has_Entry 
(Combo_Box: access Gtk_Combo_Box_Record) return Boolean;
Returns whether the combo box has an entry

Set_Entry_Text_Column

procedure Set_Entry_Text_Column 
(Combo_Box: access Gtk_Combo_Box_Record;
Text_Column: Gint);
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.

Get_Entry_Text_Column

function Get_Entry_Text_Column 
(Combo_Box: access Gtk_Combo_Box_Record) return Gint;
Returns the column which combo_box is using to get the strings from to display in the internal entry.

Set_Column_Span_Column

procedure Set_Column_Span_Column 
(Combo_Box: access Gtk_Combo_Box_Record;
Column_Span: Gint);

Get_Column_Span_Column

function Get_Column_Span_Column 
(Combo_Box: access Gtk_Combo_Box_Record) return Gint;
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. This applies to grid combos, see also Set_Wrap_Width.

Set_Row_Span_Column

procedure Set_Row_Span_Column 
(Combo_Box: access Gtk_Combo_Box_Record;
Row_Span: Gint);

Get_Row_Span_Column

function Get_Row_Span_Column 
(Combo_Box: access Gtk_Combo_Box_Record) return Gint;
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.

Set_Focus_On_Click

procedure Set_Focus_On_Click 
(Combo: access Gtk_Combo_Box_Record;
Focus_On_Click: Boolean);

Get_Focus_On_Click

function Get_Focus_On_Click 
(Combo: access Gtk_Combo_Box_Record) return Boolean;
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.

Set_Row_Separator_Func

procedure Set_Row_Separator_Func 
(Combo_Box: access Gtk_Combo_Box_Record;
Func: Gtk.Tree_View.Gtk_Tree_View_Row_Separator_Func;
Data: System.Address;
Destroy: Glib.G_Destroy_Notify_Address := null);

Get_Row_Separator_Func

function Get_Row_Separator_Func 
(Combo_Box: access Gtk_Combo_Box_Record) return Gtk.Tree_View.Gtk_Tree_View_Row_Separator_Func;
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.

Set_Title

procedure Set_Title 
(Combo_Box: access Gtk_Combo_Box_Record;
Title: String);

Get_Title

function Get_Title 
(Combo_Box: access Gtk_Combo_Box_Record) return String;
Sets or Gets the menu's title in tearoff mode.

Gtk_New_Text

procedure Gtk_New_Text    
(Combo: out Gtk_Combo_Box);

Initialize_Text

procedure Initialize_Text 
(Combo: access Gtk_Combo_Box_Record'Class);
Convenience function which constructs a new text combo box, which is Gtk_Combo_Box just displaying strings. If you use this function to create a text combo box, you should only manipulate its data source with the following convenience functions: Append_Text, Insert_Text, Prepend_Text and Remove_Text

Append_Text

procedure Append_Text 
(Combo_Box: access Gtk_Combo_Box_Record;
Text: String);

Prepend_Text

procedure Prepend_Text 
(Combo_Box: access Gtk_Combo_Box_Record;
Text: String);

Insert_Text

procedure Insert_Text 
(Combo_Box: access Gtk_Combo_Box_Record;
Position: Gint;
Text: String);
Adds Text to the list of strings stored in Combo_Box. Note that you can only use this function with combo boxes constructed with Gtk_New_Text.

Remove_Text

procedure Remove_Text 
(Combo_Box: access Gtk_Combo_Box_Record;
Position: Gint);
Removes the string at Position from Combo_Box. Note that you can only use this function with combo boxes constructed with Gtk_New_Text.

Get_Active_Text

function Get_Active_Text 
(Combo_Box: access Gtk_Combo_Box_Record) return String;
Returns the currently active string in Combo_Box or "" if none is selected. Note that you can only use this function with combo boxes constructed with Gtk_New_Text.

Popdown

procedure Popdown 
(Combo_Box: access Gtk_Combo_Box_Record);

Popup

procedure Popup   
(Combo_Box: access Gtk_Combo_Box_Record);
Hides or 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.

-

Converts to and from the Gtk_Cell_Layout interface

-

Converts to and from the Gtk_Cell_Editable interface