]> git.saurik.com Git - wxWidgets.git/commitdiff
Make appropriate use of MakeDefaultNSRect and SetInitialFrameRect
authorDavid Elliott <dfe@tgwbd.org>
Wed, 13 Aug 2003 20:28:35 +0000 (20:28 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Wed, 13 Aug 2003 20:28:35 +0000 (20:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
src/cocoa/bmpbuttn.mm
src/cocoa/button.mm
src/cocoa/checkbox.mm
src/cocoa/combobox.mm
src/cocoa/control.mm
src/cocoa/gauge.mm
src/cocoa/radiobox.mm
src/cocoa/radiobut.mm
src/cocoa/slider.mm
src/cocoa/spinbutt.mm
src/cocoa/statbmp.mm
src/cocoa/statbox.mm
src/cocoa/statline2.mm
src/cocoa/stattext.mm

index 2ae02dfdd09fa10c65756d7bfe27974c0947549b..0388a1d9dbbd0b1b3301ef69d18b6ecb0950832c 100644 (file)
@@ -36,9 +36,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     wxLogDebug("Created control with id=%d",GetId());
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
     m_cocoaNSView = NULL;
-    SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
+    SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     // NOTE: YES we want to release this (to match the alloc).
     // DoAddChild(this) will retain us again since addSubView doesn't.
     [m_cocoaNSView release];
@@ -49,6 +48,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
 
     return true;
 }
index 08d2b9853c2fb61a9fd094c127731b3d6ef0b5a8..74a927eb3252ec02f2a22e6981b7f4a4ba98605f 100644 (file)
@@ -36,9 +36,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     wxLogDebug("Created control with id=%d",GetId());
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
     m_cocoaNSView = NULL;
-    SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
+    SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     // NOTE: YES we want to release this (to match the alloc).
     // DoAddChild(this) will retain us again since addSubView doesn't.
     [m_cocoaNSView release];
@@ -49,6 +48,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
 
     return true;
 }
index 921a1d3a287c93dc07d97bfec019ccefcfcc8d6a..1dfd1f63314935f20636309167bec24a80af1fec 100644 (file)
@@ -35,8 +35,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     m_cocoaNSView = NULL;
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
-    SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
+    SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     [GetNSButton() setButtonType: NSSwitchButton];
     [GetNSButton() setTitle:[NSString stringWithCString: label.c_str()]];
@@ -44,6 +43,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index eb3f4b104f705f97c60ae898d6a200c66dfa9de9..ae2b9015fdf4d2f7b2bb9c29e78b1f5203d10141 100644 (file)
@@ -41,12 +41,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID winid,
         return false;
 
     m_cocoaNSView = NULL;
-    SetNSTextField([[NSComboBox alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
+    SetNSTextField([[NSComboBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     [GetNSTextField() setStringValue:wxNSStringWithWxString(value.c_str())];
     [GetNSControl() sizeToFit];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index 1f28f4532b8f4518096eb03b1c71061ef7a4ebb9..d7c80c56c7f7b00813b068ec67278f7a7cba5171 100644 (file)
@@ -33,9 +33,8 @@ bool wxControl::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     wxLogDebug("Created control with id=%d",GetId());
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
     m_cocoaNSView = NULL;
-    SetNSControl([[NSControl alloc] initWithFrame: cocoaRect]);
+    SetNSControl([[NSControl alloc] initWithFrame: MakeDefaultNSRect(size)]);
     // NOTE: YES we want to release this (to match the alloc).
     // DoAddChild(this) will retain us again since addSubView doesn't.
     [m_cocoaNSView release];
@@ -44,6 +43,7 @@ bool wxControl::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
 
     return true;
 }
index 17962bdde9067a3ac229311c5abc497e2a2c5997..aafc5b6b76a717d373b79f18f5c24bb19d89aa5f 100644 (file)
@@ -28,10 +28,12 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID winid, int range,
 {
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
-    SetNSView([[NSProgressIndicator alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSView([[NSProgressIndicator alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index db1e609dcaa7025dd045db8a188b151e20ff3c3f..37cffde012cd28d18ab0a1f61480038e8be19f9d 100644 (file)
@@ -30,10 +30,12 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid,
 {
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
-    SetNSView([[NSView alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index d486f62aded0866133275e489cbe0c125fbbe01d..2ee422760d1bfba71023f35bd87819b01d2fba7a 100644 (file)
@@ -35,8 +35,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     m_cocoaNSView = NULL;
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
-    SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
+    SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     [GetNSButton() setButtonType: NSRadioButton];
     [GetNSButton() setTitle:wxNSStringWithWxString(label)];
@@ -44,6 +43,8 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index 7e319e48446b3da55c54278e32e1579ba1770bba..f2fdeb9a83cb5e15e9261b6e6612f34e38e19379 100644 (file)
@@ -29,10 +29,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID winid,
 {
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
-    SetNSView([[NSView alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index ff0c9d11bfd75da3957eb86c2c3957dc4bdfe846..60d3cd59ef6a56d3300fe40e1ae7e1ee3531a601 100644 (file)
@@ -30,10 +30,12 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID winid,
 {
     if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
         return false;
-    SetNSControl([[NSStepper alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSControl([[NSStepper alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index 832ce11acd346e3777f502cd15ae2bfc64451ae9..f288054134e527a14c5a9f136e6b27e2a1d6ed41 100644 (file)
@@ -29,10 +29,12 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
         return false;
     m_cocoaNSView = NULL;
-    SetNSView([[NSView alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index 0a8ecab19054ae54fbea22b2ad31d0e18cfe58db..00a22bc123ba94846934e6e60ebb6dd79740e91a 100644 (file)
@@ -33,10 +33,12 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     m_cocoaNSView = NULL;
-    SetNSBox([[NSBox alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
+    SetNSBox([[NSBox alloc] initWithFrame:MakeDefaultNSRect(size)]);
     [GetNSBox() setTitle:[NSString stringWithCString:title.c_str()]];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index 6afc341f54c869d2d313a19da57ee7befa736f06..75e8da18aec548084c35938e038bdc4c9d26f5a2 100644 (file)
@@ -27,10 +27,12 @@ bool wxStaticLine::Create(wxWindow *parent, wxWindowID winid,
 {
     if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
         return false;
-    SetNSView([[NSView alloc] initWithFrame: NSMakeRect(10,10,20,20)]);
+    SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
index ff30c7cb2f1f82769e84de6a793b8a11720a0705..29e247c9c962632a6a546a62fa8815bb020c0628 100644 (file)
@@ -34,7 +34,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
     if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
         return false;
     m_cocoaNSView = NULL;
-    SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
+    SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     [GetNSTextField() setStringValue:[NSString stringWithCString:label.c_str()]];
 //    [GetNSTextField() setBordered: NO];
@@ -50,6 +50,8 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }