Mercurial > projects > dwt-mac
comparison dwt/widgets/Scrollable.d @ 25:060cdd4457aa
Ported dwt.widgets.Scrollable
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Mon, 08 Sep 2008 17:44:31 +0200 |
parents | e831403a80a9 |
children | 642f460a0908 |
comparison
equal
deleted
inserted
replaced
24:d4399516bdc2 | 25:060cdd4457aa |
---|---|
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | |
11 * Port to the D programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
10 *******************************************************************************/ | 13 *******************************************************************************/ |
11 module dwt.widgets.Scrollable; | 14 module dwt.widgets.Scrollable; |
12 | |
13 import dwt.dwthelper.utils; | |
14 | 15 |
15 | 16 |
16 import dwt.DWT; | 17 import dwt.DWT; |
17 import dwt.DWTException; | 18 import dwt.DWTException; |
18 import dwt.graphics.Rectangle; | 19 import dwt.graphics.Rectangle; |
21 import dwt.internal.cocoa.NSScroller; | 22 import dwt.internal.cocoa.NSScroller; |
22 import dwt.internal.cocoa.NSSize; | 23 import dwt.internal.cocoa.NSSize; |
23 import dwt.internal.cocoa.NSView; | 24 import dwt.internal.cocoa.NSView; |
24 import dwt.internal.cocoa.OS; | 25 import dwt.internal.cocoa.OS; |
25 import dwt.internal.cocoa.SWTScrollView; | 26 import dwt.internal.cocoa.SWTScrollView; |
27 | |
28 import dwt.dwthelper.utils; | |
29 import dwt.widgets.Composite; | |
30 import dwt.widgets.Control; | |
31 import dwt.widgets.Display; | |
32 import dwt.widgets.ScrollBar; | |
33 import dwt.widgets.Widget; | |
26 | 34 |
27 /** | 35 /** |
28 * This class is the abstract superclass of all classes which | 36 * This class is the abstract superclass of all classes which |
29 * represent controls that have standard scroll bars. | 37 * represent controls that have standard scroll bars. |
30 * <dl> | 38 * <dl> |
107 * @see #getClientArea | 115 * @see #getClientArea |
108 */ | 116 */ |
109 public Rectangle computeTrim (int x, int y, int width, int height) { | 117 public Rectangle computeTrim (int x, int y, int width, int height) { |
110 checkWidget(); | 118 checkWidget(); |
111 if (scrollView !is null) { | 119 if (scrollView !is null) { |
112 NSSize size = new NSSize(); | 120 NSSize size = NSSize(); |
113 size.width = width; | 121 size.width = width; |
114 size.height = height; | 122 size.height = height; |
115 int border = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder; | 123 int border = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder; |
116 size = NSScrollView.frameSizeForContentSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, border); | 124 size = NSScrollView.frameSizeForContentSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, border); |
117 width = cast(int)size.width; | 125 width = cast(int)size.width; |