HildonPickerButton

HildonPickerButton — A button that launches a HildonPickerDialog and displays the selected item

Synopsis

                    HildonPickerButton;
GtkWidget*          hildon_picker_button_new            (HildonSizeType size,
                                                         HildonButtonArrangement arrangement);
void                hildon_picker_button_set_selector   (HildonPickerButton *button,
                                                         HildonTouchSelector *selector);
HildonTouchSelector* hildon_picker_button_get_selector  (HildonPickerButton *button);
void                hildon_picker_button_set_active     (HildonPickerButton *button,
                                                         gint index);
gint                hildon_picker_button_get_active     (HildonPickerButton *button);
const gchar*        hildon_picker_button_get_done_button_text
                                                        (HildonPickerButton *button);
void                hildon_picker_button_set_done_button_text
                                                        (HildonPickerButton *button,
                                                         const gchar *done_button_text);
void                hildon_picker_button_value_changed  (HildonPickerButton *button);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkButton
                                       +----HildonButton
                                             +----HildonPickerButton
                                                   +----HildonDateButton
                                                   +----HildonTimeButton

Implemented Interfaces

HildonPickerButton implements AtkImplementorIface and GtkBuildable.

Properties

  "done-button-text"         gchar*                : Read / Write
  "touch-selector"           HildonTouchSelector*  : Read / Write

Signals

  "value-changed"                                  : Run Last / Action

Description

HildonPickerButton is a widget that lets the user select a particular item from a list. Visually, it's a button with title and value labels that brings up a HildonPickerDialog. The user can then use this dialog to choose an item, which will be displayed in the value label of the button. The title of the dialog is taken from the button's main label (see hildon_button_get_title()).

You should create your own HildonTouchSelector at convenience and set it to the HildonPickerButton with hildon_picker_button_set_selector(). For the common use cases of buttons to select date and time, you can use HildonDateButton and HildonTimeButton.

Example 7. 

GtkWidget *
create_selector (void)
{
  GtkWidget *selector;

  selector = hildon_touch_selector_new_text ();

  hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "America");
  hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Europe");
  hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Asia");
  hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Africa");
  hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Australia");

  hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 2);

  return selector;
}

GtkWidget *
create_button (HildonTouchSelector *selector)
{
  GtkWidget *button;

  button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
  hildon_button_set_title (HILDON_BUTTON (button), "Continent");

  hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
                                     HILDON_TOUCH_SELECTOR (selector));

  return button;
}


Details

HildonPickerButton

typedef struct _HildonPickerButton HildonPickerButton;


hildon_picker_button_new ()

GtkWidget*          hildon_picker_button_new            (HildonSizeType size,
                                                         HildonButtonArrangement arrangement);

Creates a new HildonPickerButton. See hildon_button_new() for details on the parameters.

size : One of HildonSizeType, specifying the size of the new button.
arrangement : one of HildonButtonArrangement, specifying the placement of the labels.
Returns : a newly created HildonPickerButton

Since 2.2


hildon_picker_button_set_selector ()

void                hildon_picker_button_set_selector   (HildonPickerButton *button,
                                                         HildonTouchSelector *selector);

Sets selector as the HildonTouchSelector to be shown in the HildonPickerDialog that button brings up.

button : a HildonPickerButton
selector : a HildonTouchSelector

Since 2.2


hildon_picker_button_get_selector ()

HildonTouchSelector* hildon_picker_button_get_selector  (HildonPickerButton *button);

Retrieves the HildonTouchSelector associated to button.

button : a HildonPickerButton
Returns : a HildonTouchSelector

Since 2.2


hildon_picker_button_set_active ()

void                hildon_picker_button_set_active     (HildonPickerButton *button,
                                                         gint index);

Sets the active item of the HildonTouchSelector associated to button to index. If the selector has several columns, only the first one is used.

button : a HildonPickerButton
index : the index of the item to select, or -1 to have no active item

Since 2.2


hildon_picker_button_get_active ()

gint                hildon_picker_button_get_active     (HildonPickerButton *button);

Returns the index of the currently active item, or -1 if there's no active item. If the selector has several columns, only the first one is used.

button : a HildonPickerButton
Returns : an integer which is the index of the currently active item, or -1 if there's no active item.

Since 2.2


hildon_picker_button_get_done_button_text ()

const gchar*        hildon_picker_button_get_done_button_text
                                                        (HildonPickerButton *button);

Gets the text used in the HildonPickerDialog that is launched by button. If no custom text is set, then NULL is returned.

button : a HildonPickerButton
Returns : the custom string to be used, or NULL if the default "done-button-text" is to be used.

Since 2.2


hildon_picker_button_set_done_button_text ()

void                hildon_picker_button_set_done_button_text
                                                        (HildonPickerButton *button,
                                                         const gchar *done_button_text);

Sets a custom string to be used in the "done" button in HildonPickerDialog. If unset, the default HildonPickerButton::done-button-text property value will be used.

button : a HildonPickerButton
done_button_text : a string

Since 2.2


hildon_picker_button_value_changed ()

void                hildon_picker_button_value_changed  (HildonPickerButton *button);

Emits a ""value-changed"" signal to the given HildonPickerButton

button : a HildonPickerButton

Since 2.2

Property Details

The "done-button-text" property

  "done-button-text"         gchar*                : Read / Write

The text for the "done" button in the dialog launched.

Default value: NULL


The "touch-selector" property

  "touch-selector"           HildonTouchSelector*  : Read / Write

HildonTouchSelector widget to be launched on button clicked.

Signal Details

The "value-changed" signal

void                user_function                      (HildonPickerButton *widget,
                                                        gpointer            user_data)      : Run Last / Action

The ::value-changed signal is emitted each time the user chooses a different item from the HildonTouchSelector related, and the value label gets updated.

widget : the widget that received the signal
user_data : user data set when the signal handler was connected.

Since 2.2

See Also

HildonTouchSelector, HildonPickerDialog