[2] | 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");
|
---|
[7] | 23 | Menubar()->SetBinding(true, true, true, false);
|
---|
[2] | 24 | sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
|
---|
| 25 | syt = ( sy > 0 ) ? sy : 0;
|
---|
[7] | 26 | //syt += Menubar()->YSize();
|
---|
| 27 | syt += 40;
|
---|
[2] | 28 | MBCont()->SetSize(sxt, syt);
|
---|
| 29 | if ( (sx > 0) && (sy > 0) )
|
---|
| 30 | {
|
---|
| 31 | topcont = new PIContainerX(MBCont(), "TopLevelCont",
|
---|
[7] | 32 | sx, sy, 0, 40);
|
---|
| 33 | topcont->SetBinding(true, true, true, true);
|
---|
[2] | 34 | topcont->Show();
|
---|
| 35 | }
|
---|
| 36 | else topcont = MBCont();
|
---|
| 37 |
|
---|
| 38 | MBCont()->Show();
|
---|
| 39 | topwdg->Manage();
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | /* --Methode-- */
|
---|
| 43 | PIApplicationX::~PIApplicationX()
|
---|
| 44 | {
|
---|
| 45 | #ifdef DEBUG_APPLX
|
---|
| 46 | puts("PIApplicationX::~PIApplicationX()_info : App delete");
|
---|
| 47 | #endif
|
---|
| 48 | topwdg->Unmanage();
|
---|
[6] | 49 | delete menubar;
|
---|
| 50 | if (topcont != MBCont()) delete topcont;
|
---|
| 51 | delete intcont;
|
---|
[2] | 52 | delete topwdg;
|
---|
| 53 | exit(0);
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | /* --Methode-- */
|
---|
| 57 | void PIApplicationX::Run()
|
---|
| 58 | {
|
---|
| 59 | XEvent evt;
|
---|
| 60 | #ifdef DEBUG_APPLX
|
---|
| 61 | puts("PIApplicationX::Run()_info : App Run ");
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
|
---|
| 65 |
|
---|
| 66 | while (mStop)
|
---|
| 67 | {
|
---|
| 68 | XtNextEvent(&evt);
|
---|
| 69 | XtDispatchEvent(&evt);
|
---|
| 70 | }
|
---|
| 71 | return;
|
---|
| 72 | }
|
---|