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
This commit is contained in:
David Elliott 2007-08-10 20:12:06 +00:00
parent d89e391b21
commit 90f6792f53
5 changed files with 77 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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 <AppKit/NSSlider.h>
// ============================================================================
// @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__

View File

@ -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 <Foundation/NSNotification.h>
#import <Foundation/NSString.h>
#import <AppKit/NSEvent.h>
#import <AppKit/NSSlider.h>
#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

View File

@ -21,7 +21,7 @@
#include "wx/app.h"
#endif //WX_PRECOMP
#import <AppKit/NSSlider.h>
#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)