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
ScaleTest.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 #include "gtkInterface.H"
18 #include "Scale.H"
19 #include "Buttons.H"
20 #include "Box.H"
21 
22 static void quit(void *wid, gpointer data){
23  gtk_main_quit();
24 }
25 
26 static void scaleTouch(void *widget, gpointer data){
27  cout<<"scaleTouch "<<data<<endl;
28  cout<<"set to "<<Scale().getCount((GtkRange*)widget)<<endl;;
29 }
30 
31 int main(int argc, char *argv[]){
32  gtk_init( &argc, &argv );
33 
34  GtkInterface topWindow;
35  gtk_widget_set_size_request (topWindow.win, 200, 300);
36 
37  HScale hScale(SCALESTRUCT{0,100,1,scaleTouch,NULL});
38 
39  VScale vScale(SCALESTRUCT{0,100,1,scaleTouch,NULL});
40 
41  hScale.show();
42  (Scale)hScale=50.9;
43  vScale.show();
44  (Scale)vScale=50.9;
45 
46  Buttons buttons;
47  buttons<<BUTTONLABELSTRUCT("Quit", quit, NULL);
48 
49 
50  HBox hBox;
51  VBox vBox;
52  vBox<<buttons.grab(1);
53  vBox<< hScale.getWidget();
54  hBox<< vScale.getWidget();
55  hBox.show();
56  vBox.show();
57  hBox<<BoxIS(true,true)<<vBox;
58  topWindow<< hBox;
59 
60 
61  //topWindow<<buttons.grab(1)<<buttons.grab(2);
62 
63  gtk_main();
64 }