]> git.saurik.com Git - wxWidgets.git/commitdiff
making sure an empty label is not reserving place above, fixes #11123
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 19 Aug 2009 12:39:49 +0000 (12:39 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 19 Aug 2009 12:39:49 +0000 (12:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/statbox.mm

index c9dcb0cf584ecb287ed6f73bd7aab67a90524099..d36fde1d357fabd4a8038f20abacfb1bfaa4e95f 100644 (file)
 
 @end
 
 
 @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), 
 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];
 {
     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;
 }
     c->SetFlipped(false);
     return c;
 }