making sure an empty label is not reserving place above, fixes #11123

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-08-19 12:39:49 +00:00
parent 38e23f1020
commit aa30d6c896

View File

@@ -30,6 +30,37 @@
@end
namespace
{
class wxStaticBoxCocoaImpl : public wxWidgetCocoaImpl
{
public:
wxStaticBoxCocoaImpl(wxWindowMac *wxpeer, wxNSBox *v)
: wxWidgetCocoaImpl(wxpeer, v)
{
}
virtual void SetLabel( const wxString& title, wxFontEncoding encoding )
{
if (title.empty())
[GetNSBox() setTitlePosition:NSNoTitle];
else
[GetNSBox() setTitlePosition:NSAtTop];
wxWidgetCocoaImpl::SetLabel(title, encoding);
}
private:
NSBox *GetNSBox() const
{
wxASSERT( [m_osxView isKindOfClass:[NSBox class]] );
return static_cast<NSBox*>(m_osxView);
}
};
} // anonymous namespace
wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
wxWindowMac* WXUNUSED(parent),
wxWindowID WXUNUSED(id),
@@ -41,7 +72,7 @@ wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
{
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v );
c->SetFlipped(false);
return c;
}