]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/classic/window.h
Fix for link error
[wxWidgets.git] / include / wx / mac / classic / window.h
CommitLineData
52479aef
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: window.h
3// Purpose: wxWindowMac class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
52479aef
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_WINDOW_H_
13#define _WX_WINDOW_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16#pragma interface "window.h"
17#endif
18
19#include "wx/brush.h"
20
21// ---------------------------------------------------------------------------
22// forward declarations
23// ---------------------------------------------------------------------------
24
25class WXDLLEXPORT wxButton;
26class WXDLLEXPORT wxScrollBar;
27class WXDLLEXPORT wxTopLevelWindowMac;
28
29// ---------------------------------------------------------------------------
30// constants
31// ---------------------------------------------------------------------------
32
33class WXDLLEXPORT wxWindowMac: public wxWindowBase
34{
35 DECLARE_DYNAMIC_CLASS(wxWindowMac)
36
37 friend class wxDC;
38 friend class wxPaintDC;
39
40public:
41
42 wxWindowMac()
43 : m_macBackgroundBrush()
44 , m_macVisibleRegion()
45 , m_x(0), m_y(0), m_width(0), m_height(0)
46 , m_hScrollBar(NULL), m_vScrollBar(NULL)
47 , m_label(wxEmptyString)
48 { Init(); }
49
50 wxWindowMac(wxWindowMac *parent,
51 wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = 0,
55 const wxString& name = wxPanelNameStr)
56 {
57 Init();
58 Create(parent, id, pos, size, style, name);
59 }
60
61 virtual ~wxWindowMac();
62
63 bool Create(wxWindowMac *parent,
64 wxWindowID id,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize,
67 long style = 0,
68 const wxString& name = wxPanelNameStr);
69
70
71 // implement base class pure virtuals
72 virtual void SetTitle( const wxString& title);
73 virtual wxString GetTitle() const;
74
75 virtual void Raise();
76 virtual void Lower();
77
78 virtual bool Show( bool show = TRUE );
79 virtual bool Enable( bool enable = TRUE );
80
81 virtual void SetFocus();
82
83 virtual void WarpPointer(int x, int y);
84
85 virtual void Refresh( bool eraseBackground = TRUE,
86 const wxRect *rect = (const wxRect *) NULL );
87
88 virtual bool SetCursor( const wxCursor &cursor );
89 virtual bool SetFont(const wxFont& font)
90 { return wxWindowBase::SetFont(font); }
91 virtual int GetCharHeight() const;
92 virtual int GetCharWidth() const;
93 virtual void GetTextExtent(const wxString& string,
94 int *x, int *y,
95 int *descent = (int *) NULL,
96 int *externalLeading = (int *) NULL,
97 const wxFont *theFont = (const wxFont *) NULL)
98 const;
99
100 virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
101
102 virtual void SetScrollbar( int orient, int pos, int thumbVisible,
103 int range, bool refresh = TRUE );
104 virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
105 virtual int GetScrollPos( int orient ) const;
106 virtual int GetScrollThumb( int orient ) const;
107 virtual int GetScrollRange( int orient ) const;
108 virtual void ScrollWindow( int dx, int dy,
109 const wxRect* rect = (wxRect *) NULL );
110
111#if wxUSE_DRAG_AND_DROP
112 virtual void SetDropTarget( wxDropTarget *dropTarget );
113#endif // wxUSE_DRAG_AND_DROP
114
115 // Accept files for dragging
116 virtual void DragAcceptFiles(bool accept);
117
118 // Native resource loading (implemented in src/msw/nativdlg.cpp)
119 // FIXME: should they really be all virtual?
120 wxWindowMac* GetWindowChild1(wxWindowID id);
121 wxWindowMac* GetWindowChild(wxWindowID id);
122
123 // implementation from now on
124 // --------------------------
125
126 void MacClientToRootWindow( int *x , int *y ) const ;
127 void MacRootWindowToClient( int *x , int *y ) const ;
128 void MacWindowToRootWindow( int *x , int *y ) const ;
129 void MacRootWindowToWindow( int *x , int *y ) const ;
130
131 virtual wxString MacGetToolTipString( wxPoint &where ) ;
132
133 // simple accessors
134 // ----------------
135
136// WXHWND GetHWND() const { return m_hWnd; }
137// void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
138 virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
139
140 bool GetTransparentBackground() const { return m_backgroundTransparent; }
141 void SetTransparent(bool t = TRUE) { m_backgroundTransparent = t; }
142
143 // event handlers
144 // --------------
145 void OnSetFocus(wxFocusEvent& event) ;
146 void OnNcPaint(wxNcPaintEvent& event);
147 void OnEraseBackground(wxEraseEvent& event);
148 void OnMouseEvent( wxMouseEvent &event ) ;
149
150 void MacOnScroll(wxScrollEvent&event ) ;
151
152 bool AcceptsFocus() const ;
153
154public:
155 void OnInternalIdle();
156
157 // For implementation purposes - sometimes decorations make the client area
158 // smaller
159 virtual wxPoint GetClientAreaOrigin() const;
160
161 wxWindowMac *FindItem(long id) const;
162 wxWindowMac *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
163
77ffb593 164 // Make a Windows extended style from the given wxWidgets window style
52479aef
SC
165 static WXDWORD MakeExtendedStyle(long style,
166 bool eliminateBorders = TRUE);
167 // Determine whether 3D effects are wanted
168 WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const;
169
170 // MSW only: TRUE if this control is part of the main control
171 virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
172
173 // Setup background and foreground colours correctly
174 virtual void SetupColours();
175
176public:
177 static bool MacGetWindowFromPoint( const wxPoint &point , wxWindowMac** outWin ) ;
178 virtual bool MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac** outWin ) ;
179 virtual void MacRedraw( WXHRGN updatergn , long time , bool erase) ;
180 virtual bool MacCanFocus() const { return true ; }
181
182 virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ;
183 // this should not be overriden in classes above wxWindowMac because it is called from its destructor via DeleteChildren
184 virtual void RemoveChild( wxWindowBase *child );
185 virtual void MacPaintBorders( int left , int top ) ;
186 WXWindow MacGetRootWindow() const ;
187 wxTopLevelWindowMac* MacGetTopLevelWindow() const ;
188
189 virtual WXWidget MacGetContainerForEmbedding() ;
190
191 virtual long MacGetLeftBorderSize() const ;
192 virtual long MacGetRightBorderSize() const ;
193 virtual long MacGetTopBorderSize() const ;
194 virtual long MacGetBottomBorderSize() const ;
195
196 static long MacRemoveBordersFromStyle( long style ) ;
197 virtual void MacSuperChangedPosition() ;
198 // the absolute coordinates of this item within the toplevel window may have changed
199 virtual void MacUpdateDimensions() {}
200 // the absolute coortinates of this window's root have changed
201 virtual void MacTopLevelWindowChangedPosition() ;
202 virtual void MacSuperShown( bool show ) ;
203 virtual void MacSuperEnabled( bool enable ) ;
204 bool MacIsReallyShown() const ;
205 virtual void Update() ;
206 // for compatibility
207 void MacUpdateImmediately() { Update() ; }
208 virtual bool MacSetupCursor( const wxPoint& pt ) ;
209
210// virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ;
211// virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ;
212// virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ;
213 const wxBrush& MacGetBackgroundBrush() ;
214 const wxRegion& MacGetVisibleRegion( bool respectChildrenAndSiblings = true ) ;
215 bool MacIsWindowScrollbar( const wxScrollBar* sb )
216 { return (m_hScrollBar == sb || m_vScrollBar == sb) ; }
217 static wxWindowMac* s_lastMouseWindow ;
218private:
219protected:
220 wxBrush m_macBackgroundBrush ;
221 wxRegion m_macVisibleRegion ;
222 int m_x ;
223 int m_y ;
224 int m_width ;
225 int m_height ;
226
227 wxScrollBar* m_hScrollBar ;
228 wxScrollBar* m_vScrollBar ;
229 wxString m_label ;
230
231 void MacCreateScrollBars( long style ) ;
232 void MacRepositionScrollBars() ;
233
234 bool m_backgroundTransparent ;
235
236 // implement the base class pure virtuals
237 virtual void DoClientToScreen( int *x, int *y ) const;
238 virtual void DoScreenToClient( int *x, int *y ) const;
239 virtual void DoGetPosition( int *x, int *y ) const;
240 virtual void DoGetSize( int *width, int *height ) const;
241 virtual void DoGetClientSize( int *width, int *height ) const;
242 virtual void DoSetSize(int x, int y,
243 int width, int height,
244 int sizeFlags = wxSIZE_AUTO);
245 virtual void DoSetClientSize(int width, int height);
246
247 virtual void DoCaptureMouse();
248 virtual void DoReleaseMouse();
249
250 // move the window to the specified location and resize it: this is called
251 // from both DoSetSize() and DoSetClientSize() and would usually just call
252 // ::MoveWindow() except for composite controls which will want to arrange
253 // themselves inside the given rectangle
254 virtual void DoMoveWindow(int x, int y, int width, int height);
255
256#if wxUSE_TOOLTIPS
257 virtual void DoSetToolTip( wxToolTip *tip );
258#endif // wxUSE_TOOLTIPS
259
260private:
261 // common part of all ctors
262 void Init();
263
264 DECLARE_NO_COPY_CLASS(wxWindowMac)
265 DECLARE_EVENT_TABLE()
266};
267
268#endif
269 // _WX_WINDOW_H_