]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: cocoa/NSScroller.mm | |
3 | // Purpose: wxCocoaNSScroller | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2004/04/27 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 David Elliott | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | #ifndef WX_PRECOMP | |
14 | #include "wx/log.h" | |
15 | #endif // WX_PRECOMP | |
16 | ||
17 | #include "wx/cocoa/NSScroller.h" | |
18 | #import <AppKit/NSScroller.h> | |
19 | ||
20 | WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSScroller) | |
21 | ||
22 | // ============================================================================ | |
23 | // @class wxNSScrollerTarget | |
24 | // ============================================================================ | |
25 | @interface wxNSScrollerTarget : NSObject | |
26 | { | |
27 | } | |
28 | ||
29 | - (void)wxNSScrollerAction: (id)sender; | |
30 | @end // wxNSScrollerTarget | |
31 | ||
32 | @implementation wxNSScrollerTarget : NSObject | |
33 | - (void)wxNSScrollerAction: (id)sender | |
34 | { | |
35 | wxCocoaNSScroller *scroller = wxCocoaNSScroller::GetFromCocoa(sender); | |
36 | wxCHECK_RET(scroller,wxT("wxNSScrollerAction received without associated wx object")); | |
37 | scroller->Cocoa_wxNSScrollerAction(); | |
38 | } | |
39 | ||
40 | @end // implementation wxNSScrollerTarget | |
41 | ||
42 | // ============================================================================ | |
43 | // class wxCocoaNSScroller | |
44 | // ============================================================================ | |
45 | const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSScroller::sm_cocoaTarget = [[wxNSScrollerTarget alloc] init]; | |
46 | ||
47 | void wxCocoaNSScroller::AssociateNSScroller(WX_NSScroller cocoaNSScroller) | |
48 | { | |
49 | if(cocoaNSScroller) | |
50 | { | |
51 | sm_cocoaHash.insert(wxCocoaNSScrollerHash::value_type(cocoaNSScroller,this)); | |
52 | [cocoaNSScroller setTarget: sm_cocoaTarget]; | |
53 | [cocoaNSScroller setAction: @selector(wxNSScrollerAction:)]; | |
54 | } | |
55 | } | |
56 |