Hildon Reference Manual | ||||
---|---|---|---|---|
HildonPickerButtonHildonPickerButton — A button that launches a HildonPickerDialog and displays the selected item |
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);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkButton +----HildonButton +----HildonPickerButton +----HildonDateButton +----HildonTimeButton
"done-button-text" gchar* : Read / Write "touch-selector" HildonTouchSelector* : Read / Write
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; }
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
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
HildonTouchSelector* hildon_picker_button_get_selector (HildonPickerButton *button);
Retrieves the HildonTouchSelector associated to button
.
button : |
a HildonPickerButton |
Returns : | a HildonTouchSelector |
Since 2.2
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
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
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
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
void hildon_picker_button_value_changed (HildonPickerButton *button);
Emits a ""value-changed"" signal to the given HildonPickerButton
button : |
a HildonPickerButton |
Since 2.2
"done-button-text"
property"done-button-text" gchar* : Read / Write
The text for the "done" button in the dialog launched.
Default value: NULL
"touch-selector"
property"touch-selector" HildonTouchSelector* : Read / Write
HildonTouchSelector widget to be launched on button clicked.
"value-changed"
signalvoid 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