Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSSegmentedControl.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.NSSegmentedControl; | |
15 | |
16 import dwt.internal.cocoa.CGFloat; | |
17 import dwt.internal.cocoa.NSControl; | |
18 import dwt.internal.cocoa.NSImage; | |
19 import dwt.internal.cocoa.NSImageCell : NSImageScaling; | |
20 import dwt.internal.cocoa.NSInteger; | |
21 import dwt.internal.cocoa.NSMenu; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.OS; | |
24 import objc = dwt.internal.objc.runtime; | |
25 | |
26 public class NSSegmentedControl : NSControl | |
27 { | |
28 | |
29 public this () | |
30 { | |
31 super(); | |
32 } | |
33 | |
34 public this (objc.id id) | |
35 { | |
36 super(id); | |
37 } | |
38 | |
39 public NSImage imageForSegment (NSInteger segment) | |
40 { | |
41 objc.id result = OS.objc_msgSend(this.id, OS.sel_imageForSegment_1, segment); | |
42 return result !is null ? new NSImage(result) : null; | |
43 } | |
44 | |
45 public NSImageScaling imageScalingForSegment (NSInteger segment) | |
46 { | |
47 return OS.objc_msgSend(this.id, OS.sel_imageScalingForSegment_1, segment); | |
48 } | |
49 | |
50 public bool isEnabledForSegment (NSInteger segment) | |
51 { | |
52 return OS.objc_msgSend(this.id, OS.sel_isEnabledForSegment_1, segment) !is null; | |
53 } | |
54 | |
55 public bool isSelectedForSegment (NSInteger segment) | |
56 { | |
57 return OS.objc_msgSend(this.id, OS.sel_isSelectedForSegment_1, segment) !is null; | |
58 } | |
59 | |
60 public NSString labelForSegment (NSInteger segment) | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_labelForSegment_1, segment); | |
63 return result !is null ? new NSString(result) : null; | |
64 } | |
65 | |
66 public NSMenu menuForSegment (NSInteger segment) | |
67 { | |
68 objc.id result = OS.objc_msgSend(this.id, OS.sel_menuForSegment_1, segment); | |
69 return result !is null ? new NSMenu(result) : null; | |
70 } | |
71 | |
72 public NSInteger segmentCount () | |
73 { | |
74 return OS.objc_msgSend(this.id, OS.sel_segmentCount); | |
75 } | |
76 | |
77 public NSInteger segmentStyle () | |
78 { | |
79 return OS.objc_msgSend(this.id, OS.sel_segmentStyle); | |
80 } | |
81 | |
82 public bool selectSegmentWithTag (NSInteger tag) | |
83 { | |
84 return OS.objc_msgSend(this.id, OS.sel_selectSegmentWithTag_1, tag) !is null; | |
85 } | |
86 | |
87 public NSInteger selectedSegment () | |
88 { | |
89 return OS.objc_msgSend(this.id, OS.sel_selectedSegment); | |
90 } | |
91 | |
92 public void setEnabled (bool enabled, NSInteger segment) | |
93 { | |
94 OS.objc_msgSend(this.id, OS.sel_setEnabled_1forSegment_1, enabled, segment); | |
95 } | |
96 | |
97 public void setImage (NSImage image, NSInteger segment) | |
98 { | |
99 OS.objc_msgSend(this.id, OS.sel_setImage_1forSegment_1, image !is null ? image.id : null, segment); | |
100 } | |
101 | |
102 public void setImageScaling (NSImageScaling scaling, NSInteger segment) | |
103 { | |
104 OS.objc_msgSend(this.id, OS.sel_setImageScaling_1forSegment_1, scaling, segment); | |
105 } | |
106 | |
107 public void setLabel (NSString label, NSInteger segment) | |
108 { | |
109 OS.objc_msgSend(this.id, OS.sel_setLabel_1forSegment_1, label !is null ? label.id : null, segment); | |
110 } | |
111 | |
112 public void setMenu (NSMenu menu, NSInteger segment) | |
113 { | |
114 OS.objc_msgSend(this.id, OS.sel_setMenu_1forSegment_1, menu !is null ? menu.id : null, segment); | |
115 } | |
116 | |
117 public void setSegmentCount (NSInteger count) | |
118 { | |
119 OS.objc_msgSend(this.id, OS.sel_setSegmentCount_1, count); | |
120 } | |
121 | |
122 public void setSegmentStyle (NSInteger segmentStyle) | |
123 { | |
124 OS.objc_msgSend(this.id, OS.sel_setSegmentStyle_1, segmentStyle); | |
125 } | |
126 | |
127 public void setSelected (bool selected, NSInteger segment) | |
128 { | |
129 OS.objc_msgSend(this.id, OS.sel_setSelected_1forSegment_1, selected, segment); | |
130 } | |
131 | |
132 public void setSelectedSegment (NSInteger selectedSegment) | |
133 { | |
134 OS.objc_msgSend(this.id, OS.sel_setSelectedSegment_1, selectedSegment); | |
135 } | |
136 | |
137 public void setWidth (CGFloat width, NSInteger segment) | |
138 { | |
139 OS.objc_msgSend(this.id, OS.sel_setWidth_1forSegment_1, width, segment); | |
140 } | |
141 | |
142 public CGFloat widthForSegment (NSInteger segment) | |
143 { | |
144 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_widthForSegment_1, segment); | |
145 } | |
146 | |
147 } |