X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dd9fdf82749bb5f9e2bf9c2ad1bbd59e0eeb00e..f1d7af8f68fe64084878504ba8ebc6e5cfcfdd54:/src/osx/cocoa/scrolbar.mm diff --git a/src/osx/cocoa/scrolbar.mm b/src/osx/cocoa/scrolbar.mm index 533f5e92dc..4814d87f64 100644 --- a/src/osx/cocoa/scrolbar.mm +++ b/src/osx/cocoa/scrolbar.mm @@ -19,6 +19,7 @@ #include "wx/settings.h" #endif +#include "wx/math.h" #include "wx/osx/private.h" @interface wxNSScroller : NSScroller @@ -67,7 +68,7 @@ public : virtual wxInt32 GetValue() const { - return [(wxNSScroller*) m_osxView floatValue] * m_maximum; + return wxRound([(wxNSScroller*) m_osxView floatValue] * m_maximum); } virtual wxInt32 GetMaximum() const @@ -75,7 +76,7 @@ public : return m_maximum; } - virtual void clickedAction(WXWidget slf, void* _cmd, void *sender); + virtual void controlAction(WXWidget slf, void* _cmd, void *sender); virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); protected: wxInt32 m_maximum; @@ -87,7 +88,7 @@ protected: // to thumbtrack and only after super mouseDown // returns we will call the thumbrelease -void wxOSXScrollBarCocoaImpl::clickedAction( WXWidget slf, void *_cmd, void *sender) +void wxOSXScrollBarCocoaImpl::controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender)) { wxEventType scrollEvent = wxEVT_NULL; switch ([(NSScroller*)m_osxView hitPart]) @@ -136,15 +137,19 @@ void wxOSXScrollBarCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_ } wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), const wxPoint& pos, const wxSize& size, long style, - long extraStyle) + long WXUNUSED(extraStyle)) { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; - wxNSScroller* v = [[wxNSScroller alloc] initWithFrame:r]; + // the creation rect defines the orientation + NSRect createRect = ( style & wxSB_HORIZONTAL ) ? NSMakeRect(r.origin.x, r.origin.y , 17, 16) : + NSMakeRect(r.origin.x, r.origin.y , 16, 17); + wxNSScroller* v = [[wxNSScroller alloc] initWithFrame:createRect]; + [v setFrame:r]; wxWidgetCocoaImpl* c = new wxOSXScrollBarCocoaImpl( wxpeer, v ); [v setEnabled:YES];