comparison dwt/internal/cocoa/NSMenuItemCell.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.NSMenuItemCell;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.NSButtonCell;
18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSMenuItem;
20 import dwt.internal.cocoa.NSMenuView;
21 import dwt.internal.cocoa.NSRect;
22 import dwt.internal.cocoa.NSView;
23 import dwt.internal.cocoa.OS;
24 import objc = dwt.internal.objc.runtime;
25
26 public class NSMenuItemCell : NSButtonCell
27 {
28
29 public this ()
30 {
31 super();
32 }
33
34 public this (objc.id id)
35 {
36 super(id);
37 }
38
39 public void calcSize ()
40 {
41 OS.objc_msgSend(this.id, OS.sel_calcSize);
42 }
43
44 public void drawBorderAndBackgroundWithFrame (NSRect cellFrame, NSView controlView)
45 {
46 OS.objc_msgSend(this.id, OS.sel_drawBorderAndBackgroundWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
47 }
48
49 public void drawImageWithFrame (NSRect cellFrame, NSView controlView)
50 {
51 OS.objc_msgSend(this.id, OS.sel_drawImageWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
52 }
53
54 public void drawKeyEquivalentWithFrame (NSRect cellFrame, NSView controlView)
55 {
56 OS.objc_msgSend(this.id, OS.sel_drawKeyEquivalentWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
57 }
58
59 public void drawSeparatorItemWithFrame (NSRect cellFrame, NSView controlView)
60 {
61 OS.objc_msgSend(this.id, OS.sel_drawSeparatorItemWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
62 }
63
64 public void drawStateImageWithFrame (NSRect cellFrame, NSView controlView)
65 {
66 OS.objc_msgSend(this.id, OS.sel_drawStateImageWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
67 }
68
69 public void drawTitleWithFrame (NSRect cellFrame, NSView controlView)
70 {
71 OS.objc_msgSend(this.id, OS.sel_drawTitleWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null);
72 }
73
74 public CGFloat imageWidth ()
75 {
76 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_imageWidth);
77 }
78
79 public NSRect keyEquivalentRectForBounds (NSRect cellFrame)
80 {
81 NSRect result;
82 OS.objc_msgSend_stret(result, this.id, OS.sel_keyEquivalentRectForBounds_1, cellFrame);
83 return result;
84 }
85
86 public CGFloat keyEquivalentWidth ()
87 {
88 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_keyEquivalentWidth);
89 }
90
91 public NSMenuItem menuItem ()
92 {
93 objc.id result = OS.objc_msgSend(this.id, OS.sel_menuItem);
94 return result !is null ? new NSMenuItem(result) : null;
95 }
96
97 public NSMenuView menuView ()
98 {
99 objc.id result = OS.objc_msgSend(this.id, OS.sel_menuView);
100 return result !is null ? new NSMenuView(result) : null;
101 }
102
103 public bool needsDisplay ()
104 {
105 return OS.objc_msgSend(this.id, OS.sel_needsDisplay) !is null;
106 }
107
108 public bool needsSizing ()
109 {
110 return OS.objc_msgSend(this.id, OS.sel_needsSizing) !is null;
111 }
112
113 public void setMenuItem (NSMenuItem item)
114 {
115 OS.objc_msgSend(this.id, OS.sel_setMenuItem_1, item !is null ? item.id : null);
116 }
117
118 public void setMenuView (NSMenuView menuView)
119 {
120 OS.objc_msgSend(this.id, OS.sel_setMenuView_1, menuView !is null ? menuView.id : null);
121 }
122
123 public void setNeedsDisplay (bool flag)
124 {
125 OS.objc_msgSend(this.id, OS.sel_setNeedsDisplay_1, flag);
126 }
127
128 public void setNeedsSizing (bool flag)
129 {
130 OS.objc_msgSend(this.id, OS.sel_setNeedsSizing_1, flag);
131 }
132
133 public NSRect stateImageRectForBounds (NSRect cellFrame)
134 {
135 NSRect result;
136 OS.objc_msgSend_stret(result, this.id, OS.sel_stateImageRectForBounds_1, cellFrame);
137 return result;
138 }
139
140 public CGFloat stateImageWidth ()
141 {
142 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_stateImageWidth);
143 }
144
145 public NSInteger tag ()
146 {
147 return OS.objc_msgSend(this.id, OS.sel_tag);
148 }
149
150 public NSRect titleRectForBounds (NSRect cellFrame)
151 {
152 NSRect result;
153 OS.objc_msgSend_stret(result, this.id, OS.sel_titleRectForBounds_1, cellFrame);
154 return result;
155 }
156
157 public CGFloat titleWidth ()
158 {
159 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_titleWidth);
160 }
161
162 }