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