author | hgs |
Wed, 12 May 2010 10:34:10 +0100 | |
changeset 133 | 2a0ada0a1bf8 |
parent 90 | 947f0dc9f7a8 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\ws_std.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
/** |
|
19 |
@file |
|
20 |
@internalTechnology |
|
21 |
*/ |
|
22 |
||
23 |
#ifndef __WS_STD_H__ |
|
24 |
#define __WS_STD_H__ |
|
25 |
||
26 |
#include <e32base.h> |
|
27 |
#include <e32base_private.h> |
|
28 |
#include <e32cons.h> |
|
29 |
#include <e32twin.h> |
|
30 |
#include <e32ver.h> |
|
31 |
#include <e32svr.h> |
|
32 |
#include <e32hal.h> |
|
33 |
#include <e32uid.h> |
|
34 |
// |
|
35 |
#include <twintnotifier.h> |
|
36 |
// |
|
37 |
const TInt KW32MajorVersionNumber=1; |
|
38 |
const TInt KW32MinorVersionNumber=0; |
|
39 |
const TInt KMessageSlots=3; |
|
40 |
// |
|
41 |
||
42 |
typedef TUint8 TColorIndex; |
|
43 |
||
44 |
enum TConsolePanic |
|
45 |
{ |
|
46 |
EConsServerFailed, |
|
47 |
EConsNotSupportedYet |
|
48 |
}; |
|
49 |
// |
|
50 |
enum TWsPanic |
|
51 |
{ |
|
52 |
EPrematureOperation, |
|
53 |
ETooManyWindowsOpen, |
|
54 |
EWindowTooWide, |
|
55 |
EWindowTooThin, |
|
56 |
EWindowTooHigh, |
|
57 |
EWindowTooShort, |
|
58 |
EWindowOutOfMemory, |
|
59 |
EDoubleReadRequest, |
|
60 |
}; |
|
61 |
// |
|
62 |
enum TWsFault |
|
63 |
{ |
|
64 |
ECreateScheduler, |
|
65 |
ECreateServer, |
|
66 |
EStartServer, |
|
67 |
ECreateEvent, |
|
68 |
ECreateShell, |
|
69 |
ESchedulerError, |
|
70 |
EWindowsInitialisation, |
|
71 |
ENoKeyboardTranslator, |
|
72 |
ECreateNotifierSemaphore, |
|
73 |
ECreateNotifierThread, |
|
74 |
ELocaleDll, |
|
75 |
EChangeLocale, |
|
76 |
}; |
|
77 |
// |
|
78 |
struct SWsKey |
|
79 |
{ |
|
80 |
TKeyData iKeyData; |
|
81 |
TInt iType; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
TUint8 iPointerNumber; |
0 | 83 |
TPoint iMousePos; |
84 |
TSglQueLink iLink; |
|
85 |
}; |
|
86 |
||
87 |
struct ColorInformation |
|
88 |
{ |
|
89 |
TColorIndex iFg; |
|
90 |
TColorIndex iBg; |
|
91 |
}; |
|
92 |
// |
|
93 |
class CScreenDriver; |
|
94 |
class CWsWindow : public CBase |
|
95 |
{ |
|
96 |
friend class CEvent; |
|
97 |
friend class CWsSession; |
|
98 |
friend class CNotifierSession; |
|
99 |
friend class CKeyRepeat; |
|
100 |
private: |
|
101 |
enum |
|
102 |
{ |
|
103 |
EBackgroundNumber=0, |
|
104 |
EMaxOpenWindows=64, |
|
105 |
ENormalAttribute=7, |
|
106 |
EMouseCharacter=219, |
|
107 |
ECursorPeriodicPriority=2000 |
|
108 |
}; |
|
109 |
public: |
|
110 |
CWsWindow(); |
|
111 |
static void New(); |
|
112 |
inline static void WaitOnService() {ServiceMutex.Wait();} |
|
113 |
inline static void SignalService() {ServiceMutex.Signal();} |
|
114 |
static TBool RawEventMode(); |
|
115 |
static void QueueRawEvent(TRawEvent& anEvent); |
|
116 |
void CreateL(const TSize &aSize); |
|
117 |
||
118 |
private: |
|
119 |
~CWsWindow(); |
|
120 |
void Display(); |
|
121 |
TBool IsTop() const; |
|
122 |
void MakeTopWindow(); |
|
123 |
void SetClip(); |
|
124 |
void Clear(); |
|
125 |
void WriteCharacter(const TText *aCharacter); |
|
126 |
void CarriageReturn(); |
|
127 |
void LineFeed(); |
|
128 |
void Write(const TDesC &aBuffer); |
|
129 |
void Refresh(); |
|
130 |
void SaveEdges(); |
|
131 |
void RestoreEdges(); |
|
132 |
void SetWiew(); |
|
133 |
TBool IsInClippedTextArea(const TPoint& aPoint) const; |
|
134 |
void SetCursor(); |
|
135 |
static void TextFill(TText *aBuffer, TInt aLength, const TText *aValue); |
|
136 |
static TInt Offset(const TPoint &aPosition,const TSize &aSize); |
|
137 |
static void RotateWindowsForwards(); |
|
138 |
static void RotateWindowsBackwards(); |
|
139 |
static void BeginUpdateScreen(); |
|
140 |
static void EndUpdateScreen(); |
|
141 |
static void DrainAllReadRequests(); |
|
142 |
static void ControlInformAllMouse(TBool anIndicator); |
|
143 |
#if defined(_UNICODE) |
|
144 |
static TInt IsHankaku(const TText aCode); |
|
145 |
static TInt FitInWidth(TText* aDest,TInt aWidth,TInt aAsciiCol,TText aCode); |
|
146 |
static TInt OffsetHZa(const TText* aDest,const TPoint& aPosition,const TSize& aSize,TInt& aX); |
|
147 |
static TInt OffsetHZwP(const TText* aDest,const TPoint& aPosition,const TSize& aSize,TPoint& aP); |
|
148 |
static TInt OffsetHZ(const TText* aDest,const TPoint& aPosition,const TSize& aSize); |
|
149 |
static TText GetCharFromOffset(const TText* aDest,const TPoint& aPosition,const TSize& aSize); |
|
150 |
static TText *GetCpFromOffset(const TText* aDest,const TPoint& aPosition,const TSize& aSize); |
|
151 |
#endif |
|
152 |
void ScrollUp(); |
|
153 |
void Left(); |
|
154 |
void Right(); |
|
155 |
void FormFeed(); |
|
156 |
void BackSpace(); |
|
157 |
void HorizontalTab(); |
|
158 |
TBool IsRectVisible(TRect& aRect) const; |
|
159 |
void SetFrame(); |
|
160 |
void DrainReadRequest(); |
|
161 |
TBool EnqueReadRequest(const RMessage2& aMessage); |
|
162 |
void DequeReadRequest(); |
|
163 |
void InformMouse(TPoint aPos); |
|
164 |
void QueueWindowKey(TKeyData &aKeystroke); |
|
165 |
void DoMouseLeftButton(); |
|
166 |
void ControlMaximised(TBool anIndicator); |
|
167 |
void ControlOnTop(TBool anIndicator); |
|
168 |
static void Delete(); |
|
169 |
static CWsWindow *TopWindow(); |
|
170 |
static CWsWindow *BottomWindow(); |
|
171 |
static TInt8 NewNumberL(); |
|
172 |
static void ReleaseNumber(TInt8 aNumber); |
|
173 |
static void Redraw(); |
|
174 |
static void KeyPress(TKeyData& aKeystroke); |
|
175 |
static void QueueTopWindowKey(TKeyData& aKeystroke); |
|
176 |
static void InformTopMouse(TPoint aPos); |
|
177 |
static TInt ChangeTopWindowSize(TSize aGrowth); |
|
178 |
static TInt SlideTopWindowRelative(TPoint aDirection); |
|
179 |
static TInt MoveTopWindowRelative(TPoint aDirection); |
|
180 |
static void ControlTopWindowMaximised(TBool anIndicator); |
|
181 |
static TInt FlashCursor(TAny *aParameter); |
|
182 |
static void ResetVisibilityMap(); |
|
183 |
static void UpdateScreen(TPoint &aPosition,TInt aLength,TInt8 aNumber,TText *aTextBuffer,ColorInformation *anAttributeBuffer); |
|
184 |
static void Background(); |
|
185 |
static void TurnMouseOff(); |
|
186 |
static void TurnMouseOn(); |
|
187 |
static void MouseMove(TPoint aGraphicsPosition); |
|
188 |
static void MouseLeftButton(); |
|
189 |
static void MouseLeftButtonUp(); |
|
190 |
static CWsWindow *MouseWindow(); |
|
191 |
static void ChangeUIColors(); |
|
192 |
static TInt SetMode(TVideoMode aMode); |
|
193 |
TSize Size(); |
|
194 |
TPoint CursorPosition(); |
|
195 |
void WriteDone(); |
|
196 |
void SetView(); |
|
197 |
void SetFull(); |
|
198 |
void ClearToEndOfLine(); |
|
199 |
void NewLine(); |
|
200 |
void SetCursorHeight(TInt aPercentage); |
|
201 |
void SetTitle(const TDesC &aName); |
|
202 |
void SetSize(const TSize &aSize); |
|
203 |
void SetWindowPosAbs(const TPoint &aPosition); |
|
204 |
void SetCursorPosAbs(const TPoint &aPosition); |
|
205 |
void SetCursorPosRel(const TPoint &aPosition); |
|
206 |
void ControlScrollBars(TBool anIndicator); |
|
207 |
void ControlWrapLock(TBool anIndicator); |
|
208 |
void ControlPointerEvents(TBool anIndicator); |
|
209 |
void ControlScrollLock(TBool anIndicator); |
|
210 |
void ControlVisibility(TBool anIndicator); |
|
211 |
void ControlAllowResize(TBool anIndicator); |
|
212 |
void ControlCursorRequired(TBool anIndicator); |
|
213 |
void ControlNewLineMode(TBool anIndicator); |
|
214 |
void ControlRawEventMode(TBool anIndicator); |
|
215 |
void QueueWindowRawEvent(TRawEvent& anEvent); |
|
216 |
void MouseSlide(); |
|
217 |
void SetTextAttribute(TTextAttribute anAttribute); |
|
218 |
||
219 |
private: |
|
220 |
TInt8 iNumber; |
|
221 |
TSize iCurrentSize; |
|
222 |
TSize iClippedSize; |
|
223 |
TBool iIsVisible; |
|
224 |
TPoint iViewOrigin; |
|
225 |
TSize iViewSize; |
|
226 |
TPoint iCurrentOffset; |
|
227 |
TText *iTextBuffer; |
|
228 |
ColorInformation *iAttributeBuffer; |
|
229 |
TUint8 iFillAttribute; |
|
230 |
TBool iCursorRequired; |
|
231 |
TBool iCursorIsOn; |
|
232 |
TPoint iCursorPos; |
|
233 |
TPoint iLastCursorPos; |
|
234 |
TText iCursor; |
|
235 |
TBool iScrollLock; |
|
236 |
TBool iWrapLock; |
|
237 |
TBool iNewLineMode; |
|
238 |
TBool iOnTop; |
|
239 |
TBool iAllowResize; |
|
240 |
TBool iAllowSlide; |
|
241 |
TBool iReadIsValid; |
|
242 |
TDblQueLink iLink; |
|
243 |
static TSize ScreenSize; |
|
244 |
static CScreenDriver *ScreenDriver; |
|
245 |
static TDblQue<CWsWindow> WQueue; |
|
246 |
static TInt8 *VisibilityMap; |
|
247 |
static TPoint MousePos; |
|
248 |
static TSize FontSize; |
|
249 |
static CBitMapAllocator *Numbers; |
|
250 |
static CPeriodic *CursorPeriodic; |
|
251 |
static TText *BlankLineText; |
|
252 |
static ColorInformation *BlankLineAttributes; |
|
253 |
static TBool MouseIsCaptured; |
|
254 |
static RMutex MouseMutex; |
|
255 |
static RMutex ServiceMutex; |
|
256 |
static TInt Count; |
|
257 |
static const TText Cursors[101]; |
|
258 |
static CWsWindow* RawEventWindow; |
|
259 |
static TPoint ScrollWithMouse; |
|
260 |
static TPoint MoveWithMouse; |
|
261 |
static TPoint ResizeWithMouse; |
|
262 |
static TInt ScrollSpeed; |
|
263 |
static TColorIndex ScreenColor; |
|
264 |
static TColorIndex WindowBgColor; |
|
265 |
static TColorIndex BorderColor; |
|
266 |
static TColorIndex IndexOf[8]; |
|
267 |
TSglQue<SWsKey> iKQueue; |
|
268 |
RMessage2 iReadRequest; |
|
269 |
TPoint iMaximumOrigin; |
|
270 |
TSize iMaximumSize; |
|
271 |
TPoint iMinimumOrigin; |
|
272 |
TSize iMinimumSize; |
|
273 |
TBool iHasScrollBars; |
|
274 |
TBool iPointerEvents; |
|
275 |
TFileName iTitle; |
|
276 |
RMessage2 iMessage; |
|
277 |
TColorIndex iFgColor; |
|
278 |
TColorIndex iBgColor; |
|
279 |
}; |
|
280 |
||
281 |
class CWsSession : public CSession2 |
|
282 |
{ |
|
283 |
public: |
|
284 |
enum |
|
285 |
{ |
|
286 |
EConsoleCreate, |
|
287 |
EConsoleSet, |
|
288 |
EConsoleClearScreen, |
|
289 |
EConsoleClearToEndOfLine, |
|
290 |
EConsoleSetWindowPosAbs, |
|
291 |
EConsoleSetCursorHeight, |
|
292 |
EConsoleSetCursorPosAbs, |
|
293 |
EConsoleSetCursorPosRel, |
|
294 |
EConsoleCursorPos, |
|
295 |
EConsoleControl, |
|
296 |
EConsoleWrite, |
|
297 |
EConsoleRead, |
|
298 |
EConsoleReadCancel, |
|
299 |
EConsoleDestroy, |
|
300 |
EConsoleSetTitle, |
|
301 |
EConsoleSetSize, |
|
302 |
EConsoleSize, |
|
303 |
EConsoleScreenSize, |
|
304 |
EConsoleSetMode, |
|
305 |
EConsoleSetPaletteEntry, |
|
306 |
EConsoleGetPaletteEntry, |
|
307 |
EConsoleSetTextColors, |
|
308 |
EConsoleSetUIColors, |
|
309 |
EConsoleSetTextAttribute |
|
310 |
}; |
|
311 |
public: |
|
312 |
CWsSession(); |
|
313 |
~CWsSession(); |
|
314 |
void Attach(CWsWindow* aWindow); |
|
315 |
virtual void ServiceL(const RMessage2& aMessage); |
|
316 |
virtual void ServiceError(const RMessage2& aMessage,TInt aError); |
|
317 |
private: |
|
318 |
CWsWindow* iWindow; |
|
319 |
RMessagePtr2 iCurMsg; |
|
320 |
TInt iTestFast; |
|
321 |
}; |
|
322 |
// |
|
323 |
class CWsServer : public CServer2 |
|
324 |
{ |
|
325 |
public: |
|
326 |
enum {EPriority=1000}; |
|
327 |
public: |
|
328 |
static void New(); |
|
329 |
~CWsServer(); |
|
330 |
virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
331 |
private: |
|
332 |
CWsServer(TInt aPriority); |
|
333 |
}; |
|
334 |
// |
|
335 |
class CKeyRepeat : public CTimer |
|
336 |
{ |
|
337 |
public: |
|
338 |
enum { EKeyRepeatPriority=1990 }; |
|
339 |
||
340 |
CKeyRepeat(TInt aPriority); |
|
341 |
void ConstructL(); |
|
342 |
void Request(TKeyData& aKeyData); |
|
343 |
virtual void RunL(); |
|
344 |
void SetRepeatTime(TInt aDelay,TInt aRate); |
|
345 |
void RepeatTime(TInt& aDelay,TInt& aRate); |
|
346 |
||
347 |
TKeyData iKeyData; |
|
348 |
private: |
|
349 |
enum { EDefaultKeyRepeatDelay=500000, EDefaultKeyRepeatRate=30000 }; |
|
350 |
||
351 |
TInt iDelay; |
|
352 |
TInt iRate; |
|
353 |
}; |
|
354 |
// |
|
355 |
class CEvent : public CActive |
|
356 |
{ |
|
357 |
public: |
|
358 |
enum {EPriority=2000}; |
|
359 |
public: |
|
360 |
static void New(); |
|
361 |
~CEvent(); |
|
362 |
void Request(); |
|
363 |
virtual void DoCancel(); |
|
364 |
virtual void RunL(); |
|
365 |
protected: |
|
366 |
CEvent(TInt aPriority); |
|
367 |
private: |
|
368 |
TRawEventBuf iEvent; |
|
369 |
static CCaptureKeys *CaptureKeys; |
|
370 |
TInt iRepeatScanCode; |
|
371 |
}; |
|
372 |
// |
|
373 |
class CWsActiveScheduler : public CActiveScheduler |
|
374 |
{ |
|
375 |
public: |
|
376 |
static void New(); |
|
377 |
virtual void Error(TInt anError) const; |
|
378 |
}; |
|
379 |
// |
|
380 |
#include "w32disp.h" |
|
381 |
// |
|
382 |
GLREF_C TInt WindowServerThread(TAny *anArg); |
|
383 |
GLREF_C void Panic(TWsPanic aPanic); |
|
384 |
GLREF_C void Fault(TWsFault aFault); |
|
385 |
// |
|
386 |
IMPORT_C void Panic(TConsolePanic aPanic); |
|
387 |
||
388 |
#endif // __WS_STD_H__ |