1 | #include <stdio.h>
|
---|
2 | #include "piapplx.h"
|
---|
3 | #include "picontainerx.h"
|
---|
4 |
|
---|
5 |
|
---|
6 | #define DEBUG_APPLX
|
---|
7 |
|
---|
8 | /* --Methode-- */
|
---|
9 | PIApplicationX::PIApplicationX(int sx, int sy, int narg, char *arg[])
|
---|
10 | : PIApplicationGen()
|
---|
11 | {
|
---|
12 | int sxt, syt;
|
---|
13 |
|
---|
14 | #ifdef DEBUG_APPLX
|
---|
15 | puts("PIApplicationX::PIApplicationX()_info : App creation");
|
---|
16 | #endif
|
---|
17 | mStop = true;
|
---|
18 | topwdg = new PIWdgX(narg, arg);
|
---|
19 |
|
---|
20 | intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont",
|
---|
21 | 10, 10, 0, 0);
|
---|
22 | menubar = new PIMenubar(this, "DefMenubar");
|
---|
23 | Menubar()->SetBinding(true, false, true, false);
|
---|
24 | sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
|
---|
25 | syt = ( sy > 0 ) ? sy : 0;
|
---|
26 | syt += Menubar()->YSize();
|
---|
27 | MBCont()->SetSize(sxt, syt);
|
---|
28 | if ( (sx > 0) && (sy > 0) )
|
---|
29 | {
|
---|
30 | topcont = new PIContainerX(MBCont(), "TopLevelCont",
|
---|
31 | sx, sy, 0, Menubar()->YSize());
|
---|
32 | topcont->SetBinding(true, false, true, true);
|
---|
33 | topcont->Show();
|
---|
34 | }
|
---|
35 | else topcont = MBCont();
|
---|
36 |
|
---|
37 | MBCont()->Show();
|
---|
38 | topwdg->Manage();
|
---|
39 | }
|
---|
40 |
|
---|
41 | /* --Methode-- */
|
---|
42 | PIApplicationX::~PIApplicationX()
|
---|
43 | {
|
---|
44 | #ifdef DEBUG_APPLX
|
---|
45 | puts("PIApplicationX::~PIApplicationX()_info : App delete");
|
---|
46 | #endif
|
---|
47 | topwdg->Unmanage();
|
---|
48 | delete menubar;
|
---|
49 | if (topcont != MBCont()) delete topcont;
|
---|
50 | delete intcont;
|
---|
51 | delete topwdg;
|
---|
52 | exit(0);
|
---|
53 | }
|
---|
54 |
|
---|
55 | /* --Methode-- */
|
---|
56 | void PIApplicationX::Run()
|
---|
57 | {
|
---|
58 | XEvent evt;
|
---|
59 | #ifdef DEBUG_APPLX
|
---|
60 | puts("PIApplicationX::Run()_info : App Run ");
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
|
---|
64 |
|
---|
65 | while (mStop)
|
---|
66 | {
|
---|
67 | XtNextEvent(&evt);
|
---|
68 | XtDispatchEvent(&evt);
|
---|
69 | }
|
---|
70 | return;
|
---|
71 | }
|
---|