1 /////////////////////////////////////////////////////////////////////////////
 
   2 // Name:        src/osx/iphone/button.mm
 
   4 // Author:      Stefan Csomor
 
   7 // RCS-ID:      $Id: button.cpp 54845 2008-07-30 14:52:41Z SC $
 
   8 // Copyright:   (c) Stefan Csomor
 
   9 // Licence:     wxWindows licence
 
  10 /////////////////////////////////////////////////////////////////////////////
 
  12 #include "wx/wxprec.h"
 
  14 #include "wx/button.h"
 
  18     #include "wx/toplevel.h"
 
  19     #include "wx/dcclient.h"
 
  22 #include "wx/stockitem.h"
 
  24 #include "wx/osx/private.h"
 
  26 wxSize wxButton::DoGetBestSize() const
 
  28     if ( GetId() == wxID_HELP )
 
  29         return wxSize( 18 , 18 ) ;
 
  31     wxSize sz = GetDefaultSize() ;
 
  35     m_peer->GetBestRect(&r);
 
  37     if ( r.GetWidth() == 0 && r.GetHeight() == 0 )
 
  45     if ((wBtn > sz.x) || ( GetWindowStyle() & wxBU_EXACTFIT))
 
  51 wxSize wxButton::GetDefaultSize()
 
  56     return wxSize(wBtn, hBtn);
 
  59 @implementation wxUIButton
 
  63     static BOOL initialized = NO;
 
  67         wxOSXIPhoneClassAddWXMethods( self );
 
  76 - (void) setIntValue: (int) v
 
  83 wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
 
  84                                     wxWindowMac* WXUNUSED(parent),
 
  86                                     const wxString& WXUNUSED(label),
 
  90                                     long WXUNUSED(extraStyle))
 
  92     CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
 
  93     UIButtonType buttonType = UIButtonTypeRoundedRect;
 
  95     if ( id == wxID_HELP )
 
  97         buttonType = UIButtonTypeInfoDark;
 
 100     UIButton* v = [[UIButton buttonWithType:buttonType] retain];
 
 102     wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
 
 106 void wxWidgetIPhoneImpl::SetDefaultButton( bool isDefault )
 
 110 void wxWidgetIPhoneImpl::PerformClick()
 
 114 wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer,
 
 115                                     wxWindowMac* WXUNUSED(parent),
 
 116                                     wxWindowID WXUNUSED(id),
 
 117                                     const wxString& label,
 
 120                                     long WXUNUSED(style),
 
 121                                     long WXUNUSED(extraStyle))
 
 123     CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
 
 124     wxUIButton* v = [[wxUIButton alloc] initWithFrame:r];
 
 125     [v setTitle:wxCFStringRef( label).AsNSString() forState:UIControlStateNormal];
 
 126     wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );