]>
Commit | Line | Data |
---|---|---|
32b8ec41 | 1 | ///////////////////////////////////////////////////////////////////////////// |
a4bbc9f7 VS |
2 | // Name: wx/mgl/window.h |
3 | // Purpose: wxWindow class | |
32b8ec41 | 4 | // Author: Vaclav Slavik |
a4bbc9f7 | 5 | // RCS-ID: $Id$ |
52750c2e | 6 | // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) |
65571936 | 7 | // Licence: wxWindows licence |
32b8ec41 VZ |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
a4bbc9f7 VS |
10 | #ifndef _WX_WINDOW_H_ |
11 | #define _WX_WINDOW_H_ | |
32b8ec41 | 12 | |
a4bbc9f7 VS |
13 | // --------------------------------------------------------------------------- |
14 | // headers | |
15 | // --------------------------------------------------------------------------- | |
32b8ec41 | 16 | |
a4bbc9f7 | 17 | #include "wx/font.h" |
32b8ec41 | 18 | |
a4bbc9f7 VS |
19 | struct window_t; |
20 | class MGLDevCtx; | |
21 | ||
22 | // --------------------------------------------------------------------------- | |
23 | // wxWindow declaration for MGL | |
24 | // --------------------------------------------------------------------------- | |
32b8ec41 VZ |
25 | |
26 | class WXDLLEXPORT wxWindowMGL : public wxWindowBase | |
27 | { | |
32b8ec41 | 28 | public: |
a4bbc9f7 VS |
29 | wxWindowMGL() { Init(); } |
30 | ||
32b8ec41 VZ |
31 | wxWindowMGL(wxWindow *parent, |
32 | wxWindowID id, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = 0, | |
a4bbc9f7 VS |
36 | const wxString& name = wxPanelNameStr) |
37 | { | |
38 | Init(); | |
39 | Create(parent, id, pos, size, style, name); | |
40 | } | |
41 | ||
42 | virtual ~wxWindowMGL(); | |
43 | ||
32b8ec41 VZ |
44 | bool Create(wxWindow *parent, |
45 | wxWindowID id, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = 0, | |
a4bbc9f7 | 49 | const wxString& name = wxPanelNameStr); |
32b8ec41 | 50 | |
a4bbc9f7 VS |
51 | virtual void Raise(); |
52 | virtual void Lower(); | |
32b8ec41 | 53 | |
a4bbc9f7 | 54 | virtual bool Show(bool show = TRUE); |
32b8ec41 | 55 | |
a4bbc9f7 | 56 | virtual void SetFocus(); |
32b8ec41 | 57 | |
a4bbc9f7 | 58 | virtual bool Reparent(wxWindowBase *newParent); |
32b8ec41 | 59 | |
a4bbc9f7 | 60 | virtual void WarpPointer(int x, int y); |
32b8ec41 | 61 | |
a4bbc9f7 VS |
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(); | |
32b8ec41 | 68 | |
a4bbc9f7 VS |
69 | virtual bool SetCursor(const wxCursor &cursor); |
70 | virtual bool SetFont(const wxFont &font) { m_font = font; return TRUE; } | |
32b8ec41 | 71 | |
a4bbc9f7 VS |
72 | virtual int GetCharHeight() const; |
73 | virtual int GetCharWidth() const; | |
32b8ec41 VZ |
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) | |
a4bbc9f7 | 79 | const; |
32b8ec41 VZ |
80 | |
81 | #if wxUSE_DRAG_AND_DROP | |
a4bbc9f7 | 82 | virtual void SetDropTarget(wxDropTarget *dropTarget); |
32b8ec41 VZ |
83 | #endif // wxUSE_DRAG_AND_DROP |
84 | ||
a4bbc9f7 VS |
85 | // Accept files for dragging |
86 | virtual void DragAcceptFiles(bool accept); | |
87 | ||
a4bbc9f7 | 88 | virtual WXWidget GetHandle() const { return m_wnd; } |
58061670 VS |
89 | |
90 | void SetMGLwindow_t(struct window_t *wnd); | |
a4bbc9f7 | 91 | |
a4bbc9f7 VS |
92 | // implementation from now on |
93 | // -------------------------- | |
8b0f8432 VS |
94 | |
95 | void OnInternalIdle(); | |
a4bbc9f7 VS |
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) | |
f41ed3c4 VS |
102 | bool m_frozen:1; |
103 | bool m_refreshAfterThaw:1; | |
2b260bc3 | 104 | int m_eraseBackground; |
32b8ec41 VZ |
105 | |
106 | // implement the base class pure virtuals | |
a4bbc9f7 VS |
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; | |
32b8ec41 VZ |
112 | virtual void DoSetSize(int x, int y, |
113 | int width, int height, | |
a4bbc9f7 VS |
114 | int sizeFlags = wxSIZE_AUTO); |
115 | virtual void DoSetClientSize(int width, int height); | |
32b8ec41 | 116 | |
4116c221 VZ |
117 | virtual void DoCaptureMouse(); |
118 | virtual void DoReleaseMouse(); | |
119 | ||
a4bbc9f7 VS |
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); | |
cbe0afe0 | 125 | |
32b8ec41 | 126 | private: |
a4bbc9f7 VS |
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 | ||
0bd63eb6 GT |
135 | DECLARE_DYNAMIC_CLASS(wxWindowMGL) |
136 | DECLARE_NO_COPY_CLASS(wxWindowMGL) | |
a4bbc9f7 VS |
137 | DECLARE_EVENT_TABLE() |
138 | ||
139 | public: | |
140 | void HandlePaint(MGLDevCtx *dc); | |
141 | // needed by wxWindowPainter | |
7bdc1879 | 142 | MGLDevCtx *GetPaintMGLDC() const { return m_paintMGLDC; } |
32b8ec41 VZ |
143 | }; |
144 | ||
a4bbc9f7 VS |
145 | |
146 | #endif | |
147 | // _WX_WINDOW_H_ |