Lines 154-177
Link Here
|
154 |
Point size = super.computeSize (wHint, hHint, changed); |
154 |
Point size = super.computeSize (wHint, hHint, changed); |
155 |
int length = text.length (); |
155 |
int length = text.length (); |
156 |
if (length != 0) { |
156 |
if (length != 0) { |
157 |
/* |
157 |
String string = fixText (false); |
158 |
* Bug in Windows. When a group control is right-to-left and |
158 |
|
159 |
* is disabled, the first pixel of the text is clipped. The |
|
|
160 |
* fix is to add a space to both sides of the text. Note that |
161 |
* the work around must run all the time to stop the preferred |
162 |
* size from changing when a group is enabled and disabled. |
163 |
*/ |
164 |
String string = text; |
165 |
if ((style & SWT.RIGHT_TO_LEFT) != 0) { |
166 |
if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
167 |
string = " " + string + " "; |
168 |
} |
169 |
} |
170 |
/* |
159 |
/* |
171 |
* If the group has text, and the text is wider than the |
160 |
* If the group has text, and the text is wider than the |
172 |
* client area, pad the width so the text is not clipped. |
161 |
* client area, pad the width so the text is not clipped. |
173 |
*/ |
162 |
*/ |
174 |
TCHAR buffer = new TCHAR (getCodePage (), string, true); |
163 |
TCHAR buffer = new TCHAR (getCodePage (), string == null ? text : string, true); |
175 |
long /*int*/ newFont, oldFont = 0; |
164 |
long /*int*/ newFont, oldFont = 0; |
176 |
long /*int*/ hDC = OS.GetDC (handle); |
165 |
long /*int*/ hDC = OS.GetDC (handle); |
177 |
newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
166 |
newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
Lines 230-242
Link Here
|
230 |
* is disabled, the first pixel of the text is clipped. The |
219 |
* is disabled, the first pixel of the text is clipped. The |
231 |
* fix is to add a space to both sides of the text. |
220 |
* fix is to add a space to both sides of the text. |
232 |
*/ |
221 |
*/ |
233 |
if ((style & SWT.RIGHT_TO_LEFT) != 0) { |
222 |
String string = fixText (enabled); |
234 |
if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
223 |
if (string != null) { |
235 |
String string = enabled || text.length() == 0 ? text : " " + text + " "; |
|
|
236 |
TCHAR buffer = new TCHAR (getCodePage (), string, true); |
224 |
TCHAR buffer = new TCHAR (getCodePage (), string, true); |
237 |
OS.SetWindowText (handle, buffer); |
225 |
OS.SetWindowText (handle, buffer); |
238 |
} |
|
|
239 |
} |
226 |
} |
|
|
227 |
} |
228 |
|
229 |
String fixText (boolean enabled) { |
230 |
/* |
231 |
* Bug in Windows. When a group control is right-to-left and |
232 |
* is disabled, the first pixel of the text is clipped. The |
233 |
* fix is to add a space to both sides of the text. |
234 |
*/ |
235 |
if (text.length() == 0) return null; |
236 |
if ((style & SWT.RIGHT_TO_LEFT) != 0) { |
237 |
String string = null; |
238 |
if (!enabled && (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ())) { |
239 |
string = " " + text + " "; |
240 |
} |
241 |
return (style & SWT.FLIP_TEXT_DIRECTION) == 0 ? string : string != null ? LRE + string : LRE + text; |
242 |
} else if ((style & SWT.FLIP_TEXT_DIRECTION) != 0) { |
243 |
return RLE + text; |
244 |
} |
245 |
return null; |
240 |
} |
246 |
} |
241 |
|
247 |
|
242 |
public Rectangle getClientArea () { |
248 |
public Rectangle getClientArea () { |
Lines 394-415
Link Here
|
394 |
checkWidget (); |
400 |
checkWidget (); |
395 |
if (string == null) error (SWT.ERROR_NULL_ARGUMENT); |
401 |
if (string == null) error (SWT.ERROR_NULL_ARGUMENT); |
396 |
text = string; |
402 |
text = string; |
397 |
/* |
403 |
string = fixText (OS.IsWindowEnabled (handle)); |
398 |
* Bug in Windows. When a group control is right-to-left and |
404 |
TCHAR buffer = new TCHAR (getCodePage (), string == null ? text : string, true); |
399 |
* is disabled, the first pixel of the text is clipped. The |
|
|
400 |
* fix is to add a space to both sides of the text. |
401 |
*/ |
402 |
if ((style & SWT.RIGHT_TO_LEFT) != 0) { |
403 |
if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
404 |
if (!OS.IsWindowEnabled (handle)) { |
405 |
if (string.length() != 0) string = " " + string + " "; |
406 |
} |
407 |
} |
408 |
} |
409 |
TCHAR buffer = new TCHAR (getCodePage (), string, true); |
410 |
OS.SetWindowText (handle, buffer); |
405 |
OS.SetWindowText (handle, buffer); |
411 |
} |
406 |
} |
412 |
|
407 |
|
|
|
408 |
boolean updateTextDirection(int textDirection) { |
409 |
if (super.updateTextDirection(textDirection)) { |
410 |
String string = fixText (OS.IsWindowEnabled (handle)); |
411 |
if (string != null) { |
412 |
TCHAR buffer = new TCHAR (getCodePage (), string, true); |
413 |
OS.SetWindowText (handle, buffer); |
414 |
} |
415 |
return true; |
416 |
} |
417 |
return false; |
418 |
} |
419 |
|
413 |
int widgetStyle () { |
420 |
int widgetStyle () { |
414 |
/* |
421 |
/* |
415 |
* Bug in Windows. When GetDCEx() is called with DCX_INTERSECTUPDATE, |
422 |
* Bug in Windows. When GetDCEx() is called with DCX_INTERSECTUPDATE, |