2 * This file is a part of hildon
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser Public License as published by
8 * the Free Software Foundation; version 2 of the license.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser Public License for more details.
20 #include "hildon-program.h"
21 #include "hildon-stackable-window.h"
23 #include "hildon-picker-button.h"
24 #include "hildon-touch-selector.h"
27 on_picker_value_changed (HildonPickerButton * button, gpointer data)
29 g_print ("Newly selected value: %s\n",
30 hildon_button_get_value (HILDON_BUTTON (button)));
34 main (int argc, char **args)
36 HildonProgram *program = NULL;
37 GtkWidget *window = NULL;
41 gtk_init (&argc, &args);
43 program = hildon_program_get_instance ();
44 g_set_application_name ("hildon-picker-button-example");
46 window = hildon_stackable_window_new ();
47 gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
48 hildon_program_add_window (program, HILDON_WINDOW (window));
50 button = hildon_picker_button_new (HILDON_BUTTON_WITH_VERTICAL_VALUE);
51 selector = hildon_touch_selector_new_text ();
52 hildon_button_set_title (HILDON_BUTTON (button), "Continent");
54 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "America");
55 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Europe");
56 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Asia");
57 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), "Africa");
58 hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector),
61 hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
62 HILDON_TOUCH_SELECTOR (selector));
64 g_signal_connect (G_OBJECT (button), "value-changed",
65 G_CALLBACK (on_picker_value_changed), NULL);
67 gtk_container_add (GTK_CONTAINER (window), button);
69 g_signal_connect (G_OBJECT (window), "delete-event",
70 G_CALLBACK (gtk_main_quit), NULL);
72 gtk_widget_show_all (window);