]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/window.h
wxMGL revitalised with OpenWatcom.
[wxWidgets.git] / include / wx / mgl / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mgl/window.h
3 // Purpose: wxWindow class
4 // Author: Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_WINDOW_H_
11 #define _WX_WINDOW_H_
12
13 // ---------------------------------------------------------------------------
14 // headers
15 // ---------------------------------------------------------------------------
16
17 #include "wx/font.h"
18
19 struct window_t;
20 class MGLDevCtx;
21
22 // ---------------------------------------------------------------------------
23 // wxWindow declaration for MGL
24 // ---------------------------------------------------------------------------
25
26 class WXDLLEXPORT wxWindowMGL : public wxWindowBase
27 {
28 public:
29 wxWindowMGL() { Init(); }
30
31 wxWindowMGL(wxWindow *parent,
32 wxWindowID id,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = 0,
36 const wxString& name = wxPanelNameStr)
37 {
38 Init();
39 Create(parent, id, pos, size, style, name);
40 }
41
42 virtual ~wxWindowMGL();
43
44 bool Create(wxWindow *parent,
45 wxWindowID id,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = 0,
49 const wxString& name = wxPanelNameStr);
50
51 virtual void Raise();
52 virtual void Lower();
53
54 virtual bool Show(bool show = TRUE);
55
56 virtual void SetFocus();
57
58 virtual bool Reparent(wxWindowBase *newParent);
59
60 virtual void WarpPointer(int x, int y);
61
62 virtual void Refresh(bool eraseBackground = TRUE,
63 const wxRect *rect = (const wxRect *) NULL);
64 virtual void Update();
65 virtual void Clear();
66 virtual void Freeze();
67 virtual void Thaw();
68
69 virtual bool SetCursor(const wxCursor &cursor);
70 virtual bool SetFont(const wxFont &font) { m_font = font; return TRUE; }
71
72 virtual int GetCharHeight() const;
73 virtual int GetCharWidth() const;
74 virtual void GetTextExtent(const wxString& string,
75 int *x, int *y,
76 int *descent = (int *) NULL,
77 int *externalLeading = (int *) NULL,
78 const wxFont *theFont = (const wxFont *) NULL)
79 const;
80
81 #if wxUSE_DRAG_AND_DROP
82 virtual void SetDropTarget(wxDropTarget *dropTarget);
83 #endif // wxUSE_DRAG_AND_DROP
84
85 // Accept files for dragging
86 virtual void DragAcceptFiles(bool accept);
87
88 virtual WXWidget GetHandle() const { return m_wnd; }
89
90 void SetMGLwindow_t(struct window_t *wnd);
91
92 // implementation from now on
93 // --------------------------
94
95 void OnInternalIdle();
96
97 protected:
98 // the window handle
99 struct window_t *m_wnd;
100 // whether there should be wxEraseEvent before wxPaintEvent or not
101 // (see wxWindow::Refresh)
102 bool m_frozen:1;
103 bool m_refreshAfterThaw:1;
104 int m_eraseBackground;
105
106 // implement the base class pure virtuals
107 virtual void DoClientToScreen( int *x, int *y ) const;
108 virtual void DoScreenToClient( int *x, int *y ) const;
109 virtual void DoGetPosition( int *x, int *y ) const;
110 virtual void DoGetSize( int *width, int *height ) const;
111 virtual void DoGetClientSize( int *width, int *height ) const;
112 virtual void DoSetSize(int x, int y,
113 int width, int height,
114 int sizeFlags = wxSIZE_AUTO);
115 virtual void DoSetClientSize(int width, int height);
116
117 virtual void DoCaptureMouse();
118 virtual void DoReleaseMouse();
119
120 // move the window to the specified location and resize it: this is called
121 // from both DoSetSize() and DoSetClientSize() and would usually just call
122 // ::MoveWindow() except for composite controls which will want to arrange
123 // themselves inside the given rectangle
124 virtual void DoMoveWindow(int x, int y, int width, int height);
125
126 private:
127 // common part of all ctors
128 void Init();
129 // counterpart to SetFocus
130 void KillFocus();
131
132 MGLDevCtx *m_paintMGLDC;
133 friend class wxPaintDC;
134
135 DECLARE_DYNAMIC_CLASS(wxWindowMGL)
136 DECLARE_NO_COPY_CLASS(wxWindowMGL)
137 DECLARE_EVENT_TABLE()
138
139 public:
140 void HandlePaint(MGLDevCtx *dc);
141 // needed by wxWindowPainter
142 MGLDevCtx *GetPaintMGLDC() const { return m_paintMGLDC; }
143 };
144
145
146 #endif
147 // _WX_WINDOW_H_