Changeset 24
- Timestamp:
- 05/31/04 03:22:58 (5 years ago)
- Files:
-
- branches/0.1/src/dwt/graphics/device.d (modified) (3 diffs)
- branches/0.1/src/dwt/graphics/gc.d (modified) (6 diffs)
- branches/0.1/src/dwt/graphics/image.d (modified) (2 diffs)
- branches/0.1/src/dwt/internal/win32/os.d (modified) (1 diff)
- branches/0.1/src/dwt/internal/win32/types.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/button.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/canvas.d (modified) (3 diffs)
- branches/0.1/src/dwt/widgets/caret.d (modified) (15 diffs)
- branches/0.1/src/dwt/widgets/composite.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/control.d (modified) (3 diffs)
- branches/0.1/src/dwt/widgets/decorations.d (modified) (8 diffs)
- branches/0.1/src/dwt/widgets/display.d (modified) (3 diffs)
- branches/0.1/src/dwt/widgets/scrollable.d (modified) (2 diffs)
- branches/0.1/src/dwt/widgets/widget.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.1/src/dwt/graphics/device.d
r17 r24 28 28 +/ 29 29 30 private import dwt.graphics.IDrawable; 31 32 /** 33 * This class is the abstract superclass of all device objects, 34 * such as the Display device and the Printer device. Devices 35 * can have a graphics context (GC) created for them, and they 36 * can be drawn on by sending messages to the associated GC. 37 */ 38 39 /+ TODO: this was an abstract class, but I was having difficulties 40 with no implementations allowed +/ 41 42 public class Device : IDrawable { 43 44 30 45 private 31 46 { … … 33 48 34 49 import dwt.graphics.color; 35 import dwt.graphics.drawable;36 50 import dwt.graphics.devicedata; 37 51 import dwt.graphics.font; 38 52 import dwt.graphics.fontdata; 53 import dwt.graphics.gcdata; 39 54 import dwt.graphics.rectangle; 40 55 import dwt.graphics.point; … … 49 64 } 50 65 51 /**52 * This class is the abstract superclass of all device objects,53 * such as the Display device and the Printer device. Devices54 * can have a graphics context (GC) created for them, and they55 * can be drawn on by sending messages to the associated GC.56 */57 58 /+ TODO: this was an abstract class, but I was having difficulties59 with no implementations allowed +/60 61 public class Device : Drawable {62 63 private import dwt.graphics.gcdata;64 66 65 67 branches/0.1/src/dwt/graphics/gc.d
r18 r24 34 34 import dwt.graphics.color; 35 35 import dwt.graphics.device; 36 import dwt.graphics. drawable;36 import dwt.graphics.IDrawable; 37 37 import dwt.graphics.font; 38 38 import dwt.graphics.fontmetrics; … … 89 89 public int handle; 90 90 91 Drawable drawable;91 IDrawable drawable; 92 92 GCData data; 93 93 … … 120 120 * </ul> 121 121 */ 122 public this( Drawable drawable) {122 public this(IDrawable drawable) { 123 123 this(drawable, DWT.NONE); 124 124 } … … 150 150 * @since 2.1.2 151 151 */ 152 public this( Drawable drawable, int style) {152 public this(IDrawable drawable, int style) { 153 153 if (drawable == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 154 154 GCData data = new GCData (); … … 2120 2120 } 2121 2121 2122 void init( Drawable drawable, GCData data, int hDC) {2122 void init(IDrawable drawable, GCData data, int hDC) { 2123 2123 int foreground = data.foreground; 2124 2124 if (foreground != -1 && OS.GetTextColor(hDC) != foreground) { … … 2573 2573 * </p> 2574 2574 * 2575 * @param drawable the Drawable for the receiver.2575 * @param drawable the IDrawable for the receiver. 2576 2576 * @param data the data for the receiver. 2577 2577 * 2578 2578 * @return a new <code>GC</code> 2579 2579 */ 2580 public static GC win32_new( Drawable drawable, GCData data) {2580 public static GC win32_new(IDrawable drawable, GCData data) { 2581 2581 GC gc = new GC(); 2582 2582 int hDC = drawable.internal_new_GC(data); branches/0.1/src/dwt/graphics/image.d
r18 r24 32 32 import dwt.dwt; 33 33 import dwt.graphics.device; 34 import dwt.graphics. drawable;34 import dwt.graphics.IDrawable; 35 35 import dwt.graphics.gc; 36 36 import dwt.graphics.gcdata; … … 95 95 */ 96 96 97 public final class Image : Drawable {97 public final class Image : IDrawable { 98 98 99 99 /** branches/0.1/src/dwt/internal/win32/os.d
r23 r24 2354 2354 bool ImmSetCompositionFontW (int hIMC, LOGFONTW* lplf); 2355 2355 bool ImmSetCompositionFontA (int hIMC, LOGFONTA* lplf); 2356 //bool ImmSetCompositionWindow (int hIMC, COMPOSITIONFORM lpCompForm);2356 bool ImmSetCompositionWindow (int hIMC, COMPOSITIONFORM lpCompForm); 2357 2357 bool ImmSetConversionStatus (int hIMC, int fdwConversion, int dwSentence); 2358 2358 bool ImmSetOpenStatus (int hIMC, bool fOpen); branches/0.1/src/dwt/internal/win32/types.d
r23 r24 133 133 } 134 134 135 struct TRIVERTEX { 136 int x; 137 int y; 138 ushort Red; 139 ushort Green; 140 ushort Blue; 141 ushort Alpha; 135 struct COMPOSITIONFORM { 136 public int dwStyle; 137 // POINT ptCurrentPos; 138 public int x, y; 139 // RECT rcArea; 140 public int left, top, right, bottom; 142 141 } 143 142 … … 760 759 } 761 760 761 struct TRIVERTEX { 762 int x; 763 int y; 764 ushort Red; 765 ushort Green; 766 ushort Blue; 767 ushort Alpha; 768 } 769 762 770 struct WINDOWPOS { 763 771 int hwnd; branches/0.1/src/dwt/widgets/button.d
r17 r24 22 22 module dwt.widgets.button; 23 23 24 /+ 25 import org.eclipse.swt.internal.win32.*; 26 import org.eclipse.swt.*; 27 import org.eclipse.swt.graphics.*; 28 import org.eclipse.swt.events.*; 29 +/ 30 31 24 private import dwt.widgets.composite; 32 25 private import dwt.widgets.control; 33 26 … … 69 62 private import dwt.util.util; 70 63 71 private import dwt.widgets.composite;72 64 73 65 Image image; branches/0.1/src/dwt/widgets/canvas.d
r17 r24 22 22 module dwt.widgets.canvas; 23 23 24 /+25 import org.eclipse.DWT.internal.win32.*;26 import org.eclipse.DWT.*;27 import org.eclipse.DWT.graphics.*;28 +/29 30 private import dwt.graphics.rectangle;31 32 private import dwt.internal.win32.os;33 private import dwt.internal.win32.types;34 35 24 private import dwt.widgets.composite; 36 private import dwt.widgets.caret;37 private import dwt.widgets.control;38 25 39 26 /** … … 60 47 public class Canvas : Composite { 61 48 49 private import dwt.graphics.rectangle; 50 51 private import dwt.internal.win32.os; 52 private import dwt.internal.win32.types; 53 54 private import dwt.widgets.caret; 55 private import dwt.widgets.control; 56 62 57 Caret caret; 63 58 … … 100 95 public this (Composite parent, int style) { 101 96 super (parent, style); 97 } 98 99 int windowProc (int hwnd, int msg, int wParam, int lParam) { 100 /+ 101 // I added this because of a call in decorations.d (1487) that didn't match. The windowProc is up a few classes from this one. 102 // 2004.5.30 BSA 103 // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 104 switch (msg) { 105 case OS.WM_APP: 106 case OS.WM_APP+1: 107 if (hAccel == -1) createAccelerators (); 108 return msg == OS.WM_APP ? nAccel : hAccel; 109 } 110 +/ 111 return super.windowProc (hwnd, msg, wParam, lParam); 102 112 } 103 113 branches/0.1/src/dwt/widgets/caret.d
r17 r24 22 22 module dwt.widgets.caret; 23 23 24 /+25 import org.eclipse.swt.internal.win32.*;26 import org.eclipse.swt.*;27 import org.eclipse.swt.graphics.*;28 +/29 30 private import dwt.graphics.font;31 private import dwt.graphics.image;32 private import dwt.graphics.point;33 private import dwt.graphics.rectangle;34 35 private import dwt.internal.win32.types;36 37 private import dwt.widgets.canvas;38 24 private import dwt.widgets.widget; 39 40 41 25 42 26 /** … … 57 41 public class Caret : Widget { 58 42 43 private import dwt.graphics.font; 44 private import dwt.graphics.image; 45 private import dwt.graphics.point; 46 private import dwt.graphics.rectangle; 47 48 private import dwt.internal.win32.types; 49 50 private import dwt.widgets.canvas; 51 59 52 Canvas parent; 60 53 int x, y, width, height; 61 b itmoved, resized;62 // bit isVisible; // TODO: conflicting method below 54 bool moved, resized; 55 bool _isVisible; 63 56 Image image; 64 57 Font font; … … 103 96 104 97 void createWidget () { 105 isVisible = true;98 _isVisible = true; 106 99 if (parent.getCaret () == null) { 107 100 parent.setCaret (this); … … 239 232 * </ul> 240 233 */ 241 public b itgetVisible () {242 checkWidget(); 243 return isVisible;244 } 245 246 b ithasFocus () {234 public bool getVisible () { 235 checkWidget(); 236 return _isVisible; 237 } 238 239 bool hasFocus () { 247 240 return parent.handle == OS.GetFocus (); 248 241 } 249 242 250 b itisFocusCaret () {243 bool isFocusCaret () { 251 244 return parent.caret == this && hasFocus (); 252 245 } … … 266 259 * @see #getVisible 267 260 */ 268 public b itisVisible () {269 checkWidget(); 270 return isVisible && parent.isVisible () && hasFocus ();261 public bool isVisible () { 262 checkWidget(); 263 return _isVisible && parent.isVisible () && hasFocus (); 271 264 } 272 265 … … 280 273 if (!OS.SetCaretPos (x, y)) return; 281 274 if (OS.IsDBLocale) { 282 POINT ptCurrentPos = new POINT ();283 if (!OS.GetCaretPos ( ptCurrentPos)) return;284 COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM ();275 POINT ptCurrentPos; 276 if (!OS.GetCaretPos (&ptCurrentPos)) return; 277 COMPOSITIONFORM lpCompForm; 285 278 lpCompForm.dwStyle = OS.CFS_POINT; 286 279 lpCompForm.x = ptCurrentPos.x; … … 303 296 image = null; 304 297 font = null; 305 oldFont = null;298 // TODO: oldFont = null; 306 299 } 307 300 … … 356 349 public void setBounds (int x, int y, int width, int height) { 357 350 checkWidget(); 358 b itsamePosition = this.x == x && this.y == y;359 b itsameExtent = this.width == width && this.height == height;351 bool samePosition = this.x == x && this.y == y; 352 bool sameExtent = this.width == width && this.height == height; 360 353 if (samePosition && sameExtent) return; 361 354 this.x = x; this.y = y; … … 363 356 if (sameExtent) { 364 357 moved = true; 365 if ( isVisible && hasFocus ()) move ();358 if (_isVisible && hasFocus ()) move (); 366 359 } else { 367 360 resized = true; 368 if ( isVisible && hasFocus ()) resize ();361 if (_isVisible && hasFocus ()) resize (); 369 362 } 370 363 } … … 399 392 setIMEFont (hFont); 400 393 } 401 if ( isVisible) OS.ShowCaret (hwnd);394 if (_isVisible) OS.ShowCaret (hwnd); 402 395 } 403 396 … … 423 416 } 424 417 this.font = font; 425 if ( isVisible && hasFocus ()) {418 if (_isVisible && hasFocus ()) { 426 419 int hFont = 0; 427 420 if (font != null) hFont = font.handle; … … 453 446 } 454 447 this.image = image; 455 if ( isVisible && hasFocus ()) resize ();448 if (_isVisible && hasFocus ()) resize (); 456 449 } 457 450 … … 485 478 this.x = x; this.y = y; 486 479 moved = true; 487 if ( isVisible && hasFocus ()) move ();480 if (_isVisible && hasFocus ()) move (); 488 481 } 489 482 … … 522 515 this.width = width; this.height = height; 523 516 resized = true; 524 if ( isVisible && hasFocus ()) resize ();517 if (_isVisible && hasFocus ()) resize (); 525 518 } 526 519 … … 561 554 * </ul> 562 555 */ 563 public void setVisible (b itvisible) {564 checkWidget(); 565 if (visible == isVisible) return;566 isVisible = visible;556 public void setVisible (bool visible) { 557 checkWidget(); 558 if (visible == _isVisible) return; 559 _isVisible = visible; 567 560 int hwnd = parent.handle; 568 561 if (OS.GetFocus () != hwnd) return; 569 if (! isVisible) {562 if (!_isVisible) { 570 563 OS.HideCaret (hwnd); 571 564 } else { branches/0.1/src/dwt/widgets/composite.d
r17 r24 22 22 module dwt.widgets.composite; 23 23 24 /+25 import org.eclipse.swt.internal.*;26 import org.eclipse.swt.internal.win32.*;27 import org.eclipse.swt.*;28 import org.eclipse.swt.graphics.*;29 +/30 24 31 25 private import dwt.widgets.scrollable; 26 32 27 33 28 /** … … 118 113 super (parent, style); 119 114 } 115 116 int windowProc (int hwnd, int msg, int wParam, int lParam) { 117 /+ 118 // I added this because of a call in decorations.d (1487) that didn't match. The windowProc is up a few classes from this one. 119 // 2004.5.30 BSA 120 // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 121 switch (msg) { 122 case OS.WM_APP: 123 case OS.WM_APP+1: 124 if (hAccel == -1) createAccelerators (); 125 return msg == OS.WM_APP ? nAccel : hAccel; 126 } 127 +/ 128 return super.windowProc (hwnd, msg, wParam, lParam); 129 } 130 120 131 121 132 Control[] _getChildren() { branches/0.1/src/dwt/widgets/control.d
r23 r24 19 19 20 20 21 22 21 module dwt.widgets.control; 23 22 24 /+ 25 import org.eclipse.swt.internal.win32.*; 26 import org.eclipse.swt.graphics.*; 27 import org.eclipse.swt.*; 28 import org.eclipse.swt.events.*; 29 import org.eclipse.swt.accessibility.*; 30 +/ 31 23 private import dwt.widgets.widget; 32 24 private import dwt.graphics.IDrawable; 33 private import dwt.widgets.widget;34 25 35 26 … … 63 54 private import dwt.graphics.color; 64 55 private import dwt.graphics.cursor; 65 private import dwt.graphics.drawable;66 56 private import dwt.graphics.font; 67 57 private import dwt.graphics.point; … … 73 63 private import dwt.util.util; 74 64 65 private import dwt.widgets.composite; 75 66 private import dwt.widgets.decorations; 76 67 private import dwt.widgets.menu; branches/0.1/src/dwt/widgets/decorations.d
r23 r24 22 22 module dwt.widgets.decorations; 23 23 24 /+ 25 import org.eclipse.swt.internal.win32.*; 26 import org.eclipse.swt.*; 27 import org.eclipse.swt.graphics.*; 28 +/ 29 30 private import dwt.widgets.canvas; 24 private import dwt.widgets.canvas; 31 25 32 26 /** … … 117 111 private import dwt.util.util; 118 112 113 private import dwt.widgets.button; 114 private import dwt.widgets.composite; 115 private import dwt.widgets.control; 119 116 private import dwt.widgets.menu; 120 117 private import dwt.widgets.menuitem; 121 private import dwt.widgets.control;122 private import dwt.widgets.button;123 118 private import dwt.widgets.shell; 124 private import dwt.widgets.composite; 125 126 OS os; 119 120 //OS os; 127 121 Image image, smallImage, largeImage; 128 Image [] images = new Image [0];122 Image [] images; 129 123 Menu menuBar; 130 124 Menu [] menus; … … 289 283 290 284 int callWindowProc (int msg, int wParam, int lParam) { 291 return os.DefMDIChildProc (handle, msg, wParam, lParam);285 return OS.DefMDIChildProc (handle, msg, wParam, lParam); 292 286 } 293 287 … … 306 300 RECT* rect; 307 301 OS.SetRect (rect, x, y, x + width, y + height); 308 int bits = os.GetWindowLong (handle, OS.GWL_STYLE);302 int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); 309 303 bool hasMenu = cast(bool)(OS.IsWinCE ? false : OS.GetMenu (handle) != 0); 310 OS.AdjustWindowRectEx (rect, bits, hasMenu, os.GetWindowLong (handle, OS.GWL_EXSTYLE));304 OS.AdjustWindowRectEx (rect, bits, hasMenu, OS.GetWindowLong (handle, OS.GWL_EXSTYLE)); 311 305 312 306 /* Get the size of the scroll bars */ … … 318 312 RECT* testRect; 319 313 OS.SetRect (testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); 320 os.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);314 OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 321 315 while ((testRect.bottom - testRect.top) < height) { 322 316 rect.top -= OS.GetSystemMetrics (OS.SM_CYMENU) - OS.GetSystemMetrics (OS.SM_CYBORDER); 323 317 OS.SetRect(testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top); 324 os.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);318 OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect); 325 319 } 326 320 } … … 332 326 int maxAccel = 0; 333 327 if (menuBar == null || items == null) { 334 if (! os.IsPPC) return;328 if (!OS.IsPPC) return; 335 329 maxAccel = 1; 336 330 } else { 337 maxAccel = os.IsPPC ? items.length + 1 : items.length;331 maxAccel = OS.IsPPC ? items.length + 1 : items.length; 338 332 } 339 333 int size = ACCEL.sizeof; … … 1493 1487 return super.windowProc (hwnd, msg, wParam, lParam); 1494 1488 } 1489 1490 /+ TODO: delegates? 1495 1491 1496 1492 LRESULT WM_ACTIVATE (int wParam, int lParam) { … … 1685 1681 } 1686 1682 1687 } 1683 +/ 1684 1685 } branches/0.1/src/dwt/widgets/display.d
r17 r24 21 21 22 22 module dwt.widgets.display; 23 24 /+25 import org.eclipse.swt.internal.*;26 import org.eclipse.swt.internal.win32.*;27 import org.eclipse.swt.*;28 import org.eclipse.swt.graphics.*;29 +/30 23 31 24 private import dwt.graphics.device; … … 2377 2370 } 2378 2371 2372 /+ TODO: delegates? 2373 2379 2374 bit runDeferredEvents () { 2380 2375 /* … … 2429 2424 return result; 2430 2425 } 2426 2427 +/ 2431 2428 2432 2429 bit runTimer (int id) { branches/0.1/src/dwt/widgets/scrollable.d
r17 r24 21 21 22 22 module dwt.widgets.scrollable; 23 24 /+25 import org.eclipse.swt.internal.win32.*;26 import org.eclipse.swt.*;27 import org.eclipse.swt.graphics.*;28 +/29 23 30 24 private import dwt.widgets.control; … … 105 99 return OS.DefWindowProc (handle, msg, wParam, lParam); 106 100 } 101 102 int windowProc (int hwnd, int msg, int wParam, int lParam) { 103 /+ 104 // I added this because of a call in decorations.d (1487) that didn't match. The windowProc is up a few classes from this one. 105 // 2004.5.30 BSA 106 // this switch statement was left over from the decorations.d call to windowProc(int,int,int,int) 107 switch (msg) { 108 case OS.WM_APP: 109 case OS.WM_APP+1: 110 if (hAccel == -1) createAccelerators (); 111 return msg == OS.WM_APP ? nAccel : hAccel; 112 } 113 +/ 114 return super.windowProc (hwnd, msg, wParam, lParam); 115 } 116 107 117 108 118 /** branches/0.1/src/dwt/widgets/widget.d
r17 r24 21 21 22 22 module dwt.widgets.widget; 23 24 /+25 import org.eclipse.swt.internal.*;26 import org.eclipse.swt.internal.win32.*;27 import org.eclipse.swt.*;28 import org.eclipse.swt.events.*;29 +/30 31 //import dwt.internal.win32.dllversioninfo;32 23 33 24
