2 /*******************************************************************************/
3 /* Copyright (C) 2013 Jonathan Moore Liles */
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. */
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 */
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 /*******************************************************************************/
21 #include <FL/Fl_Double_Window.H>
23 #include <FL/Fl_Box.H>
24 #include <FL/Fl_Socket_Window.H>
27 int main ( int argc
, char **argv
)
30 int wait_for_client
= 0;
34 if ( !strcmp( argv
[1], "--wait" ) )
37 sscanf( argv
[1], "%lx", &into
);
42 Fl_Double_Window
*plug
= NULL
;
44 if ( ! wait_for_client
)
46 { Fl_Double_Window
*o
= plug
= new Fl_Double_Window( 300,300, "Plug");
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
);
54 Fl_Group::current()->resizable(o
);
59 /* NOTE: window to be embedded is never show()'n */
63 Fl_Socket_Window
*socket
= NULL
;
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");
82 if ( ! wait_for_client
)
86 fl_embed( plug
, fl_xid( socket
));
90 fl_embed( plug
, into
);
95 printf( "Waiting for client... win_id = 0x%lx %ld\n", fl_xid( socket
), fl_xid( socket
) );