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
SelectionTest.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 "Selection.H"
19 static void quit(void *wid, gpointer data) {
20  gtk_main_quit();
21 }
22 
23 static void selectionCallback(void *wid, gpointer data){
24  char text[128];
25  Selection *s=(Selection *)data;
26  s->getSelection(text);
27  std::cout<<"you selected : "<<text<<std::endl;
28 }
29 
30 int main(int argc, char *argv[]) {
31  gtk_init( &argc, &argv );
32 
33  GtkInterface topWindow;
34  HBox hBox;
35 
36  Selection selection("test list items",G_CALLBACK(selectionCallback));
37  selection<<"test"<<"this"<<"one";
38 
39  selection.show();
40 
41  hBox<<BoxIS(TRUE, TRUE)<<selection.getWidget(); // the 'getWidget' method is present in most classses - in future, Selection will find a way to get rid of the 'getWidget' requirement.
42  hBox.show();
43  topWindow<< hBox;
44 
45  gtk_main();
46 }