]> git.saurik.com Git - wxWidgets.git/blame - src/osx/iphone/nonownedwnd.mm
remove incorrect cast of wxString to char* (unnecessary and breaks wxUSE_STL build)
[wxWidgets.git] / src / osx / iphone / nonownedwnd.mm
CommitLineData
c16b2153 1/////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/cocoa/nonownedwnd.mm
c16b2153
SC
3// Purpose: non owned window for iphone
4// Author: Stefan Csomor
5// Modified by:
6// Created: 2008-06-20
7// RCS-ID: $Id: nonownedwnd.mm 48805 2007-09-19 14:52:25Z SC $
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#include "wx/osx/private.h"
15
16#include "wx/nonownedwnd.h"
17#include "wx/frame.h"
18
19IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl )
20
21wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) :
22 wxNonOwnedWindowImpl(nonownedwnd)
23{
24 m_macWindow = NULL;
25 m_macFullScreenData = NULL;
26}
27
28wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl()
29{
30 m_macWindow = NULL;
31 m_macFullScreenData = NULL;
32}
33
34wxNonOwnedWindowIPhoneImpl::~wxNonOwnedWindowIPhoneImpl()
35{
36 [m_macWindow release];
37}
38
39void wxNonOwnedWindowIPhoneImpl::Destroy()
40{
41 wxPendingDelete.Append( new wxDeferredObjectDeleter( this ) );
42}
43
44void wxNonOwnedWindowIPhoneImpl::Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
45long style, long extraStyle, const wxString& name )
46{
47 m_macWindow = [UIWindow alloc];
48
49 UIWindowLevel level = UIWindowLevelNormal;
50
51 // most styles are not supported on the iphone
52
53 if ( style & wxFRAME_TOOL_WINDOW )
54 {
55 level = UIWindowLevelAlert; ;
56 }
57 else if ( ( style & wxPOPUP_WINDOW ) )
58 {
59 level = UIWindowLevelAlert;;
60 }
61 else if ( ( style & wxCAPTION ) )
62 {
63 }
64 else if ( ( style & wxFRAME_DRAWER ) )
65 {
66 }
67 else
68 {
69 }
70
71 if ( ( style & wxSTAY_ON_TOP ) )
72 level = UIWindowLevelAlert;
73 CGRect r = CGRectMake( 0, 0, size.x, size.y) ;
74
75 [m_macWindow initWithFrame:r ];
76
77 [m_macWindow setWindowLevel:level];
78 // [m_macWindow makeKeyAndOrderFront:nil];
79}
80
81
82WXWindow wxNonOwnedWindowIPhoneImpl::GetWXWindow() const
83{
84 return m_macWindow;
85}
86
87void wxNonOwnedWindowIPhoneImpl::Raise()
88{
89}
90
91void wxNonOwnedWindowIPhoneImpl::Lower()
92{
93}
94
95bool wxNonOwnedWindowIPhoneImpl::Show(bool show)
96{
97 [m_macWindow setHidden:(show ? NO : YES)];
98 if ( show )
99 {
100 //[m_macWindow orderFront: self];
101 [m_macWindow makeKeyWindow];
102 }
103 return true;
104}
105
106bool wxNonOwnedWindowIPhoneImpl::ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout)
107{
108 return Show(show);
109}
110
111void wxNonOwnedWindowIPhoneImpl::Update()
112{
113// TODO [m_macWindow displayIfNeeded];
114}
115
116bool wxNonOwnedWindowIPhoneImpl::SetTransparent(wxByte alpha)
117{
118 [m_macWindow setAlpha:(CGFloat) alpha/255.0];
119 return true;
120}
121
122bool wxNonOwnedWindowIPhoneImpl::SetBackgroundColour(const wxColour& col )
123{
124 return true;
125}
126
127void wxNonOwnedWindowIPhoneImpl::SetExtraStyle( long exStyle )
128{
129 // no special styles supported
130}
131
132bool wxNonOwnedWindowIPhoneImpl::SetBackgroundStyle(wxBackgroundStyle style)
133{
134 return true;
135}
136
137bool wxNonOwnedWindowIPhoneImpl::CanSetTransparent()
138{
139 return true;
140}
141
142void wxNonOwnedWindowIPhoneImpl::MoveWindow(int x, int y, int width, int height)
143{
144 CGRect r = CGRectMake( 0,0,width,height) ;
145 [m_macWindow setFrame:r];
146}
147
148void wxNonOwnedWindowIPhoneImpl::GetPosition( int &x, int &y ) const
149{
150 CGRect r = [m_macWindow frame];
151 x = r.origin.x;
152 y = r.origin.y;
153}
154
155void wxNonOwnedWindowIPhoneImpl::GetSize( int &width, int &height ) const
156{
157 CGRect rect = [m_macWindow frame];
158 width = rect.size.width;
159 height = rect.size.height;
160}
161
162void wxNonOwnedWindowIPhoneImpl::GetContentArea( int& left, int &right, int &width, int &height ) const
163{
164 CGRect rect = [m_macWindow frame];
165 width = rect.size.width;
166 height = rect.size.height;
167 left = 0;
168 right = 0;
169}
170
171bool wxNonOwnedWindowIPhoneImpl::SetShape(const wxRegion& region)
172{
173 return false;
174}
175
176void wxNonOwnedWindowIPhoneImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
177{
178// TODO change title of app ?
179}
180
181bool wxNonOwnedWindowIPhoneImpl::IsMaximized() const
182{
183 return false;
184}
185
186bool wxNonOwnedWindowIPhoneImpl::IsIconized() const
187{
188 return false;
189}
190
191void wxNonOwnedWindowIPhoneImpl::Iconize( bool iconize )
192{
193}
194
195void wxNonOwnedWindowIPhoneImpl::Maximize(bool maximize)
196{
197}
198
199bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const
200{
201 return m_macFullScreenData != NULL ;
202}
203
204bool wxNonOwnedWindowIPhoneImpl::ShowFullScreen(bool show, long style)
205{
206 return true;
207}
208
209void wxNonOwnedWindowIPhoneImpl::RequestUserAttention(int WXUNUSED(flags))
210{
211}
212
213void wxNonOwnedWindowIPhoneImpl::ScreenToWindow( int *x, int *y )
214{
215 CGPoint p = CGPointMake( (x ? *x : 0), (y ? *y : 0) );
216 p = [m_macWindow convertPoint:p fromWindow:nil];
217 if ( x )
218 *x = p.x;
219 if ( y )
220 *y = p.y;
221}
222
223void wxNonOwnedWindowIPhoneImpl::WindowToScreen( int *x, int *y )
224{
225 CGPoint p = CGPointMake( (x ? *x : 0), (y ? *y : 0) );
226 p = [m_macWindow convertPoint:p toWindow:nil];
227 if ( x )
228 *x = p.x;
229 if ( y )
230 *y = p.y;
231}
232
524c47aa
SC
233wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
234 long style, long extraStyle, const wxString& name )
235{
236 wxNonOwnedWindowImpl* now = new wxNonOwnedWindowIPhoneImpl( wxpeer );
237 now->Create( parent, pos, size, style , extraStyle, name );
238 return now;
239}