GTK+ IOStream  Beta
<< GTK+ >> add C++ IOStream operators to GTK+. Now with extra abilities ... like network serialisation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ButtonsTest2.C
Go to the documentation of this file.
1 /* Copyright 2000-2013 Matt Flax <flatmax@flatmax.org>
2  This file is part of GTK+ IOStream class set
3 
4  GTK+ IOStream is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  GTK+ IOStream is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You have received a copy of the GNU General Public License
15  along with GTK+ IOStream
16  */
17 /* Compile with ...
18 g++ -ggdb `gtk-config --cflags` ButtonsTest.C -o ButtonsTest `gtk-config --libs`
19 `pkg-config --cflags --libs gtk+-2.0`
20 */
21 #include "gtkInterface.H"
22 #include "Buttons.H"
23 #include "xpm/play.xpm"
24 
25 static void quit(void *wid, gpointer data){
26  gtk_main_quit();
27 }
28 
29 static void radioButton(void *widget, gpointer data){
30  cout<<"RadioButton "<<gtk_button_get_label(GTK_BUTTON(widget))<<endl;
31 }
32 
33 int main(int argc, char *argv[]){
34 
35  gtk_init( &argc, &argv );
36 
37  GtkInterface topWindow;
38  Buttons buttons;
39  HBox hBox;
40 
41  buttons<<BUTTONRADIOSTRUCT("Quit", quit, &buttons)<<BUTTONRADIOSTRUCT("1", radioButton, &buttons) // normal and toggle buttons
42  <<BUTTONRADIOSTRUCT("2", radioButton, &buttons)<<BUTTONRADIOSTRUCT("3", radioButton, &buttons)<<BUTTONRADIOSTRUCT("4", radioButton, &buttons);
43 
44  hBox<<buttons; // Same as hBox<< buttons.grab(1)<< buttons.grab(2)<< buttons.grab(3)<< buttons.grab(4);
45  hBox.show();
46  topWindow<< hBox;
47 
48  gtk_main();
49 }