1 | #include <stdio.h>
|
---|
2 |
|
---|
3 | #include <LString.h>
|
---|
4 | #include "pibwdgmac.h"
|
---|
5 | #include "piupdattachment.h"
|
---|
6 | #include <algobase.h>
|
---|
7 | #include <string.h>
|
---|
8 |
|
---|
9 | #define mGraphic mWGrC
|
---|
10 |
|
---|
11 | // Les methodes de la classe PIBWdgGen
|
---|
12 |
|
---|
13 | /* --Methode-- */
|
---|
14 | PIBaseWdgMac::PIBaseWdgMac(PIContainerGen *par, char *nom,
|
---|
15 | int sx, int sy, int px, int py) :
|
---|
16 | PIBaseWdgGen(par, nom, sx, sy, px, py)
|
---|
17 | {
|
---|
18 | mGraphic = new PIGraphicMac(this);
|
---|
19 |
|
---|
20 | mAdapter->AddAttachment(new PIUpdAttachment(this));
|
---|
21 | mPane->AddAttachment(new PIUpdAttachment(this));
|
---|
22 | cursor = NULL;
|
---|
23 |
|
---|
24 |
|
---|
25 | }
|
---|
26 |
|
---|
27 |
|
---|
28 | /* --Methode-- */
|
---|
29 | PIBaseWdgMac::~PIBaseWdgMac()
|
---|
30 | {
|
---|
31 | }
|
---|
32 |
|
---|
33 | /* --Methode-- */
|
---|
34 | void PIBaseWdgMac::ActivatePtrCross()
|
---|
35 | {
|
---|
36 | // toujours actif pour le moment
|
---|
37 | }
|
---|
38 |
|
---|
39 | /* --Methode-- */
|
---|
40 | void PIBaseWdgMac::ActivateButton(int /*bid*/)
|
---|
41 | {
|
---|
42 | }
|
---|
43 |
|
---|
44 | /* --Methode-- */
|
---|
45 | void PIBaseWdgMac::ActivateMove(int /*bid*/)
|
---|
46 | {
|
---|
47 | }
|
---|
48 |
|
---|
49 | /* --Methode-- */
|
---|
50 | void PIBaseWdgMac::ActivateKeyboard()
|
---|
51 | {
|
---|
52 | }
|
---|
53 |
|
---|
54 | /* --Methode-- */
|
---|
55 | void PIBaseWdgMac::EraseWindow(int x0, int y0, int dx, int dy)
|
---|
56 | {
|
---|
57 | if (mPane->FocusDraw()) {
|
---|
58 | GrafPtr p = mPane->GetMacPort();
|
---|
59 | if (p) EraseRgn(p->visRgn);
|
---|
60 | // Rect r;
|
---|
61 | // mPane->CalcPortFrameRect(r);
|
---|
62 | // EraseRect(&r);
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 | /* --Methode-- */
|
---|
69 | void PIBaseWdgMac::SelPointerShape(PIPointer ptr)
|
---|
70 | {
|
---|
71 | CursHandle c;
|
---|
72 | if (mPane->FocusDraw()) {
|
---|
73 | switch(ptr) {
|
---|
74 | case PI_ArrowPointer:
|
---|
75 | cursor = &qd.arrow;
|
---|
76 | break;
|
---|
77 | case PI_CrossPointer:
|
---|
78 | c = GetCursor(crossCursor);
|
---|
79 | HLock((Handle)c);
|
---|
80 | cursor = c ? *c : NULL;
|
---|
81 | break;
|
---|
82 | case PI_HandPointer:
|
---|
83 | c = GetCursor(128);
|
---|
84 | HLock((Handle)c);
|
---|
85 | cursor = c ? *c : NULL;
|
---|
86 | break;
|
---|
87 | }
|
---|
88 | }
|
---|
89 | mPtrS = ptr;
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | /* --Methode-- */
|
---|
95 | PIPointer PIBaseWdgMac::GetPointerShape()
|
---|
96 | {
|
---|
97 | return (mPtrS);
|
---|
98 | }
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|
102 | /* --Methode-- */
|
---|
103 | bool PIBaseWdgMac::AdjustCursor()
|
---|
104 | {
|
---|
105 | if (cursor) {
|
---|
106 | ::SetCursor(cursor);
|
---|
107 | return true;
|
---|
108 | }
|
---|
109 | return false;
|
---|
110 | }
|
---|
111 |
|
---|
112 | /* --Methode--
|
---|
113 | void PIBaseWdgMac::Refresh()
|
---|
114 | {
|
---|
115 | if (mPane->IsVisible())
|
---|
116 | Draw();
|
---|
117 | }
|
---|
118 | J'ai mis cette fonction ds PIWdgMac::IsVisible() Reza $CHECK$ 01/12/97
|
---|
119 | */
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 | void PIBaseWdgMac::SetBackgroundColor(PIColors col)
|
---|
124 | {
|
---|
125 | if (mPane->FocusDraw()) {
|
---|
126 | long color;
|
---|
127 | switch (col) {
|
---|
128 | case PI_Black:
|
---|
129 | color = blackColor;
|
---|
130 | break;
|
---|
131 | case PI_White:
|
---|
132 | color = whiteColor;
|
---|
133 | break;
|
---|
134 | case PI_Red:
|
---|
135 | color = redColor;
|
---|
136 | break;
|
---|
137 | case PI_Blue:
|
---|
138 | color = blueColor;
|
---|
139 | break;
|
---|
140 | case PI_Green:
|
---|
141 | color = greenColor;
|
---|
142 | break;
|
---|
143 | case PI_Yellow:
|
---|
144 | color = yellowColor;
|
---|
145 | break;
|
---|
146 | default:
|
---|
147 | color = blackColor;
|
---|
148 | }
|
---|
149 | mBCol = col;
|
---|
150 | ::BackColor(color);
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | PIColors PIBaseWdgMac::GetBackgroundColor()
|
---|
155 | {
|
---|
156 | return (mBCol);
|
---|
157 | }
|
---|