| 1 | #include <stdio.h> |
|---|
| 2 | #include <stdlib.h> // wegen exit(); |
|---|
| 3 | #include <aw_root.hxx> |
|---|
| 4 | #include <aw_device.hxx> |
|---|
| 5 | #include <aw_window.hxx> |
|---|
| 6 | #include <aw_preset.hxx> |
|---|
| 7 | #include <demo.hxx> |
|---|
| 8 | #include <memory.h> |
|---|
| 9 | #include <malloc.h> |
|---|
| 10 | #include <string.h> |
|---|
| 11 | |
|---|
| 12 | AW_HEADER_MAIN; |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | /******************************************************************************************/ |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | void terminate_program( AW_window *aw, AW_CL cd1, AW_CL cd2 ) { |
|---|
| 22 | AWUSE(aw);AWUSE(cd1);AWUSE(cd2); |
|---|
| 23 | |
|---|
| 24 | exit( 0 ); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | AW_window *create_demo_window_1( AW_root *root, AW_CL cd2 ) { |
|---|
| 30 | AWUSE(cd2); |
|---|
| 31 | |
|---|
| 32 | AW_window_simple *aws = new AW_window_simple; |
|---|
| 33 | aws->init( root, "Buttons Probe", 0, 0, 10, 10 ); |
|---|
| 34 | aws->load_xfig("demo/dm.fig"); |
|---|
| 35 | aws->button_length( 10 ); |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | aws->at ( "button1" ); |
|---|
| 39 | aws->callback ( terminate_program, (long)0, (long)0 ); |
|---|
| 40 | aws->create_button ( 0, "button 1", "1" ); |
|---|
| 41 | |
|---|
| 42 | aws->at ( "button2" ); |
|---|
| 43 | aws->callback ( terminate_program, (long)0, (long)0 ); |
|---|
| 44 | aws->create_button ( 0, "button 2", "1" ); |
|---|
| 45 | |
|---|
| 46 | return (AW_window *)aws; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | void create_main_window( AW_root *aw_root ) { |
|---|
| 53 | |
|---|
| 54 | AW_window_menu_modes *awmm; |
|---|
| 55 | |
|---|
| 56 | awmm = new AW_window_menu_modes; |
|---|
| 57 | awmm->init( aw_root, "DEMO Main Window", 600, 500, 1, 1 ); |
|---|
| 58 | |
|---|
| 59 | awmm->create_menu( "1", "Menu 1", "1", "No Help", AW_ALL ); |
|---|
| 60 | awmm->insert_menu_topic( "1.1", "CLOSE", "C", "No Help", AW_ALL, terminate_program, (long)0, (long)0 ); |
|---|
| 61 | |
|---|
| 62 | awmm->set_info_area_height(130); |
|---|
| 63 | awmm->set_bottom_area_height(130); |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | awmm->show(); |
|---|
| 67 | |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | /****************************************************************************************************/ |
|---|
| 72 | /****************************************************************************************************/ |
|---|
| 73 | /****************************************************************************************************/ |
|---|
| 74 | |
|---|
| 75 | int main(int argc,char **argv) { |
|---|
| 76 | AWUSE(argc);AWUSE(argv); |
|---|
| 77 | |
|---|
| 78 | AW_root *aw_root; |
|---|
| 79 | AW_default aw_default; |
|---|
| 80 | |
|---|
| 81 | aw_root = new AW_root; |
|---|
| 82 | |
|---|
| 83 | aw_default = aw_root->open_default( ".arb_prop/demo.arb" ); |
|---|
| 84 | |
|---|
| 85 | aw_root->init_variables( aw_default ); |
|---|
| 86 | |
|---|
| 87 | aw_root->init( "DEMO Programm" ); |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | create_main_window( aw_root ); |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | aw_root->main_loop(); |
|---|
| 94 | |
|---|
| 95 | } |
|---|