]> git.saurik.com Git - wxWidgets.git/blob - src/osx/iphone/button.mm
8ee98a3571be49d712249eb2cea84ec83e7d2736
[wxWidgets.git] / src / osx / iphone / button.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/button.mm
3 // Purpose: wxButton
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #include "wx/button.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/panel.h"
17 #include "wx/toplevel.h"
18 #include "wx/dcclient.h"
19 #endif
20
21 #include "wx/stockitem.h"
22
23 #include "wx/osx/private.h"
24
25 @implementation wxUIButton
26
27 + (void)initialize
28 {
29 static BOOL initialized = NO;
30 if (!initialized)
31 {
32 initialized = YES;
33 wxOSXIPhoneClassAddWXMethods( self );
34 }
35 }
36
37 - (int) intValue
38 {
39 return 0;
40 }
41
42 - (void) setIntValue: (int) v
43 {
44 }
45
46 @end
47
48
49 wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
50 wxWindowMac* WXUNUSED(parent),
51 wxWindowID id,
52 const wxString& WXUNUSED(label),
53 const wxPoint& pos,
54 const wxSize& size,
55 long WXUNUSED(style),
56 long WXUNUSED(extraStyle))
57 {
58 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
59 UIButtonType buttonType = UIButtonTypeRoundedRect;
60
61 if ( id == wxID_HELP )
62 {
63 buttonType = UIButtonTypeInfoDark;
64 }
65
66 UIButton* v = [[UIButton buttonWithType:buttonType] retain];
67 v.frame = r;
68 wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
69 return c;
70 }
71
72 void wxWidgetIPhoneImpl::SetDefaultButton( bool isDefault )
73 {
74 }
75
76 void wxWidgetIPhoneImpl::PerformClick()
77 {
78 }
79
80 wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer,
81 wxWindowMac* WXUNUSED(parent),
82 wxWindowID WXUNUSED(id),
83 const wxString& label,
84 const wxPoint& pos,
85 const wxSize& size,
86 long WXUNUSED(style),
87 long WXUNUSED(extraStyle))
88 {
89 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
90 wxUIButton* v = [[wxUIButton alloc] initWithFrame:r];
91 [v setTitle:wxCFStringRef( label).AsNSString() forState:UIControlStateNormal];
92 wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
93 return c;
94 }