comparison dwt/widgets/Composite.d @ 36:db5a898b2119

Fixed a lot of compile errors
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 07 Oct 2008 12:56:18 +0200
parents c6edc6e9bd0d
children 642f460a0908
comparison
equal deleted inserted replaced
35:7d135fe0caf2 36:db5a898b2119
68 * </p> 68 * </p>
69 * 69 *
70 * @see Canvas 70 * @see Canvas
71 */ 71 */
72 public class Composite : Scrollable { 72 public class Composite : Scrollable {
73 Layout layout; 73 Layout layout_;
74 Control[] tabList; 74 Control[] tabList;
75 int scrolledVisibleRgn, siblingsVisibleRgn; 75 int scrolledVisibleRgn, siblingsVisibleRgn;
76 int layoutCount, backgroundMode; 76 int layoutCount, backgroundMode;
77 77
78 this () { 78 this () {
197 } 197 }
198 for (int i=0; i<changed.length; i++) { 198 for (int i=0; i<changed.length; i++) {
199 Control child = changed [i]; 199 Control child = changed [i];
200 Composite composite = child.parent; 200 Composite composite = child.parent;
201 while (child !is this) { 201 while (child !is this) {
202 if (composite.layout is null || !composite.layout.flushCache (child)) { 202 if (composite.layout_ is null || !composite.layout_.flushCache (child)) {
203 composite.state |= LAYOUT_CHANGED; 203 composite.state |= LAYOUT_CHANGED;
204 } 204 }
205 child = composite; 205 child = composite;
206 composite = child.parent; 206 composite = child.parent;
207 } 207 }
209 } 209 }
210 210
211 public Point computeSize (int wHint, int hHint, bool changed) { 211 public Point computeSize (int wHint, int hHint, bool changed) {
212 checkWidget(); 212 checkWidget();
213 Point size; 213 Point size;
214 if (layout !is null) { 214 if (layout_ !is null) {
215 if ((wHint is DWT.DEFAULT) || (hHint is DWT.DEFAULT)) { 215 if ((wHint is DWT.DEFAULT) || (hHint is DWT.DEFAULT)) {
216 changed |= (state & LAYOUT_CHANGED) !is 0; 216 changed |= (state & LAYOUT_CHANGED) !is 0;
217 size = layout.computeSize (this, wHint, hHint, changed); 217 size = layout_.computeSize (this, wHint, hHint, changed);
218 state &= ~LAYOUT_CHANGED; 218 state &= ~LAYOUT_CHANGED;
219 } else { 219 } else {
220 size = new Point (wHint, hHint); 220 size = new Point (wHint, hHint);
221 } 221 }
222 } else { 222 } else {
408 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 408 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
409 * </ul> 409 * </ul>
410 */ 410 */
411 public Layout getLayout () { 411 public Layout getLayout () {
412 checkWidget(); 412 checkWidget();
413 return layout; 413 return layout_;
414 } 414 }
415 415
416 /** 416 /**
417 * Returns <code>true</code> if the receiver has deferred 417 * Returns <code>true</code> if the receiver has deferred
418 * the performing of layout, and <code>false</code> otherwise. 418 * the performing of layout, and <code>false</code> otherwise.
553 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 553 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
554 * </ul> 554 * </ul>
555 */ 555 */
556 public void layout (bool changed) { 556 public void layout (bool changed) {
557 checkWidget (); 557 checkWidget ();
558 if (layout is null) return; 558 if (layout_ is null) return;
559 layout (changed, false); 559 layout (changed, false);
560 } 560 }
561 561
562 /** 562 /**
563 * If the receiver has a layout, asks the layout to <em>lay out</em> 563 * If the receiver has a layout, asks the layout to <em>lay out</em>
594 * 594 *
595 * @since 3.1 595 * @since 3.1
596 */ 596 */
597 public void layout (bool changed, bool all) { 597 public void layout (bool changed, bool all) {
598 checkWidget (); 598 checkWidget ();
599 if (layout is null && !all) return; 599 if (layout_ is null && !all) return;
600 markLayout (changed, all); 600 markLayout (changed, all);
601 updateLayout (all); 601 updateLayout (all);
602 } 602 }
603 603
604 /** 604 /**
649 Composite [] update = new Composite [16]; 649 Composite [] update = new Composite [16];
650 for (int i=0; i<changed.length; i++) { 650 for (int i=0; i<changed.length; i++) {
651 Control child = changed [i]; 651 Control child = changed [i];
652 Composite composite = child.parent; 652 Composite composite = child.parent;
653 while (child !is this) { 653 while (child !is this) {
654 if (composite.layout !is null) { 654 if (composite.layout_ !is null) {
655 composite.state |= LAYOUT_NEEDED; 655 composite.state |= LAYOUT_NEEDED;
656 if (!composite.layout.flushCache (child)) { 656 if (!composite.layout_.flushCache (child)) {
657 composite.state |= LAYOUT_CHANGED; 657 composite.state |= LAYOUT_CHANGED;
658 } 658 }
659 } 659 }
660 if (updateCount is update.length) { 660 if (updateCount is update.length) {
661 Composite [] newUpdate = new Composite [update.length + 16]; 661 Composite [] newUpdate = new Composite [update.length + 16];
670 update [i].updateLayout (false); 670 update [i].updateLayout (false);
671 } 671 }
672 } 672 }
673 673
674 void markLayout (bool changed, bool all) { 674 void markLayout (bool changed, bool all) {
675 if (layout !is null) { 675 if (layout_ !is null) {
676 state |= LAYOUT_NEEDED; 676 state |= LAYOUT_NEEDED;
677 if (changed) state |= LAYOUT_CHANGED; 677 if (changed) state |= LAYOUT_CHANGED;
678 } 678 }
679 if (all) { 679 if (all) {
680 Control [] children = _getChildren (); 680 Control [] children = _getChildren ();
706 super.releaseChildren (destroy); 706 super.releaseChildren (destroy);
707 } 707 }
708 708
709 void releaseWidget () { 709 void releaseWidget () {
710 super.releaseWidget (); 710 super.releaseWidget ();
711 layout = null; 711 layout_ = null;
712 tabList = null; 712 tabList = null;
713 } 713 }
714 714
715 void removeControl (Control control) { 715 void removeControl (Control control) {
716 fixTabList (control); 716 fixTabList (control);
742 } 742 }
743 } 743 }
744 744
745 int setBounds (int x, int y, int width, int height, bool move, bool resize) { 745 int setBounds (int x, int y, int width, int height, bool move, bool resize) {
746 int result = super.setBounds (x, y, width, height, move, resize); 746 int result = super.setBounds (x, y, width, height, move, resize);
747 if (layout !is null && (result & RESIZED) !is 0) { 747 if (layout_ !is null && (result & RESIZED) !is 0) {
748 markLayout (false, false); 748 markLayout (false, false);
749 updateLayout (false); 749 updateLayout (false);
750 } 750 }
751 return result; 751 return result;
752 } 752 }
771 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 771 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
772 * </ul> 772 * </ul>
773 */ 773 */
774 public void setLayout (Layout layout) { 774 public void setLayout (Layout layout) {
775 checkWidget(); 775 checkWidget();
776 this.layout = layout; 776 this.layout_ = layout;
777 } 777 }
778 778
779 /** 779 /**
780 * If the argument is <code>true</code>, causes subsequent layout 780 * If the argument is <code>true</code>, causes subsequent layout
781 * operations in the receiver or any of its children to be ignored. 781 * operations in the receiver or any of its children to be ignored.
811 } 811 }
812 812
813 813
814 bool setScrollBarVisible (ScrollBar bar, bool visible) { 814 bool setScrollBarVisible (ScrollBar bar, bool visible) {
815 bool changed = super.setScrollBarVisible (bar, visible); 815 bool changed = super.setScrollBarVisible (bar, visible);
816 if (changed && layout !is null) { 816 if (changed && layout_ !is null) {
817 markLayout (false, false); 817 markLayout (false, false);
818 updateLayout (false); 818 updateLayout (false);
819 } 819 }
820 return changed; 820 return changed;
821 } 821 }
887 return; 887 return;
888 } 888 }
889 if ((state & LAYOUT_NEEDED) !is 0) { 889 if ((state & LAYOUT_NEEDED) !is 0) {
890 bool changed = (state & LAYOUT_CHANGED) !is 0; 890 bool changed = (state & LAYOUT_CHANGED) !is 0;
891 state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED); 891 state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
892 layout.layout (this, changed); 892 layout_.layout (this, changed);
893 } 893 }
894 if (all) { 894 if (all) {
895 state &= ~LAYOUT_CHILD; 895 state &= ~LAYOUT_CHILD;
896 Control [] children = _getChildren (); 896 Control [] children = _getChildren ();
897 for (int i=0; i<children.length; i++) { 897 for (int i=0; i<children.length; i++) {