diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-06-22 21:46:28 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-06-22 21:46:28 +0000 |
commit | 217df92d8936b397884c72a2f5f3419f0c4a165f (patch) | |
tree | 86be1f8bf76bf893bcca5c0a9f366292c887acc5 /tests/test7/test7.c | |
parent | 46c20d816ed8db6c9a49cb0ff0ff521c37633afa (diff) | |
download | 2012-violon-leds-217df92d8936b397884c72a2f5f3419f0c4a165f.tar.gz 2012-violon-leds-217df92d8936b397884c72a2f5f3419f0c4a165f.tar.bz2 2012-violon-leds-217df92d8936b397884c72a2f5f3419f0c4a165f.zip |
Version avec des ToggleButons (qui sont en fait des radiobuttons) qui marche
Reste à intégrer mes GtkProgressBar...
git-svn-id: file:///var/svn/2012-violon-leds/trunk@27 6be1fa4d-33ac-4c33-becc-79fcb3794bb6
Diffstat (limited to 'tests/test7/test7.c')
-rw-r--r-- | tests/test7/test7.c | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/tests/test7/test7.c b/tests/test7/test7.c index 158ead2..7f557ca 100644 --- a/tests/test7/test7.c +++ b/tests/test7/test7.c @@ -6,6 +6,12 @@ GtkBuilder *builder=NULL; GtkToggleButton *buttons[FUNC_COUNT]={NULL}; +// Applicative actions +void switch_to_func(gint func_id) { + printf("switch_to_func(%i)\n", func_id); +} + +// GUI events void on_win_main_destroy(GtkObject *object, gpointer user_data) { gtk_main_quit(); } @@ -22,47 +28,15 @@ void on_mi_about_activate(GtkObject *object, gpointer user_data) { gtk_widget_show_all(GTK_WIDGET(dialog)); } -void switch_to_func(gint func_id) { - gint i; - // Toggle off all buttons but the active one - for (i=0;i<FUNC_COUNT;i++) { - if (i==func_id) continue; - gtk_toggle_button_set_active(buttons[i],FALSE); - printf("buttons[%i]==%p\n", i, buttons[i]); - } - -} - -void on_action1_activate(GtkObject *object, gpointer user_data) { - switch_to_func(0); -} - -void on_action2_activate(GtkObject *object, gpointer user_data) { - switch_to_func(1); -} +void on_action1_activate(GtkObject *object, gpointer user_data) { switch_to_func(0); } +void on_action2_activate(GtkObject *object, gpointer user_data) { switch_to_func(1); } +void on_action3_activate(GtkObject *object, gpointer user_data) { switch_to_func(2); } +void on_action4_activate(GtkObject *object, gpointer user_data) { switch_to_func(3); } -void on_action3_activate(GtkObject *object, gpointer user_data) { - switch_to_func(2); -} - -void on_action4_activate(GtkObject *object, gpointer user_data) { - switch_to_func(3); -} - -void on_but_func1_realize(GtkObject *object, gpointer user_data) { - buttons[0]=GTK_TOGGLE_BUTTON(object); -} - -void on_but_func2_realize(GtkObject *object, gpointer user_data) { - buttons[1]=GTK_TOGGLE_BUTTON(object); -} - -void on_but_func3_realize(GtkObject *object, gpointer user_data) { - buttons[2]=GTK_TOGGLE_BUTTON(object); -} -void on_but_func4_realize(GtkObject *object, gpointer user_data) { - buttons[3]=GTK_TOGGLE_BUTTON(object); +void on_radbut_func_realize(GtkObject *object, gpointer user_data) { + // This makes the radio buttons look like a Toogle Button (that's a fucking trick) + gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(object),FALSE); } int main (int argc, char *argv[]) { |