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

Last change on this file since 23 was 23, checked in by ansari, 29 years ago

1) Modifications de PIMsgHandler -

Les messages sont constitues de deux
parties - User, et Modifier (Mod= 8 bits) Propagation de cette modif (en
particulier chngement de syntaxe de Send() dans les differentes classes.
2) Modification ds PIWdgGen , SetBinding() et Ajout de GetScreenPos()
PIWdg::SetBinding() avec 3 possibilites : Free, Fixed, Elastic.
Gestion de CloseWindow() genere par le WindowManager, Cela genere
maintenant un Message. L'action par defaut (ds PIWindow::Process()) fait
Hide().
3) Nouveau type de fenetre - Transient, pour afficher quelque chose en
avant plan. Utilisation de ce type de fenetre pour affichage de
coordonnes ds PIImage et PIScDraw.
4) Amelioration de gestion des fontes pour PIBWdgX:: Les fontes ne sont
chargees que si necessaire.
5) Nouvelles fonctionalites pour PIText:: (Zone de texte non editable,
zone de texte multilignes, Envoi d'un message lors de <CR> pour un texte
a une ligne)
6) petites ameliorations ds le traitement des callbacks

Reza - 17/10/96

File size: 2.7 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/* --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");
27Menubar()->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_free);
28sxt = ( sx > Menubar()->XSize() ) ? sx : Menubar()->XSize();
29syt = ( sy > 0 ) ? sy : 0;
30//syt += Menubar()->YSize();
31syt += 40;
32MBCont()->SetSize(sxt, syt);
33if ( (sx > 0) && (sy > 0) )
34 {
35 topcont = new PIContainerX(MBCont(), "TopLevelCont",
36 sx, sy, 0, 40);
37 topcont->SetBinding(PIBK_fixed, PIBK_fixed, PIBK_fixed, PIBK_fixed);
38 topcont->Show();
39 }
40else topcont = MBCont();
41
42MBCont()->Show();
43topwdg->Manage();
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();
56}
57
58/* --Methode-- */
59PIApplicationX::~PIApplicationX()
60{
61#ifdef DEBUG_APPLX
62puts("PIApplicationX::~PIApplicationX()_info : App delete");
63#endif
64Display *mdsp;
65mdsp = XtDisplay (topwdg->XtWdg());
66topwdg->Unmanage();
67delete menubar;
68if (topcont != MBCont()) delete topcont;
69delete intcont;
70delete topwdg;
71XtCloseDisplay(mdsp);
72return;
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}
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.