]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/window.h
Initial move from C to C++. The functionality of the code should not have
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
66 virtual void Refresh(bool eraseBackground = TRUE,
67 const wxRect *rect = (const wxRect *) NULL);
68 virtual void Update();
69 virtual void Clear();
70 virtual void Freeze();
71 virtual void Thaw();
72
73 virtual bool SetCursor(const wxCursor &cursor);
74 virtual bool SetFont(const wxFont &font) { m_font = font; return TRUE; }
75
76 virtual int GetCharHeight() const;
77 virtual int GetCharWidth() const;
78 virtual void GetTextExtent(const wxString& string,
79 int *x, int *y,
80 int *descent = (int *) NULL,
81 int *externalLeading = (int *) NULL,
82 const wxFont *theFont = (const wxFont *) NULL)
83 const;
84
85 #if wxUSE_DRAG_AND_DROP
86 virtual void SetDropTarget(wxDropTarget *dropTarget);
87 #endif // wxUSE_DRAG_AND_DROP
88
89 // Accept files for dragging
90 virtual void DragAcceptFiles(bool accept);
91
92 virtual WXWidget GetHandle() const { return m_wnd; }
93
94 void SetMGLwindow_t(struct window_t *wnd);
95
96 // implementation from now on
97 // --------------------------
98
99 void OnInternalIdle();
100
101 protected:
102 // the window handle
103 struct window_t *m_wnd;
104 // whether there should be wxEraseEvent before wxPaintEvent or not
105 // (see wxWindow::Refresh)
106 bool m_frozen:1;
107 bool m_refreshAfterThaw:1;
108 int m_eraseBackground;
109
110 // implement the base class pure virtuals
111 virtual void DoClientToScreen( int *x, int *y ) const;
112 virtual void DoScreenToClient( int *x, int *y ) const;
113 virtual void DoGetPosition( int *x, int *y ) const;
114 virtual void DoGetSize( int *width, int *height ) const;
115 virtual void DoGetClientSize( int *width, int *height ) const;
116 virtual void DoSetSize(int x, int y,
117 int width, int height,
118 int sizeFlags = wxSIZE_AUTO);
119 virtual void DoSetClientSize(int width, int height);
120
121 virtual void DoCaptureMouse();
122 virtual void DoReleaseMouse();
123
124 // move the window to the specified location and resize it: this is called
125 // from both DoSetSize() and DoSetClientSize() and would usually just call
126 // ::MoveWindow() except for composite controls which will want to arrange
127 // themselves inside the given rectangle
128 virtual void DoMoveWindow(int x, int y, int width, int height);
129
130 private:
131 // common part of all ctors
132 void Init();
133 // counterpart to SetFocus
134 void KillFocus();
135
136 MGLDevCtx *m_paintMGLDC;
137 friend class wxPaintDC;
138
139 DECLARE_DYNAMIC_CLASS(wxWindowMGL)
140 DECLARE_NO_COPY_CLASS(wxWindowMGL)
141 DECLARE_EVENT_TABLE()
142
143 public:
144 void HandlePaint(MGLDevCtx *dc);
145 // needed by wxWindowPainter
146 MGLDevCtx *GetPaintMGLDC() const { return m_paintMGLDC; }
147 };
148
149
150 #endif
151 // _WX_WINDOW_H_