]>
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-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 | // implement base class (pure) virtual methods | |
52 | // ------------------------------------------- | |
53 | ||
54 | virtual void SetLabel( const wxString &WXUNUSED(label) ) {} | |
55 | virtual wxString GetLabel() const { return wxEmptyString; } | |
56 | ||
57 | virtual void Raise(); | |
58 | virtual void Lower(); | |
59 | ||
60 | virtual bool Show(bool show = true); | |
61 | ||
62 | virtual void SetFocus(); | |
63 | ||
64 | virtual bool Reparent(wxWindowBase *newParent); | |
65 | ||
66 | virtual void WarpPointer(int x, int y); | |
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 | virtual WXWidget GetHandle() const { return m_wnd; } | |
95 | ||
96 | void SetMGLwindow_t(struct window_t *wnd); | |
97 | ||
98 | // implementation from now on | |
99 | // -------------------------- | |
100 | ||
101 | void OnInternalIdle(); | |
102 | ||
103 | protected: | |
104 | // the window handle | |
105 | struct window_t *m_wnd; | |
106 | // whether there should be wxEraseEvent before wxPaintEvent or not | |
107 | // (see wxWindow::Refresh) | |
108 | bool m_frozen:1; | |
109 | bool m_refreshAfterThaw:1; | |
110 | int m_eraseBackground; | |
111 | ||
112 | // implement the base class pure virtuals | |
113 | virtual void DoClientToScreen( int *x, int *y ) const; | |
114 | virtual void DoScreenToClient( int *x, int *y ) const; | |
115 | virtual void DoGetPosition( int *x, int *y ) const; | |
116 | virtual void DoGetSize( int *width, int *height ) const; | |
117 | virtual void DoGetClientSize( int *width, int *height ) const; | |
118 | virtual void DoSetSize(int x, int y, | |
119 | int width, int height, | |
120 | int sizeFlags = wxSIZE_AUTO); | |
121 | virtual void DoSetClientSize(int width, int height); | |
122 | ||
123 | virtual void DoCaptureMouse(); | |
124 | virtual void DoReleaseMouse(); | |
125 | ||
126 | // move the window to the specified location and resize it: this is called | |
127 | // from both DoSetSize() and DoSetClientSize() and would usually just call | |
128 | // ::MoveWindow() except for composite controls which will want to arrange | |
129 | // themselves inside the given rectangle | |
130 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
131 | ||
132 | private: | |
133 | // common part of all ctors | |
134 | void Init(); | |
135 | // counterpart to SetFocus | |
136 | void KillFocus(); | |
137 | ||
138 | MGLDevCtx *m_paintMGLDC; | |
139 | friend class wxPaintDC; | |
140 | ||
141 | DECLARE_DYNAMIC_CLASS(wxWindowMGL) | |
142 | DECLARE_NO_COPY_CLASS(wxWindowMGL) | |
143 | DECLARE_EVENT_TABLE() | |
144 | ||
145 | public: | |
146 | void HandlePaint(MGLDevCtx *dc); | |
147 | // needed by wxWindowPainter | |
148 | MGLDevCtx *GetPaintMGLDC() const { return m_paintMGLDC; } | |
149 | }; | |
150 | ||
151 | ||
152 | #endif // _WX_WINDOW_H_ |