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

Last change on this file since 18 was 18, checked in by erosmgr, 29 years ago

1) PIApplication SetReady()/Busy()/Blocked() + implementation X
2) Gestion des widgets par les containers (Methodes PIContainer::

ChildAdd, ChildDel, SetAutoDelChilds) et modif ds piwdggen.cc

3) Interception des messages PIMsg_ActiveWdg par PIWindowGen::Process()
4) Appel de Parent->Process() ds PIMsgHandler::Send()
5) Gestion de ButtonPress1() ds PIScDrawWdg:: (Donne les coordonnees

du point + PIMsg_ActiveWdg

6) Envoi de PIMsg_ActiveWdg par PIBaseWdg:: sur ButtonPress1
7) Correction s et petites modifs ds PIDrawWin et PIHisto
8) Correction erreur de delete mDrawers ds PIScDrawWdg::delete
9) Verification/modif PIPixmap:: (SetPixmap(NULL))
10) PIImage:: Nouvelles petites fonctionalites (Cursor, ...) - On peut

supprimer le RzImage et faire SetImage(NULL) en conservant le display.
Amelioration gestion pave.

11) Classe PIPerioX:: Codage avec XToolkit (XtAddTimeOut())
12) pidemo.cc et pidemo.h Version completee avec coupe et fit PSF

Reza 06/07/96

File size: 2.6 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");
[7]27Menubar()->SetBinding(true, true, true, false);
[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);
37 topcont->SetBinding(true, true, true, true);
[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());
[2]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.