comparison src/video/qtopia/SDL_QWin.h @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents d910939febfa
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
32 #include <qpainter.h> 32 #include <qpainter.h>
33 #include <qdirectpainter_qws.h> 33 #include <qdirectpainter_qws.h>
34 34
35 #include "SDL_events.h" 35 #include "SDL_events.h"
36 36
37 extern "C" { 37 extern "C"
38 {
38 #include "../../events/SDL_events_c.h" 39 #include "../../events/SDL_events_c.h"
39 }; 40 };
40 41
41 typedef enum { 42 typedef enum
42 SDL_QT_NO_ROTATION = 0, 43 {
43 SDL_QT_ROTATION_90, 44 SDL_QT_NO_ROTATION = 0,
44 SDL_QT_ROTATION_270 45 SDL_QT_ROTATION_90,
46 SDL_QT_ROTATION_270
45 } screenRotationT; 47 } screenRotationT;
46 48
47 extern screenRotationT screenRotation; 49 extern screenRotationT screenRotation;
48 50
49 class SDL_QWin : public QWidget 51 class SDL_QWin:public QWidget
50 { 52 {
51 void QueueKey(QKeyEvent *e, int pressed); 53 void QueueKey (QKeyEvent * e, int pressed);
52 public: 54 public:
53 SDL_QWin(const QSize& size); 55 SDL_QWin (const QSize & size);
54 virtual ~SDL_QWin(); 56 virtual ~ SDL_QWin ();
55 virtual bool shown(void) { 57 virtual bool shown (void)
56 return isVisible(); 58 {
57 } 59 return isVisible ();
58 /* If called, the next resize event will not be forwarded to SDL. */ 60 }
59 virtual void inhibitResize(void) { 61 /* If called, the next resize event will not be forwarded to SDL. */
60 my_inhibit_resize = true; 62 virtual void inhibitResize (void)
61 } 63 {
62 void setImage(QImage *image); 64 my_inhibit_resize = true;
63 void setOffset(int x, int y) { 65 }
64 my_offset = QPoint(x, y); 66 void setImage (QImage * image);
65 } 67 void setOffset (int x, int y)
66 void GetXYOffset(int &x, int &y) { 68 {
67 x = my_offset.x(); 69 my_offset = QPoint (x, y);
68 y = my_offset.y(); 70 }
69 } 71 void GetXYOffset (int &x, int &y)
70 QImage *image(void) { return my_image; } 72 {
71 73 x = my_offset.x ();
72 void setWFlags(WFlags flags) { 74 y = my_offset.y ();
73 QWidget::setWFlags(flags); 75 }
74 my_flags = flags; 76 QImage *image (void)
75 } 77 {
76 const QPoint& mousePos() const { return my_mouse_pos; } 78 return my_image;
77 void setMousePos(const QPoint& newpos); 79 }
78 void setFullscreen(bool);
79 80
80 bool lockScreen(bool force=false); 81 void setWFlags (WFlags flags)
81 void unlockScreen(); 82 {
82 void repaintRect(const QRect& rect); 83 QWidget::setWFlags (flags);
83 protected: 84 my_flags = flags;
84 /* Handle resizing of the window */ 85 }
85 virtual void resizeEvent(QResizeEvent *e); 86 const QPoint & mousePos () const
86 void focusInEvent(QFocusEvent *); 87 {
87 void focusOutEvent(QFocusEvent *); 88 return my_mouse_pos;
88 void closeEvent(QCloseEvent *e); 89 }
89 void mouseMoveEvent(QMouseEvent *e); 90 void setMousePos (const QPoint & newpos);
90 void mousePressEvent(QMouseEvent *e); 91 void setFullscreen (bool);
91 void mouseReleaseEvent(QMouseEvent *e); 92
92 void paintEvent(QPaintEvent *ev); 93 bool lockScreen (bool force = false);
93 void keyPressEvent(QKeyEvent *e) { QueueKey(e, 1); } 94 void unlockScreen ();
94 void keyReleaseEvent(QKeyEvent *e) { QueueKey(e, 0); } 95 void repaintRect (const QRect & rect);
95 private: 96 protected:
96 bool repaintRotation0(const QRect& rect); 97 /* Handle resizing of the window */
97 bool repaintRotation1(const QRect& rect); 98 virtual void resizeEvent (QResizeEvent * e);
98 bool repaintRotation3(const QRect& rect); 99 void focusInEvent (QFocusEvent *);
99 void enableFullscreen(); 100 void focusOutEvent (QFocusEvent *);
100 QDirectPainter *my_painter; 101 void closeEvent (QCloseEvent * e);
101 QImage *my_image; 102 void mouseMoveEvent (QMouseEvent * e);
102 bool my_inhibit_resize; 103 void mousePressEvent (QMouseEvent * e);
103 QPoint my_offset; 104 void mouseReleaseEvent (QMouseEvent * e);
104 QPoint my_mouse_pos; 105 void paintEvent (QPaintEvent * ev);
105 WFlags my_flags; 106 void keyPressEvent (QKeyEvent * e)
106 WFlags my_has_fullscreen; 107 {
107 unsigned int my_locked; 108 QueueKey (e, 1);
109 }
110 void keyReleaseEvent (QKeyEvent * e)
111 {
112 QueueKey (e, 0);
113 }
114 private:
115 bool repaintRotation0 (const QRect & rect);
116 bool repaintRotation1 (const QRect & rect);
117 bool repaintRotation3 (const QRect & rect);
118 void enableFullscreen ();
119 QDirectPainter *my_painter;
120 QImage *my_image;
121 bool my_inhibit_resize;
122 QPoint my_offset;
123 QPoint my_mouse_pos;
124 WFlags my_flags;
125 WFlags my_has_fullscreen;
126 unsigned int my_locked;
108 }; 127 };
109 128
110 #endif /* _SDL_QWin_h */ 129 #endif /* _SDL_QWin_h */
130 /* vi: set ts=4 sw=4 expandtab: */