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