virtual void GetPosition( int &x, int &y ) const = 0;
virtual void GetSize( int &width, int &height ) const = 0;
virtual void SetControlSize( wxWindowVariant variant ) = 0;
+
+ // the native coordinates may have an 'aura' for shadows etc, if this is the case the layout
+ // inset indicates on which insets the real control is drawn
+ virtual void GetLayoutInset(int &left , int &top , int &right, int &bottom) const
+ {
+ left = top = right = bottom = 0;
+ }
// native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin)
virtual bool IsFlipped() const { return true; }
WXWindow MacGetTopLevelWindowRef() const ;
wxNonOwnedWindow* MacGetTopLevelWindow() const ;
+ virtual long MacGetWXBorderSize() const;
virtual long MacGetLeftBorderSize() const ;
virtual long MacGetRightBorderSize() const ;
virtual long MacGetTopBorderSize() const ;
m_peer->GetBestRect(&r);
wxSize sz = r.GetSize();
-
+ sz.x = sz.x + MacGetLeftBorderSize() +
+ MacGetRightBorderSize();
+ sz.y = sz.y + MacGetTopBorderSize() +
+ MacGetBottomBorderSize();
+
const int wBtnStd = GetDefaultSize().x;
if ( (sz.x < wBtnStd) && !HasFlag(wxBU_EXACTFIT) )
wxSize wxButton::GetDefaultSize()
{
- return wxSize(84, 23);
+ return wxSize(84, 20);
}
@implementation wxNSButton
[button setButtonType:NSMomentaryChangeButton];
}
+ void GetLayoutInset(int &left , int &top , int &right, int &bottom) const
+ {
+ left = top = right = bottom = 0;
+ NSControlSize size = NSRegularControlSize;
+ if ( [m_osxView respondsToSelector:@selector(controlSize)] )
+ size = (NSControlSize) [m_osxView controlSize];
+ else if ([m_osxView respondsToSelector:@selector(cell)])
+ {
+ id cell = [(id)m_osxView cell];
+ if ([cell respondsToSelector:@selector(controlSize)])
+ size = [cell controlSize];
+ }
+
+ if ( [GetNSButton() bezelStyle] == NSRoundedBezelStyle )
+ {
+ switch( size )
+ {
+ case NSRegularControlSize:
+ left = right = 6;
+ top = 4;
+ bottom = 8;
+ break;
+ case NSSmallControlSize:
+ left = right = 5;
+ top = 4;
+ bottom = 7;
+ break;
+ case NSMiniControlSize:
+ left = right = 1;
+ top = 0;
+ bottom = 2;
+ break;
+ }
+ }
+ }
+
+
private:
NSButton *GetNSButton() const
{
}
}
-long wxWindowMac::MacGetLeftBorderSize() const
+long wxWindowMac::MacGetWXBorderSize() const
{
if ( IsTopLevel() )
return 0 ;
return border ;
}
+long wxWindowMac::MacGetLeftBorderSize() const
+{
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= left;
+ }
+
+ return border;
+}
+
+
long wxWindowMac::MacGetRightBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= right;
+ }
+
+ return border;
}
long wxWindowMac::MacGetTopBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= top;
+ }
+
+ return border;
}
long wxWindowMac::MacGetBottomBorderSize() const
{
- // they are all symmetric in mac themes
- return MacGetLeftBorderSize() ;
+ // the wx borders are all symmetric in mac themes
+ long border = MacGetWXBorderSize() ;
+
+ if ( m_peer )
+ {
+ int left, top, right, bottom;
+ m_peer->GetLayoutInset( left, top, right, bottom );
+ border -= bottom;
+ }
+
+ return border;
}
long wxWindowMac::MacRemoveBordersFromStyle( long style )