source: Sophya/trunk/SophyaPI/PI/piapplx.cc@ 60

Last change on this file since 60 was 60, checked in by ansari, 28 years ago

Correction Pb PIContainerX , XmForm (Voir aussi PIWdgX)
Ajouts definition de touches clavier ds pibwdgge.h et suppression des
fonctions ActivateMove() ... pour PIBaseWdgGen et Mac -
Petite modifs pour PIMenuX pour aviter conflit avec certains WindMgr

Reza 5/11/97

File size: 2.9 KB
Line 
1#include <stdio.h>
2#include <X11/cursorfont.h>
3#include "piapplx.h"
4#include "picontainerx.h"
5
6
7#define DEBUG_APPLX
8
9static Cursor a_curs[3];
10static bool a_fgcur=false;
11
12// Voir fichier pimenux.cc , Pour resoudre certains conflits avec les WindowManagers
13void SetTopWdgForMenuX(SysDWdg mtw);
14
15/* --Methode-- */
16PIApplicationX::PIApplicationX(int sx, int sy, int narg, char *arg[])
17: PIApplicationGen()
18{
19int sxt, syt;
20
21#ifdef DEBUG_APPLX
22puts("PIApplicationX::PIApplicationX()_info : App creation");
23#endif
24mStop = true;
25topwdg = new PIWdgX(narg, arg);
26
27intcont = new PIContainerX((PIMsgHandler *)this, topwdg, "MBCont",
28 10, 10, 0, 0);
29// Pb avec les Popup MenuX et certains Window Manager , voir pimenux.cc
30SetTopWdgForMenuX(intcont->XtWdg());
31
32menubar = new PIMenubar(this, "DefMenubar");
33Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
34sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
35syt = ( sy > 0 ) ? sy : 0;
36//syt += Menubar()->YSize();
37syt += 40;
38MBCont()->SetSize(sxt, syt);
39if ( (sx > 0) && (sy > 0) )
40 {
41 topcont = new PIContainerX(MBCont(), "TopLevelCont",
42 sx, sy, 0, 40);
43 topcont->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
44 topcont->Show();
45 }
46else topcont = MBCont();
47
48MBCont()->Show();
49topwdg->Manage();
50
51if (!a_fgcur)
52 {
53 Display *mdsp;
54 mdsp = XtDisplay (topwdg->XtWdg());
55 a_curs[0] = XCreateFontCursor(mdsp, XC_arrow);
56 a_curs[1] = XCreateFontCursor(mdsp, XC_X_cursor);
57 a_curs[2] = XCreateFontCursor(mdsp, XC_watch);
58 }
59
60mState = -1;
61SetReady();
62}
63
64/* --Methode-- */
65PIApplicationX::~PIApplicationX()
66{
67#ifdef DEBUG_APPLX
68puts("PIApplicationX::~PIApplicationX()_info : App delete");
69#endif
70Display *mdsp;
71mdsp = XtDisplay (topwdg->XtWdg());
72topwdg->UnManage();
73delete menubar;
74if (topcont != MBCont()) delete topcont;
75delete intcont;
76delete topwdg;
77XtCloseDisplay(mdsp);
78return;
79}
80
81/* --Methode-- */
82void PIApplicationX::Run()
83{
84XEvent evt;
85#ifdef DEBUG_APPLX
86puts("PIApplicationX::Run()_info : App Run ");
87#endif
88
89topwdg->SetSize(MBCont()->XSize(), MBCont()->YSize());
90
91while (mStop)
92 {
93 XtNextEvent(&evt);
94 XtDispatchEvent(&evt);
95 }
96return;
97}
98
99
100/* --Methode-- */
101void PIApplicationX::SetReady()
102{
103if (mState != kReadyState)
104 {
105 Display * mdsp;
106 mState = kReadyState;
107 mdsp = XtDisplay (topwdg->XtWdg());
108 XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[0]);
109 XFlush(mdsp);
110 }
111}
112
113/* --Methode-- */
114void PIApplicationX::SetBusy()
115{
116if (mState != kBusyState)
117 {
118 Display * mdsp;
119 mState = kBusyState;
120 mdsp = XtDisplay (topwdg->XtWdg());
121// if ( XtIsRealized(topwdg->XtWdg()) )
122 XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[2]);
123 XFlush(mdsp);
124 }
125return;
126}
127
128/* --Methode-- */
129void PIApplicationX::SetBlocked()
130{
131if (mState != kBlockedState)
132 {
133 Display * mdsp;
134 mState = kBlockedState;
135 mdsp = XtDisplay (topwdg->XtWdg());
136 XDefineCursor(mdsp, XtWindow(topwdg->XtWdg()), a_curs[1]);
137 XFlush(mdsp);
138 }
139}
Note: See TracBrowser for help on using the repository browser.