- bounds.bottom = bounds.top + maxHeight ;
- wxpeer->SetMaxSize( wxSize( wxpeer->GetMaxWidth() , maxHeight ));
- err = CreatePushButtonControl(
- MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
- &bounds, CFSTR(""), peer->GetControlRefAddr() );
+ }
+
+
+private:
+ NSButton *GetNSButton() const
+ {
+ wxASSERT( [m_osxView isKindOfClass:[NSButton class]] );
+
+ return static_cast<NSButton *>(m_osxView);
+ }
+};
+
+} // anonymous namespace
+
+extern "C" void SetBezelStyleFromBorderFlags(NSButton *v, long style);
+
+// set bezel style depending on the wxBORDER_XXX flags specified by the style
+void SetBezelStyleFromBorderFlags(NSButton *v, long style)
+{
+ if ( style & wxBORDER_NONE )
+ {
+ [v setBezelStyle:NSShadowlessSquareBezelStyle];
+ [v setBordered:NO];
+ }
+ else // we do have a border
+ {
+ // see trac #11128 for a thorough discussion
+ if ( (style & wxBORDER_MASK) == wxBORDER_RAISED )
+ [v setBezelStyle:NSRegularSquareBezelStyle];
+ else if ( (style & wxBORDER_MASK) == wxBORDER_SUNKEN )
+ [v setBezelStyle:NSSmallSquareBezelStyle];
+ else
+ [v setBezelStyle:NSShadowlessSquareBezelStyle];
+ }
+}
+
+
+wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos,
+ const wxSize& size,
+ long WXUNUSED(style),
+ long WXUNUSED(extraStyle))
+{
+ NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
+ wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
+
+ // We can't display a custom label inside a button with help bezel style so
+ // we only use it if we are using the default label. wxButton itself checks
+ // if the label is just "Help" in which case it discards it and passes us
+ // an empty string.
+ if ( id == wxID_HELP && label.empty() )
+ {
+ [v setBezelStyle:NSHelpButtonBezelStyle];