[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");
|
---|
| 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 topcont;
|
---|
| 49 | delete topwdg;
|
---|
| 50 | exit(0);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | /* --Methode-- */
|
---|
| 54 | void PIApplicationX::Run()
|
---|
| 55 | {
|
---|
| 56 | XEvent evt;
|
---|
| 57 | #ifdef DEBUG_APPLX
|
---|
| 58 | puts("PIApplicationX::Run()_info : App Run ");
|
---|
| 59 | #endif
|
---|
| 60 |
|
---|
| 61 | topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
|
---|
| 62 |
|
---|
| 63 | while (mStop)
|
---|
| 64 | {
|
---|
| 65 | XtNextEvent(&evt);
|
---|
| 66 | XtDispatchEvent(&evt);
|
---|
| 67 | }
|
---|
| 68 | return;
|
---|
| 69 | }
|
---|