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

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

Nouvelles fonctionalites pour le PIBaseWdg (non implemente mac)
Classe PIDrawer, traceur en coordonnes user, pouvant etre attaches a
tout PIBaseWdg. Optimisation trace (Backing-store en X, Trace de
zones a rafraichir pour les ScDrawer, ...)
Nouveau classe de trace de points a partir de NTuples
Reza 08/08/97

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