Changeset 81
- Timestamp:
- 12/26/05 09:57:57 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/current/win32/import/dwt/all.d
r76 r81 77 77 public import dwt.custom.busyindicator; 78 78 public import dwt.custom.cbanner; 79 public import dwt.custom.cbannerlayout; 79 80 public import dwt.custom.ccombo; 80 81 public import dwt.custom.clabel; 82 public import dwt.custom.clayoutdata; 81 83 public import dwt.custom.controleditor; 82 84 public import dwt.custom.ctabfolder; trunk/current/win32/import/dwt/custom/cbanner.d
r76 r81 11 11 module dwt.custom.cbanner; 12 12 13 /** 14 * This class has been updated to Eclispe/SWT 3.10 15 * <Shawn Liu> (2005.12.26) 16 */ 17 13 18 14 19 private import dwt.dwt; 15 20 21 private import dwt.custom.cbannerlayout; 16 22 private import dwt.graphics.color; 17 23 private import dwt.graphics.cursor; … … 67 73 68 74 int rightWidth = DWT.DEFAULT; 75 int rightMinWidth = DWT.DEFAULT; 76 int rightMinHeight = DWT.DEFAULT; 77 69 78 Cursor resizeCursor; 70 79 boolean dragging = false; … … 79 88 static int BEZIER_LEFT = 30; 80 89 static int MIN_LEFT = 10; 81 static int MIN_RIGHT = 160;90 // static int MIN_RIGHT = 160; 82 91 83 92 static int BORDER1 = DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW; … … 112 121 113 122 super(parent, checkStyle(style)); 123 super.setLayout(new CBannerLayout()); 114 124 resizeCursor = new Cursor(getDisplay(), DWT.CURSOR_SIZEWE); 115 125 … … 172 182 return polygon; 173 183 } 184 174 185 static int checkStyle (int style) { 175 186 return DWT.NONE; 176 187 } 188 189 /+ the following two removed @since 3.10 190 177 191 public Point computeSize(int wHint, int hHint, boolean changed) { 178 192 checkWidget(); … … 228 242 return new Rectangle(x, y, width, height); 229 243 } 244 +/ 245 230 246 /** 231 247 * Returns the Control that appears on the bottom side of the banner. … … 281 297 return right; 282 298 } 299 300 /** 301 * Returns the minimum size of the control that appears on the right of the banner. 302 * 303 * @return the minimum size of the control that appears on the right of the banner 304 * 305 * @since 3.1 306 */ 307 public Point getRightMinimumSize() { 308 checkWidget(); 309 return new Point(rightMinWidth, rightMinHeight); 310 } 311 283 312 /** 284 313 * Returns the width of the control that appears on the right of the banner. … … 291 320 checkWidget(); 292 321 if (right is null) return 0; 293 if (rightWidth == DWT.DEFAULT) return right.computeSize(DWT.DEFAULT, getSize().y).x; 322 if (rightWidth == DWT.DEFAULT) { 323 Point size = right.computeSize(DWT.DEFAULT, getSize().y, false); 324 return size.x; 325 } 294 326 return rightWidth; 295 327 } … … 306 338 return simple; 307 339 } 340 341 /+ removed @since 3.1 308 342 public void layout (boolean changed) { 309 343 checkWidget(); … … 371 405 if (leftRect !is null) left.setBounds(leftRect); 372 406 } 407 +/ 408 373 409 void onDispose() { 374 410 if (resizeCursor !is null) resizeCursor.dispose(); … … 389 425 if (dragging) { 390 426 Point size = getSize(); 427 // if (!(0 < x && x < size.x)) return; 428 // rightWidth = size.x - x - rightDragDisplacement; 429 // rightWidth = Math.max(MIN_RIGHT, rightWidth); 430 // super.layout(); 391 431 if (!(0 < x && x < size.x)) return; 392 rightWidth = size.x - x - rightDragDisplacement; 393 rightWidth = Math.max(MIN_RIGHT, rightWidth); 394 super.layout(); 432 rightWidth = Math.max(0, size.x - x - rightDragDisplacement); 433 if (rightMinWidth != DWT.DEFAULT) { 434 rightWidth = Math.max(rightMinWidth, rightWidth); 435 } 436 layout(false); 395 437 return; 396 438 } … … 416 458 if (bottom !is null && (left !is null || right !is null)) { 417 459 gc.setForeground(border1); 418 int y = bottom.getBounds().y - BORDER_BOTTOM - BORDER_STRIPE; 460 // int y = bottom.getBounds().y - BORDER_BOTTOM - BORDER_STRIPE; 461 int y = bottom.getBounds().y - BORDER_STRIPE - 1; 419 462 gc.drawLine(0, y, size.x, y); 420 463 } … … 482 525 void onResize() { 483 526 updateCurve(getSize().y); 484 super.layout();527 // super.layout(); 485 528 } 486 529 /** … … 509 552 } 510 553 bottom = control; 511 super.layout();554 layout(false); 512 555 } 513 556 /** … … 555 598 } 556 599 left = control; 557 super.layout();600 layout(false); 558 601 } 559 602 /** … … 582 625 } 583 626 right = control; 584 super.layout(); 585 } 627 layout(false); 628 } 629 630 /** 631 * Set the minumum height of the control that appears on the right side of the banner. 632 * 633 * @param size the minimum size of the control on the right 634 * 635 * @exception SWTException <ul> 636 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 637 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 638 * <li>ERROR_INVALID_ARGUMENT - if the size is null or the values of size are less than DWT.DEFAULT</li> 639 * </ul> 640 * 641 * @since 3.1 642 */ 643 public void setRightMinimumSize(Point size) { 644 checkWidget(); 645 if (size is null || size.x < DWT.DEFAULT || size.y < DWT.DEFAULT) 646 DWT.error(__FILE__, __LINE__, DWT.ERROR_INVALID_ARGUMENT); 647 rightMinWidth = size.x; 648 rightMinHeight = size.y; 649 } 650 586 651 /** 587 652 * Set the width of the control control that appears on the right side of the banner. … … 600 665 if (width < DWT.DEFAULT) DWT.error(__FILE__, __LINE__, DWT.ERROR_INVALID_ARGUMENT); 601 666 rightWidth = width; 602 layout( true);667 layout(false); 603 668 } 604 669 /** … … 626 691 } 627 692 updateCurve(getSize().y); 628 super.layout();693 layout(false); 629 694 redraw(); 630 695 }
