Tweak themes for more color consistency.
[ntk.git] / test / embed.cxx
blob42a49c290ac189502fb72b7065c09b7da8eb30d4
2 /*******************************************************************************/
3 /* Copyright (C) 2013 Jonathan Moore Liles */
4 /* */
5 /* This program is free software; you can redistribute it and/or modify it */
6 /* under the terms of the GNU General Public License as published by the */
7 /* Free Software Foundation; either version 2 of the License, or (at your */
8 /* option) any later version. */
9 /* */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
12 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
13 /* more details. */
14 /* */
15 /* You should have received a copy of the GNU General Public License along */
16 /* with This program; see the file COPYING. If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************************/
20 #include <FL/x.H>
21 #include <FL/Fl_Double_Window.H>
22 #include <FL/Fl.H>
23 #include <FL/Fl_Box.H>
24 #include <FL/Fl_Socket_Window.H>
25 #include <stdlib.h>
27 int main ( int argc, char **argv )
29 Window into = 0;
30 int wait_for_client = 0;
32 if ( argc > 1 )
34 if ( !strcmp( argv[1], "--wait" ) )
35 wait_for_client = 1;
36 else
37 sscanf( argv[1], "%lx", &into );
40 fl_open_display();
42 Fl_Double_Window *plug = NULL;
44 if ( ! wait_for_client )
46 { Fl_Double_Window *o = plug = new Fl_Double_Window( 300,300, "Plug");
47 o->color( FL_GRAY );
49 Fl_Box *o = new Fl_Box( 0, 0, 300, 300,
50 "You should see a gray box in the upper left hand corner on green field if embedding worked.");
52 o->align( FL_ALIGN_WRAP );
53 o->box(FL_UP_BOX);
54 Fl_Group::current()->resizable(o);
57 o->end();
59 /* NOTE: window to be embedded is never show()'n */
63 Fl_Socket_Window *socket = NULL;
65 if ( ! into )
67 { Fl_Double_Window *o = new Fl_Double_Window( 500, 600, "Top-Level" );
68 { Fl_Box *o = new Fl_Box( 0, 0, 500, 100, "This is the top-level window, the window for embedding should be nested below" );
69 o->align( FL_ALIGN_WRAP );
70 o->box( FL_BORDER_BOX );
72 { Fl_Socket_Window *o = socket = new Fl_Socket_Window( 0, 100, 500,500, "Socket");
73 o->color(FL_GREEN);
74 o->end();
75 o->show();
77 o->end();
79 o->show();
82 if ( ! wait_for_client )
84 if ( ! into )
86 fl_embed( plug, fl_xid( socket ));
88 else
90 fl_embed( plug, into );
93 else
95 printf( "Waiting for client... win_id = 0x%lx %ld\n", fl_xid( socket ), fl_xid( socket ) );
98 Fl::run();
100 return 0;