comparison mde/gui/widget/Floating.d @ 114:b16a534f5302

Changes for tango r4201. Added override keyword in a lot of places.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 19 Dec 2008 15:15:06 +0000
parents 1655693702fc
children 5b37d0400732
comparison
equal deleted inserted replaced
113:9824bee909fd 114:b16a534f5302
58 } 58 }
59 59
60 super (mgr, id, data); 60 super (mgr, id, data);
61 } 61 }
62 62
63 bool setup (uint n, uint flags) { 63 override bool setup (uint n, uint flags) {
64 foreach (i, ref d; sWData) with (d) { 64 foreach (i, ref d; sWData) with (d) {
65 auto widg = subWidgets[i]; 65 auto widg = subWidgets[i];
66 if (!widg.setup (n, flags) && n != 0 && !(flags & 1)) 66 if (!widg.setup (n, flags) && n != 0 && !(flags & 1))
67 continue; // no changes; skip the rest 67 continue; // no changes; skip the rest
68 68
75 widg.setHeight (h - border.y1 - border.y2, -1); 75 widg.setHeight (h - border.y1 - border.y2, -1);
76 } 76 }
77 return false; // floating area size is not changed 77 return false; // floating area size is not changed
78 } 78 }
79 79
80 bool saveChanges () { 80 override bool saveChanges () {
81 wdim[] dd = new wdim[sWData.length*4]; 81 wdim[] dd = new wdim[sWData.length*4];
82 foreach (i, ref d; sWData) { 82 foreach (i, ref d; sWData) {
83 subWidgets[i].saveChanges (); 83 subWidgets[i].saveChanges ();
84 dd[4*i..4*i+4] = (&d.x)[0..4]; 84 dd[4*i..4*i+4] = (&d.x)[0..4];
85 } 85 }
86 86
87 mgr.setDimData (id, dd); // save positions 87 mgr.setDimData (id, dd); // save positions
88 return true; 88 return true;
89 } 89 }
90 90
91 void setWidth (wdim nw, int) { 91 override void setWidth (wdim nw, int) {
92 w = nw; 92 w = nw;
93 // check all floating widgets are visible 93 // check all floating widgets are visible
94 foreach (i, ref d; sWData) with (d) { 94 foreach (i, ref d; sWData) with (d) {
95 if (x + w > this.w) 95 if (x + w > this.w)
96 x = (w > this.w) ? 0 : this.w - w; 96 x = (w > this.w) ? 0 : this.w - w;
97 } 97 }
98 } 98 }
99 void setHeight (wdim nh, int) { 99 override void setHeight (wdim nh, int) {
100 h = nh; 100 h = nh;
101 foreach (i, ref d; sWData) with (d) { 101 foreach (i, ref d; sWData) with (d) {
102 if (y + h > this.h) 102 if (y + h > this.h)
103 y = (h > this.h) ? 0 : this.h - h; 103 y = (h > this.h) ? 0 : this.h - h;
104 } 104 }
105 } 105 }
106 106
107 bool isWSizable () { return true; } 107 override bool isWSizable () { return true; }
108 bool isHSizable () { return true; } 108 override bool isHSizable () { return true; }
109 109
110 void setPosition (wdim nx, wdim ny) { 110 override void setPosition (wdim nx, wdim ny) {
111 x = nx; 111 x = nx;
112 y = ny; 112 y = ny;
113 113
114 size_t n = subWidgets.length; 114 size_t n = subWidgets.length;
115 foreach (i, ref d; sWData) 115 foreach (i, ref d; sWData)
116 subWidgets[i].setPosition (x + d.x + d.border.x1, y + d.y + d.border.y1); 116 subWidgets[i].setPosition (x + d.x + d.border.x1, y + d.y + d.border.y1);
117 } 117 }
118 118
119 void draw () { 119 override void draw () {
120 super.draw; 120 super.draw;
121 121
122 mgr.renderer.restrict (x,y, w,h); 122 mgr.renderer.restrict (x,y, w,h);
123 foreach (i; sWOrder) 123 foreach (i; sWOrder)
124 with (sWData[i]) { 124 with (sWData[i]) {
126 subWidgets[i].draw; 126 subWidgets[i].draw;
127 } 127 }
128 mgr.renderer.relax; 128 mgr.renderer.relax;
129 } 129 }
130 130
131 IChildWidget getWidget (wdim cx, wdim cy) { 131 override IChildWidget getWidget (wdim cx, wdim cy) {
132 debug scope (failure) 132 debug scope (failure)
133 logger.warn ("getWidget: failure; values: click, pos, width - {}, {}, {} - {}, {}, {}", cx, x, w, cy, y, h); 133 logger.warn ("getWidget: failure; values: click, pos, width - {}, {}, {} - {}, {}, {}", cx, x, w, cy, y, h);
134 debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)"); 134 debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)");
135 135
136 foreach_reverse (j,i; sWOrder) with (sWData[i]) { 136 foreach_reverse (j,i; sWOrder) with (sWData[i]) {
151 } 151 }
152 event = size_t.max; 152 event = size_t.max;
153 return this; // no match 153 return this; // no match
154 } 154 }
155 155
156 int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) { 156 override int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {
157 if (event > subWidgets.length) return 0; 157 if (event > subWidgets.length) return 0;
158 if (b == 1 && state == true) { 158 if (b == 1 && state == true) {
159 active = event; 159 active = event;
160 with (sWData[active]) { 160 with (sWData[active]) {
161 resizeType = border.getResize (cx - this.x - x, cy - this.y - y, w,h); 161 resizeType = border.getResize (cx - this.x - x, cy - this.y - y, w,h);