]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/window.h
b0542e1bfa63a2bb7ae6e018db3b8c95caeec4d9
[wxWidgets.git] / include / wx / cocoa / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/window.h
3 // Purpose: wxWindowCocoa
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2002/12/26
7 // RCS-ID: $Id:
8 // Copyright: (c) 2002 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_WINDOW_H__
13 #define __WX_COCOA_WINDOW_H__
14
15 #include "wx/cocoa/NSView.h"
16
17 // ========================================================================
18 // wxWindowCocoa
19 // ========================================================================
20 class WXDLLEXPORT wxWindowCocoa: public wxWindowBase, protected wxCocoaNSView
21 {
22 DECLARE_DYNAMIC_CLASS(wxWindowCocoa)
23 DECLARE_NO_COPY_CLASS(wxWindowCocoa)
24 DECLARE_EVENT_TABLE()
25 // ------------------------------------------------------------------------
26 // initialization
27 // ------------------------------------------------------------------------
28 public:
29 wxWindowCocoa() { Init(); }
30 inline wxWindowCocoa(wxWindow *parent, wxWindowID winid,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = 0,
34 const wxString& name = wxPanelNameStr)
35 {
36 Init();
37 Create(parent, winid, pos, size, style, name);
38 }
39
40 virtual ~wxWindowCocoa();
41
42 bool Create(wxWindow *parent, wxWindowID winid,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = 0,
46 const wxString& name = wxPanelNameStr);
47 protected:
48 void Init();
49 // ------------------------------------------------------------------------
50 // Cocoa specifics
51 // ------------------------------------------------------------------------
52 public:
53 inline WX_NSView GetNSView() { return m_cocoaNSView; }
54 void CocoaAddChild(wxWindowCocoa *child);
55 void CocoaRemoveFromParent(void);
56 virtual void Cocoa_FrameChanged(void);
57 protected:
58 void SetNSView(WX_NSView cocoaNSView);
59 WX_NSView m_cocoaNSView;
60 WX_NSView m_dummyNSView;
61 // ------------------------------------------------------------------------
62 // Implementation
63 // ------------------------------------------------------------------------
64 public:
65 /* Pure Virtuals */
66 // Raise the window to the top of the Z order
67 virtual void Raise();
68 // Lower the window to the bottom of the Z order
69 virtual void Lower();
70 // Set the focus to this window
71 virtual void SetFocus();
72 // Warp the pointer the given position
73 virtual void WarpPointer(int x_pos, int y_pos) ;
74 // Send the window a refresh event
75 virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
76 // Clear the window
77 virtual void Clear();
78 // Set/get the window's font
79 virtual bool SetFont(const wxFont& f);
80 // inline virtual wxFont& GetFont() const;
81 // Get character size
82 virtual int GetCharHeight() const;
83 virtual int GetCharWidth() const;
84 virtual void GetTextExtent(const wxString& string, int *x, int *y,
85 int *descent = NULL,
86 int *externalLeading = NULL,
87 const wxFont *theFont = NULL) const;
88 // Scroll stuff
89 virtual void SetScrollbar(int orient, int pos, int thumbVisible,
90 int range, bool refresh = TRUE);
91 virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
92 virtual int GetScrollPos(int orient) const;
93 virtual int GetScrollThumb(int orient) const;
94 virtual int GetScrollRange(int orient) const;
95 virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
96 // Get the private handle (platform-dependent)
97 virtual WXWidget GetHandle() const;
98 // Convert client to screen coordinates
99 virtual void DoClientToScreen(int *x, int *y) const;
100 // Convert screen to client coordinates
101 virtual void DoScreenToClient(int *x, int *y) const;
102 // Capture/release mouse
103 virtual void DoCaptureMouse();
104 virtual void DoReleaseMouse();
105 // Get window position, relative to parent (or screen if no parent)
106 virtual void DoGetPosition(int *x, int *y) const;
107 // Get overall window size
108 virtual void DoGetSize(int *width, int *height) const;
109 // Get/set client (application-useable) size
110 virtual void DoGetClientSize(int *width, int *height) const;
111 virtual void DoSetClientSize(int width, int size);
112 // Set overall size and position
113 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
114 virtual void DoMoveWindow(int x, int y, int width, int height);
115 // Popup a menu
116 virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
117
118 /* Other implementation */
119
120 // NOTE: typically Close() is not virtual, but we want this for Cocoa
121 virtual bool Close( bool force = false );
122 virtual bool Show( bool show = true );
123 };
124
125 #endif // __WX_COCOA_WINDOW_H__