]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/mgl/window.h | |
3 | // Purpose: wxWindow class | |
4 | // Author: Vaclav Slavik | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 2001 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 | #ifdef __GNUG__ | |
18 | #pragma interface "window.h" | |
19 | #endif | |
20 | ||
21 | #include "wx/font.h" | |
22 | ||
23 | struct window_t; | |
24 | class MGLDevCtx; | |
25 | ||
26 | // --------------------------------------------------------------------------- | |
27 | // wxWindow declaration for MGL | |
28 | // --------------------------------------------------------------------------- | |
29 | ||
30 | class WXDLLEXPORT wxWindowMGL : public wxWindowBase | |
31 | { | |
32 | public: | |
33 | wxWindowMGL() { Init(); } | |
34 | ||
35 | wxWindowMGL(wxWindow *parent, | |
36 | wxWindowID id, | |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, | |
39 | long style = 0, | |
40 | const wxString& name = wxPanelNameStr) | |
41 | { | |
42 | Init(); | |
43 | Create(parent, id, pos, size, style, name); | |
44 | } | |
45 | ||
46 | virtual ~wxWindowMGL(); | |
47 | ||
48 | bool Create(wxWindow *parent, | |
49 | wxWindowID id, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | long style = 0, | |
53 | const wxString& name = wxPanelNameStr); | |
54 | ||
55 | virtual void Raise(); | |
56 | virtual void Lower(); | |
57 | ||
58 | virtual bool Show(bool show = TRUE); | |
59 | ||
60 | virtual void SetFocus(); | |
61 | ||
62 | virtual bool Reparent(wxWindowBase *newParent); | |
63 | ||
64 | virtual void WarpPointer(int x, int y); | |
65 | virtual void CaptureMouse(); | |
66 | virtual void ReleaseMouse(); | |
67 | ||
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(); | |
74 | ||
75 | virtual bool SetCursor(const wxCursor &cursor); | |
76 | virtual bool SetFont(const wxFont &font) { m_font = font; return TRUE; } | |
77 | ||
78 | virtual int GetCharHeight() const; | |
79 | virtual int GetCharWidth() const; | |
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) | |
85 | const; | |
86 | ||
87 | #if wxUSE_DRAG_AND_DROP | |
88 | virtual void SetDropTarget(wxDropTarget *dropTarget); | |
89 | #endif // wxUSE_DRAG_AND_DROP | |
90 | ||
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); | |
98 | ||
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; } | |
105 | ||
106 | // implementation from now on | |
107 | // -------------------------- | |
108 | ||
109 | protected: | |
110 | // the window handle | |
111 | struct window_t *m_wnd; | |
112 | // whether there should be wxEraseEvent before wxPaintEvent or not | |
113 | // (see wxWindow::Refresh) | |
114 | bool m_frozen; | |
115 | bool m_refreshAfterThaw; | |
116 | ||
117 | // implement the base class pure virtuals | |
118 | virtual void DoClientToScreen( int *x, int *y ) const; | |
119 | virtual void DoScreenToClient( int *x, int *y ) const; | |
120 | virtual void DoGetPosition( int *x, int *y ) const; | |
121 | virtual void DoGetSize( int *width, int *height ) const; | |
122 | virtual void DoGetClientSize( int *width, int *height ) const; | |
123 | virtual void DoSetSize(int x, int y, | |
124 | int width, int height, | |
125 | int sizeFlags = wxSIZE_AUTO); | |
126 | virtual void DoSetClientSize(int width, int height); | |
127 | ||
128 | // move the window to the specified location and resize it: this is called | |
129 | // from both DoSetSize() and DoSetClientSize() and would usually just call | |
130 | // ::MoveWindow() except for composite controls which will want to arrange | |
131 | // themselves inside the given rectangle | |
132 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
133 | ||
134 | private: | |
135 | // common part of all ctors | |
136 | void Init(); | |
137 | // counterpart to SetFocus | |
138 | void KillFocus(); | |
139 | ||
140 | MGLDevCtx *m_paintMGLDC; | |
141 | friend class wxPaintDC; | |
142 | ||
143 | DECLARE_DYNAMIC_CLASS(wxWindowMGL); | |
144 | DECLARE_NO_COPY_CLASS(wxWindowMGL); | |
145 | DECLARE_EVENT_TABLE() | |
146 | ||
147 | public: | |
148 | void HandlePaint(MGLDevCtx *dc); | |
149 | // needed by wxWindowPainter | |
150 | MGLDevCtx *GetPaintMGLDC() const { return m_paintMGLDC; } | |
151 | }; | |
152 | ||
153 | ||
154 | #endif | |
155 | // _WX_WINDOW_H_ |