From: David Elliott Date: Fri, 10 Aug 2007 20:12:06 +0000 (+0000) Subject: Fix up NSSlider code to not use class posing and instantiate the proper type (now... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/90f6792f530002cf3718b0ab0ce7727be1d21729?ds=sidebyside Fix up NSSlider code to not use class posing and instantiate the proper type (now WXNSSlider) from slider.mm. Copyright 2007 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/Makefile.in b/Makefile.in index 619ce63b9c..355324832e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2177,6 +2177,7 @@ COND_TOOLKIT_COCOA_GUI_HDR = \ wx/cocoa/NSMenu.h \ wx/cocoa/NSPanel.h \ wx/cocoa/NSScroller.h \ + wx/cocoa/NSSlider.h \ wx/cocoa/NSTabView.h \ wx/cocoa/NSTableView.h \ wx/cocoa/NSTextField.h \ @@ -2519,6 +2520,7 @@ COND_TOOLKIT_MAC_GUI_HDR = \ @COND_TOOLKIT_MAC@GUI_HDR = $(COND_TOOLKIT_MAC_GUI_HDR) COND_TOOLKIT_MOTIF_GUI_HDR = \ wx/generic/colrdlgg.h \ + wx/generic/ctrlsub.h \ wx/generic/dirdlgg.h \ wx/generic/fdrepdlg.h \ wx/generic/fontdlgg.h \ @@ -2541,6 +2543,7 @@ COND_TOOLKIT_MOTIF_GUI_HDR = \ wx/motif/colour.h \ wx/motif/combobox.h \ wx/motif/control.h \ + wx/motif/ctrlsub.h \ wx/motif/cursor.h \ wx/motif/dataform.h \ wx/motif/dataobj.h \ @@ -2600,6 +2603,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/combo.h \ wx/msw/combobox.h \ wx/msw/control.h \ + wx/msw/ctrlsub.h \ wx/msw/cursor.h \ wx/msw/dc.h \ wx/msw/dcclient.h \ @@ -2792,6 +2796,7 @@ COND_TOOLKIT_WINCE_GUI_HDR = \ wx/msw/combo.h \ wx/msw/combobox.h \ wx/msw/control.h \ + wx/msw/ctrlsub.h \ wx/msw/cursor.h \ wx/msw/dc.h \ wx/msw/dcclient.h \ @@ -3025,6 +3030,7 @@ COND_WXUNIV_1_ADVANCED_HDR = \ @COND_USE_GUI_1_WXUNIV_0@GUI_CORE_HEADERS = $(GUI_HDR) COND_USE_GUI_1_WXUNIV_1_GUI_CORE_HEADERS = \ wx/generic/accel.h \ + wx/generic/ctrlsub.h \ wx/generic/dirdlgg.h \ wx/generic/fdrepdlg.h \ wx/generic/fontdlgg.h \ @@ -4341,6 +4347,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS = \ monodll_NSMenu.o \ monodll_NSPanel.o \ monodll_NSScroller.o \ + monodll_NSSlider.o \ monodll_NSTabView.o \ monodll_NSTableView.o \ monodll_NSTextField.o \ @@ -6184,6 +6191,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_1 = \ monolib_NSMenu.o \ monolib_NSPanel.o \ monolib_NSScroller.o \ + monolib_NSSlider.o \ monolib_NSTabView.o \ monolib_NSTableView.o \ monolib_NSTextField.o \ @@ -8303,6 +8311,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_2 = \ coredll_NSMenu.o \ coredll_NSPanel.o \ coredll_NSScroller.o \ + coredll_NSSlider.o \ coredll_NSTabView.o \ coredll_NSTableView.o \ coredll_NSTextField.o \ @@ -9758,6 +9767,7 @@ COND_TOOLKIT_COCOA___GUI_SRC_OBJECTS_3 = \ corelib_NSMenu.o \ corelib_NSPanel.o \ corelib_NSScroller.o \ + corelib_NSSlider.o \ corelib_NSTabView.o \ corelib_NSTableView.o \ corelib_NSTextField.o \ @@ -13880,6 +13890,9 @@ monodll_NSPanel.o: $(srcdir)/src/cocoa/NSPanel.mm $(MONODLL_ODEP) monodll_NSScroller.o: $(srcdir)/src/cocoa/NSScroller.mm $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/cocoa/NSScroller.mm +monodll_NSSlider.o: $(srcdir)/src/cocoa/NSSlider.mm $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/cocoa/NSSlider.mm + monodll_NSTabView.o: $(srcdir)/src/cocoa/NSTabView.mm $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/cocoa/NSTabView.mm @@ -18197,6 +18210,9 @@ monolib_NSPanel.o: $(srcdir)/src/cocoa/NSPanel.mm $(MONOLIB_ODEP) monolib_NSScroller.o: $(srcdir)/src/cocoa/NSScroller.mm $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/cocoa/NSScroller.mm +monolib_NSSlider.o: $(srcdir)/src/cocoa/NSSlider.mm $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/cocoa/NSSlider.mm + monolib_NSTabView.o: $(srcdir)/src/cocoa/NSTabView.mm $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/cocoa/NSTabView.mm @@ -23840,6 +23856,9 @@ coredll_NSPanel.o: $(srcdir)/src/cocoa/NSPanel.mm $(COREDLL_ODEP) coredll_NSScroller.o: $(srcdir)/src/cocoa/NSScroller.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/cocoa/NSScroller.mm +coredll_NSSlider.o: $(srcdir)/src/cocoa/NSSlider.mm $(COREDLL_ODEP) + $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/cocoa/NSSlider.mm + coredll_NSTabView.o: $(srcdir)/src/cocoa/NSTabView.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/cocoa/NSTabView.mm @@ -26795,6 +26814,9 @@ corelib_NSPanel.o: $(srcdir)/src/cocoa/NSPanel.mm $(CORELIB_ODEP) corelib_NSScroller.o: $(srcdir)/src/cocoa/NSScroller.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/cocoa/NSScroller.mm +corelib_NSSlider.o: $(srcdir)/src/cocoa/NSSlider.mm $(CORELIB_ODEP) + $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/cocoa/NSSlider.mm + corelib_NSTabView.o: $(srcdir)/src/cocoa/NSTabView.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/cocoa/NSTabView.mm diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 6b0f4a766c..8a0d1823bc 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2407,6 +2407,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/cocoa/NSMenu.mm src/cocoa/NSPanel.mm src/cocoa/NSScroller.mm + src/cocoa/NSSlider.mm src/cocoa/NSTabView.mm src/cocoa/NSTableView.mm src/cocoa/NSTextField.mm @@ -2497,6 +2498,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/cocoa/NSMenu.h wx/cocoa/NSPanel.h wx/cocoa/NSScroller.h + wx/cocoa/NSSlider.h wx/cocoa/NSTabView.h wx/cocoa/NSTableView.h wx/cocoa/NSTextField.h diff --git a/include/wx/cocoa/objc/NSSlider.h b/include/wx/cocoa/objc/NSSlider.h new file mode 100644 index 0000000000..776d71cf0b --- /dev/null +++ b/include/wx/cocoa/objc/NSSlider.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/cocoa/objc/NSView.h +// Purpose: WXNSSlider class +// Author: David Elliott +// Modified by: +// Created: 2007/08/10 (move from NSSlider.mm) +// RCS-ID: $Id$ +// Copyright: (c) 2007 Software 2000 Ltd. +// Licence: wxWidgets licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_COCOA_OBJC_NSSLIDER_H__ +#define __WX_COCOA_OBJC_NSSLIDER_H__ + +#include "wx/cocoa/objc/objc_uniquifying.h" + +#import + +// ============================================================================ +// @class WXNSSlider +// ============================================================================ + +@interface WXNSSlider : NSSlider +@end + +WX_DECLARE_GET_OBJC_CLASS(WXNSSlider,NSSlider) + +// ============================================================================ +// @class WXNSSliderCell +// ============================================================================ + +@interface WXNSSliderCell : NSSliderCell +@end + +WX_DECLARE_GET_OBJC_CLASS(WXNSSliderCell,NSSliderCell) + +#endif //ndef __WX_COCOA_OBJC_NSSLIDER_H__ diff --git a/src/cocoa/NSSlider.mm b/src/cocoa/NSSlider.mm index 8ab3be3c1c..5ea545ba4c 100644 --- a/src/cocoa/NSSlider.mm +++ b/src/cocoa/NSSlider.mm @@ -2,7 +2,7 @@ // Name: src/cocoa/NSSlider.mm // Purpose: wxCocoaNSSlider class // Author: Mark Oxenham -// Modified by: +// Modified by: David Elliott // Created: 2007/08/10 // RCS-ID: $Id$ // Copyright: (c) 2007 Software 2000 Ltd. All rights reserved. @@ -15,13 +15,12 @@ #include "wx/log.h" #endif // WX_PRECOMP -#include "wx/cocoa/ObjcPose.h" #include "wx/cocoa/NSSlider.h" #import #import #import -#import +#include "wx/cocoa/objc/NSSlider.h" WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSSlider) @@ -135,14 +134,17 @@ WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSSlider) @end // implementation wxNSSliderTarget // ============================================================================ -// @class wxPoserNSSlider +// @class WXNSSlider // ============================================================================ -@interface wxPoserNSSlider : NSSlider -@end -WX_IMPLEMENT_POSER(wxPoserNSSlider); -@implementation wxPoserNSSlider : NSSlider +@implementation WXNSSlider : NSSlider + +// Override to ensure that WXNSSlider gets created with a WXNSSliderCell ++ (Class)cellClass +{ + return [WX_GET_OBJC_CLASS(WXNSSliderCell) class]; +} - (void)keyDown:(NSEvent *)theEvent { @@ -224,20 +226,17 @@ WX_IMPLEMENT_POSER(wxPoserNSSlider); } @end +WX_IMPLEMENT_GET_OBJC_CLASS(WXNSSlider,NSSlider) // ============================================================================ -// @class wxPoserNSSliderCell +// @class WXNSSliderCell // ============================================================================ #define kwxNSSliderStartTracking @"wxNSSliderStartTracking" #define kwxNSSliderContinueTracking @"wxNSSliderContinueTracking" #define kwxNSSliderStopTracking @"wxNSSliderStopTracking" -@interface wxPoserNSSliderCell : NSSliderCell -@end - -WX_IMPLEMENT_POSER(wxPoserNSSliderCell); -@implementation wxPoserNSSliderCell : NSSliderCell +@implementation WXNSSliderCell : NSSliderCell - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView { BOOL result = [super startTrackingAt:startPoint inView:controlView]; @@ -258,6 +257,7 @@ WX_IMPLEMENT_POSER(wxPoserNSSliderCell); [[NSNotificationCenter defaultCenter] postNotificationName:kwxNSSliderStopTracking object:controlView]; } @end +WX_IMPLEMENT_GET_OBJC_CLASS(WXNSSliderCell,NSSliderCell) // ============================================================================ // @class wxNSSliderNotificationObserver diff --git a/src/cocoa/slider.mm b/src/cocoa/slider.mm index 0f0fdc364a..fe6c0e8597 100644 --- a/src/cocoa/slider.mm +++ b/src/cocoa/slider.mm @@ -21,7 +21,7 @@ #include "wx/app.h" #endif //WX_PRECOMP -#import +#include "wx/cocoa/objc/NSSlider.h" IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) BEGIN_EVENT_TABLE(wxSlider, wxSliderBase) @@ -67,7 +67,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID winid, if(!CreateControl(parent,winid,pos,size,style,validator,name)) return false; - SetNSView([[NSSlider alloc] initWithFrame: MakeDefaultNSRect(size)]); + SetNSView([[WX_GET_OBJC_CLASS(WXNSSlider) alloc] initWithFrame: MakeDefaultNSRect(size)]); [m_cocoaNSView release]; if(m_parent)