1 |
/* |
2 |
* PearPC |
3 |
* sysbeos.h |
4 |
* |
5 |
* Copyright (C) 2004 Stefan Weyergraf (stefan@weyergraf.de) |
6 |
* Copyright (C) 2004 Francois Revol (revol@free.fr) |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 as |
10 |
* published by the Free Software Foundation. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
*/ |
21 |
|
22 |
#ifndef __SYSBEOS_H__ |
23 |
#define __SYSBEOS_H__ |
24 |
|
25 |
//#define BMP_MENU |
26 |
|
27 |
|
28 |
class BeOSSystemDisplay; |
29 |
class SDView; |
30 |
|
31 |
class SDWindow : public BWindow { |
32 |
public: |
33 |
SDWindow(BRect frame, const char *name); |
34 |
~SDWindow(); |
35 |
virtual bool QuitRequested(); |
36 |
virtual void Show(); |
37 |
virtual void Hide(); |
38 |
virtual void Minimize(bool minimize); |
39 |
}; |
40 |
|
41 |
class SDView : public BView { |
42 |
public: |
43 |
SDView(BeOSSystemDisplay *sd, BRect frame, const char *name); |
44 |
~SDView(); |
45 |
|
46 |
virtual void MessageReceived(BMessage *msg); |
47 |
virtual void Draw(BRect updateRect); |
48 |
virtual void MouseDown(BPoint where); |
49 |
virtual void MouseUp(BPoint where); |
50 |
virtual void MouseMoved(BPoint where, uint32 code, const BMessage *a_message); |
51 |
virtual void KeyDown(const char *bytes, int32 numBytes); |
52 |
virtual void KeyUp(const char *bytes, int32 numBytes); |
53 |
virtual void Pulse(); |
54 |
|
55 |
void QueueMessage(BMessage *msg); |
56 |
BMessage *UnqueueMessage(bool sync); |
57 |
private: |
58 |
BList fMsgList; |
59 |
BLocker *fMsgListLock; |
60 |
BeOSSystemDisplay *fSystemDisplay; |
61 |
BBitmap *fFramebuffer; |
62 |
sem_id fMsgSem; |
63 |
}; |
64 |
|
65 |
|
66 |
class BeOSSystemDisplay: public SystemDisplay |
67 |
{ |
68 |
friend class SDView; |
69 |
Queue *mEventQueue; |
70 |
DisplayCharacteristics mBeChar; |
71 |
int mLastMouseX, mLastMouseY; |
72 |
//int mCurMouseX, mCurMouseY; |
73 |
//int mResetMouseX, mResetMouseY; |
74 |
//int mHomeMouseX, mHomeMouseY; |
75 |
bool mMouseButton[3]; |
76 |
bool mMouseEnabled; |
77 |
char *mTitle; |
78 |
char mCurTitle[200]; |
79 |
byte *mouseData; |
80 |
byte *menuData; |
81 |
/* */ |
82 |
sys_thread redrawthread; |
83 |
sys_mutex mutex; |
84 |
BBitmap *fbBitmap; |
85 |
BBitmap *fMenuBitmap; |
86 |
SDView *view; |
87 |
SDWindow *window; |
88 |
|
89 |
void dumpDisplayChar(const DisplayCharacteristics &chr); |
90 |
uint bitsPerPixelToXBitmapPad(uint bitsPerPixel); |
91 |
public: |
92 |
BeOSSystemDisplay(const char *name, const DisplayCharacteristics &chr, int redraw_ms); |
93 |
virtual ~BeOSSystemDisplay(); |
94 |
virtual void finishMenu(); |
95 |
virtual void convertCharacteristicsToHost(DisplayCharacteristics &aHostChar, const DisplayCharacteristics &aClientChar); |
96 |
virtual bool changeResolution(const DisplayCharacteristics &aCharacteristics); |
97 |
virtual void getHostCharacteristics(Container &modes); |
98 |
int getKeybLEDs(); |
99 |
void setKeybLEDs(int leds); |
100 |
void updateTitle(); |
101 |
virtual int toString(char *buf, int buflen) const; |
102 |
virtual void setMouseGrab(bool enable); |
103 |
virtual void displayShow(); |
104 |
void convertDisplayClientToServer(uint firstLine, uint lastLine); |
105 |
//virtual void queueEvent(DisplayEvent &ev); |
106 |
virtual void startRedrawThread(int msec); |
107 |
}; |
108 |
|
109 |
/* implementation */ |
110 |
|
111 |
#endif |