comparison dwt/internal/cocoa/NSInputManager.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSInputManager;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSEvent;
18 import dwt.internal.cocoa.NSImage;
19 import dwt.internal.cocoa.NSInputServer;
20 import dwt.internal.cocoa.NSObject;
21 import dwt.internal.cocoa.NSRange;
22 import dwt.internal.cocoa.NSString;
23 import dwt.internal.cocoa.OS;
24 import objc = dwt.internal.objc.runtime;
25
26 public class NSInputManager : NSObject
27 {
28
29 public this ()
30 {
31 super();
32 }
33
34 public this (objc.id id)
35 {
36 super(id);
37 }
38
39 public static NSInputManager currentInputManager ()
40 {
41 objc.id result = OS.objc_msgSend(OS.class_NSInputManager, OS.sel_currentInputManager);
42 return result !is null ? new NSInputManager(result) : null;
43 }
44
45 public static void cycleToNextInputLanguage (id sender)
46 {
47 OS.objc_msgSend(OS.class_NSInputManager, OS.sel_cycleToNextInputLanguage_1, sender !is null ? sender.id : null);
48 }
49
50 public static void cycleToNextInputServerInLanguage (id sender)
51 {
52 OS.objc_msgSend(OS.class_NSInputManager, OS.sel_cycleToNextInputServerInLanguage_1, sender !is null ? sender.id : null);
53 }
54
55 public bool handleMouseEvent (NSEvent theMouseEvent)
56 {
57 return OS.objc_msgSend(this.id, OS.sel_handleMouseEvent_1, theMouseEvent !is null ? theMouseEvent.id : null) !is null;
58 }
59
60 public NSImage image ()
61 {
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_image);
63 return result !is null ? new NSImage(result) : null;
64 }
65
66 public NSInputManager initWithName (NSString inputServerName, NSString hostName)
67 {
68 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1host_1, inputServerName !is null ? inputServerName.id : null,
69 hostName !is null ? hostName.id : null);
70 return result is this.id ? this : (result !is null ? new NSInputManager(result) : null);
71 }
72
73 public NSString language ()
74 {
75 objc.id result = OS.objc_msgSend(this.id, OS.sel_language);
76 return result !is null ? new NSString(result) : null;
77 }
78
79 public NSString localizedInputManagerName ()
80 {
81 objc.id result = OS.objc_msgSend(this.id, OS.sel_localizedInputManagerName);
82 return result !is null ? new NSString(result) : null;
83 }
84
85 public void markedTextAbandoned (id cli)
86 {
87 OS.objc_msgSend(this.id, OS.sel_markedTextAbandoned_1, cli !is null ? cli.id : null);
88 }
89
90 public void markedTextSelectionChanged (NSRange newSel, id cli)
91 {
92 OS.objc_msgSend(this.id, OS.sel_markedTextSelectionChanged_1client_1, newSel, cli !is null ? cli.id : null);
93 }
94
95 public NSInputServer server ()
96 {
97 objc.id result = OS.objc_msgSend(this.id, OS.sel_server);
98 return result !is null ? new NSInputServer(result) : null;
99 }
100
101 public bool wantsToDelayTextChangeNotifications ()
102 {
103 return OS.objc_msgSend(this.id, OS.sel_wantsToDelayTextChangeNotifications) !is null;
104 }
105
106 public bool wantsToHandleMouseEvents ()
107 {
108 return OS.objc_msgSend(this.id, OS.sel_wantsToHandleMouseEvents) !is null;
109 }
110
111 public bool wantsToInterpretAllKeystrokes ()
112 {
113 return OS.objc_msgSend(this.id, OS.sel_wantsToInterpretAllKeystrokes) !is null;
114 }
115
116 }