Make appropriate use of MakeDefaultNSRect and SetInitialFrameRect
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user