streamlining slider, scroller, spinbutton for osx carbon and cocoa

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-01-20 14:27:26 +00:00
parent 9623be70d0
commit 19c7ac3d3b
19 changed files with 408 additions and 299 deletions

View File

@@ -365,7 +365,8 @@ public :
virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 );
virtual SInt32 GetMaximum() const;
virtual wxInt32 GetMaximum() const;
virtual wxInt32 GetMinimum() const;
virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum );
virtual void SetRange( SInt32 minimum , SInt32 maximum );

View File

@@ -114,6 +114,8 @@ public :
bool ButtonClickDidStateChange() { return true ;}
void SetMinimum( wxInt32 v );
void SetMaximum( wxInt32 v );
wxInt32 GetMinimum() const;
wxInt32 GetMaximum() const;
void PulseGauge();
void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
@@ -219,16 +221,14 @@ protected :
- (void)mouseExited:(NSEvent *)event;\
- (void)keyDown:(NSEvent *)event;\
- (void)keyUp:(NSEvent *)event;\
- (BOOL)performKeyEquivalent:(NSEvent *)event;\
- (void)flagsChanged:(NSEvent *)event;\
- (BOOL) becomeFirstResponder;\
- (BOOL) resignFirstResponder;
- (BOOL)becomeFirstResponder;\
- (BOOL)resignFirstResponder;\
- (void)resetCursorRects;
#define WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION -(void)mouseDown:(NSEvent *)event \
{\
if ( !impl->DoHandleMouseEvent(event) )\
[super mouseDown:event];\
}\
-(void)rightMouseDown:(NSEvent *)event\
#define WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION_NO_MOUSEDOWN -(void)rightMouseDown:(NSEvent *)event\
{\
if ( !impl->DoHandleMouseEvent(event) )\
[super rightMouseDown:event];\
@@ -288,6 +288,12 @@ protected :
if ( !impl->DoHandleMouseEvent(event) )\
[super mouseExited:event];\
}\
-(BOOL)performKeyEquivalent:(NSEvent *)event\
{\
if ( !impl->DoHandleKeyEvent(event) )\
return [super performKeyEquivalent:event];\
return YES;\
}\
-(void)keyDown:(NSEvent *)event\
{\
if ( !impl->DoHandleKeyEvent(event) )\
@@ -316,8 +322,31 @@ protected :
if ( r )\
impl->DoNotifyFocusEvent( false );\
return r;\
}\
- (void) resetCursorRects\
{\
if ( impl )\
{\
wxWindow* wxpeer = impl->GetWXPeer();\
if ( wxpeer )\
{\
NSCursor *cursor = (NSCursor*)wxpeer->GetCursor().GetHCURSOR();\
if (cursor == NULL)\
[super resetCursorRects];\
else\
[self addCursorRect: [self bounds]\
cursor: cursor];\
}\
}\
}
#define WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION -(void)mouseDown:(NSEvent *)event \
{\
if ( !impl->DoHandleMouseEvent(event) )\
[super mouseDown:event];\
}\
WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION_NO_MOUSEDOWN
#define WXCOCOAIMPL_COMMON_MEMBERS wxWidgetCocoaImpl* impl;
#define WXCOCOAIMPL_COMMON_INTERFACE \
@@ -326,8 +355,7 @@ protected :
- (BOOL) isFlipped;\
WXCOCOAIMPL_COMMON_EVENTS_INTERFACE
#define WXCOCOAIMPL_COMMON_IMPLEMENTATION WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION \
- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation\
#define WXCOCOAIMPL_COMMON_IMPLEMENTATION_BASE - (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation\
{\
impl = theImplementation;\
}\
@@ -335,24 +363,28 @@ protected :
{\
return impl;\
}\
#define WXCOCOAIMPL_COMMON_IMPLEMENTATION WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION \
WXCOCOAIMPL_COMMON_IMPLEMENTATION_BASE \
- (BOOL) isFlipped\
{\
return YES;\
}\
}
#define WXCOCOAIMPL_COMMON_IMPLEMENTATION_NO_MOUSEDOWN WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION_NO_MOUSEDOWN \
WXCOCOAIMPL_COMMON_IMPLEMENTATION_BASE \
- (BOOL) isFlipped\
{\
return YES;\
}
#define WXCOCOAIMPL_COMMON_IMPLEMENTATION_NOT_FLIPPED WXCOCOAIMPL_COMMON_EVENTS_IMPLEMENTATION \
- (void)setImplementation: (wxWidgetCocoaImpl *) theImplementation\
{\
impl = theImplementation;\
}\
- (wxWidgetCocoaImpl*) implementation\
{\
return impl;\
}\
WXCOCOAIMPL_COMMON_IMPLEMENTATION_BASE \
- (BOOL) isFlipped\
{\
return NO;\
}\
}
// used for many wxControls

View File

@@ -233,6 +233,8 @@ public :
virtual void Enable( bool enable ) = 0;
virtual void SetMinimum( wxInt32 v ) = 0;
virtual void SetMaximum( wxInt32 v ) = 0;
virtual wxInt32 GetMinimum() const = 0;
virtual wxInt32 GetMaximum() const = 0;
virtual void PulseGauge() = 0;
virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0;

View File

@@ -48,11 +48,7 @@ public:
// implementation only from now on
void Command(wxCommandEvent& event);
#if wxOSX_USE_CARBON
virtual void MacHandleControlClick( WXWidget control ,
wxInt16 controlpart ,
bool mouseStillDown ) ;
#endif
virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
virtual bool HandleClicked( double timestampsec );
protected:
virtual wxSize DoGetBestSize() const;

View File

@@ -77,8 +77,8 @@ public:
void Command(wxCommandEvent& event);
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown);
virtual bool HandleClicked( double timestampsec );
virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
protected:
virtual wxSize DoGetBestSize() const;

View File

@@ -58,9 +58,8 @@ public:
// implementation
#if wxOSX_USE_CARBON
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
#endif
virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );

View File

@@ -162,7 +162,7 @@ public:
wxWindowMac *FindItem(long id) const;
wxWindowMac *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const;
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
virtual void TriggerScrollEvent( wxEventType scrollEvent ) ;
virtual bool MacDoRedraw( void* updatergn , long time ) ;
// this should not be overriden in classes above wxWindowMac
@@ -252,6 +252,7 @@ public:
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
virtual bool HandleKeyEvent( wxKeyEvent& event );
protected:
// For controls like radio buttons which are genuinely composite
wxList m_subControls;