Reference Manual

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

# Inti::Gtk::Combo Class Reference

A GtkCombo C++ wrapper class. More...

`#include <inti/gtk/combo.h>`

Inheritance diagram for Inti::Gtk::Combo:

List of all members.

## Public Member Functions

Constructors

- Combo ()
    Construct a new Combo.
- virtual ~Combo ()
    Destructor.

Accessors

- GtkCombo * gtk_combo () const
    Get a pointer to the GtkCombo structure.
- GtkComboClass * gtk_combo_class () const
    Get a pointer to the GtkComboClass structure.
- operator GtkCombo * () const
    Conversion operator; safely converts a Combo to a GtkCombo pointer.
- Entry * entry () const
    Returns the Entry widget that displays the selected text entry.
- Widget * list () const
    Returns the drop down list as a Gtk::Widget because GtkList and GtkListItem are deprecated and not wrapped in Inti.

Methods

- void set_value_in_list (bool value_in_list, bool ok_if_empty)
    Specifies whether the value entered in the text entry field must match one of the values in the list.
- void set_use_arrows (bool use_arrows)
    Specifies if the arrow (cursor) keys can be used to step through the items in the list; this is on by default.
- void set_use_arrows_always (bool use_arrows_always)
    Specifies if the arrow keys will still work even if the current contents of the Entry field do not match any of the list items.
- void set_case_sensitive (bool case_sensitive)
    Specifies whether the text entered into the Entry field and the text in the list items is case sensitive.
- void set_item_string (Item &item, const String &item_value)
    Sets the string to place in the Entry field when a particular list item is selected.
- void set_popdown_strings (const std::vector< String > &strings)
    Convenience method to set all of the items in the popup list.
- void disable_activate ()
    Stops the Combo widget from showing the popup list when the Entry emits the "activate" signal, i.e.

Property Proxies

- const EnableArrowKeysPropertyProxy prop_enable_arrow_keys ()
    Whether the arrow keys move through the list of items (bool : Read / Write).
- const EnableArrowsAlwaysPropertyProxy prop_enable_arrows_always ()
    Whether the arrow keys work, even if the entry contents are not in the list (bool : Read / Write).
- const CaseSensitivePropertyProxy prop_case_sensitive ()
    Whether list item matching is case sensitive (bool : Read / Write).
- const AllowEmptyPropertyProxy prop_allow_empty ()
    Whether an empty value may be entered in this field (bool : Read / Write).
- const ValueInListPropertyProxy prop_value_in_list ()
    Whether entered values must already be present in the list (bool : Read / Write).

## Protected Member Functions

Constructors

- Combo (GtkCombo *combo, bool reference=false)
    Construct a new Combo from an existing GtkCombo.

## Detailed Description

A GtkCombo C++ wrapper class.

The Combo widget consists of a single-line text entry field and a drop-down list. The drop-down list is displayed when the user clicks on a small arrow button to the right of the entry field. The drop-down list is a GtkList widget and can be accessed as a Widget not a List, using the list() method of the Combo. The GtkList widget is deprecated and not wrapped in Inti. GtkList elements can contain arbitrary widgets, but if an element is not a plain label, then you must use the gtk_list_set_item_string() function. This sets the string which will be placed in the text entry field when the item is selected.

By default, the user can step through the items in the list using the arrow (cursor) keys, though this behaviour can be turned off with set_use_arrows(). Normally the arrow keys are only active when the contents of the text entry field matches one of the items in the list. If the contents of the entry field do not match any of the list items, then pressing the arrow keys does nothing. However, by calling set_use_arrows_always() you can specify that the arrow keys are always active. If the contents of the entry field does not match any of the items in the list, then pressing the up or down arrow key will set the entry field to the last or first item in the list, respectively.

Example: Creating a Combo widget with simple text items.

        std::vector<String> items;
        items.push_back("First Item");
        items.push_back("Second Item");
        items.push_back("Third Item");
        items.push_back("Fourth Item");
        items.push_back("Fifth Item");

        Gtk::Combo *combo = new Gtk::Combo;
        combo->set_popdown_strings(items);
        add(*combo);

## Constructor & Destructor Documentation

Inti::Gtk::Combo::Combo | ( | GtkCombo * | combo,
|  | bool | reference = false
| ) | `[explicit, protected]`

  | Construct a new Combo from an existing GtkCombo. Parameters:
  combo | A pointer to a GtkCombo.
  reference | Set false if the initial reference count is floating, set true if it's not.
The combo can be a newly created GtkCombo or an existing GtkCombo. (see G::Object::Object).

## Member Function Documentation

void Inti::Gtk::Combo::disable_activate | ( |  | ) |

| Stops the Combo widget from showing the popup list when the Entry emits the "activate" signal, i.e. when the Return key is pressed. This may be useful if, for example, you want the Return key to close a dialog instead.

void Inti::Gtk::Combo::set_case_sensitive | ( | bool | case_sensitive | ) |

  | Specifies whether the text entered into the Entry field and the text in the list items is case sensitive. Parameters:
  case_sensitive | true if the text in the list items is case sensitive.
This may be useful, for example, when you have called set_value_in_list() to limit the values entered, but you are not worried about differences in case.

void Inti::Gtk::Combo::set_item_string | ( | Item & | item,
|  | const String & | item_value
| ) |

  | Sets the string to place in the Entry field when a particular list item is selected. Parameters:
  item | A Gtk::Item.
  item_value | The string to place in the Entry when item is selected.
Call this method if the list item is not a simple label or you want a different value displayed in the entry.

void Inti::Gtk::Combo::set_popdown_strings | ( | const std::vector< String > & | strings | ) |

  | Convenience method to set all of the items in the popup list. (See the example above.) Parameters:
  strings | A vector of Strings.

void Inti::Gtk::Combo::set_use_arrows | ( | bool | use_arrows | ) |

  | Specifies if the arrow (cursor) keys can be used to step through the items in the list; this is on by default. Parameters:
  use_arrows | true if the arrow keys can be used to step through the list items.

void Inti::Gtk::Combo::set_use_arrows_always | ( | bool | use_arrows_always | ) |

  | Specifies if the arrow keys will still work even if the current contents of the Entry field do not match any of the list items. Parameters:
  use_arrows_always | true if the arrow keys should still work.

void Inti::Gtk::Combo::set_value_in_list | ( | bool | value_in_list,
|  | bool | ok_if_empty
| ) |

  | Specifies whether the value entered in the text entry field must match one of the values in the list. Parameters:
  value_in_list | true if the value entered must match one of the values in the list.
  ok_if_empty | true if an empty value is considered valid.
If this is set then the user will not be able to perform any other action until a valid value has been entered. If an empty field is acceptable, the ok_if_empty parameter should be true.

The documentation for this class was generated from the following file:

- combo.h

Main Page - Footer