comparison dwtx/ui/internal/forms/widgets/FormUtil.d @ 77:26c6c9dfd13c

ui.forms compile, just FormTextModel with xml reimpl left todo
author Frank Benoit <benoit@tionex.de>
date Sat, 24 May 2008 06:59:31 +0200
parents 5d489b9f966c
children 4ac9946b9fb5
comparison
equal deleted inserted replaced
76:e193036d82c9 77:26c6c9dfd13c
73 73
74 static const int H_SCROLL_INCREMENT = 5; 74 static const int H_SCROLL_INCREMENT = 5;
75 75
76 static const int V_SCROLL_INCREMENT = 64; 76 static const int V_SCROLL_INCREMENT = 64;
77 77
78 public static const String DEBUG = PLUGIN_ID + "/debug"; //$NON-NLS-1$ 78 public static const String DEBUG = PLUGIN_ID ~ "/debug"; //$NON-NLS-1$
79 79
80 public static const String DEBUG_TEXT = DEBUG + "/text"; //$NON-NLS-1$ 80 public static const String DEBUG_TEXT = DEBUG ~ "/text"; //$NON-NLS-1$
81 public static const String DEBUG_TEXTSIZE = DEBUG + "/textsize"; //$NON-NLS-1$ 81 public static const String DEBUG_TEXTSIZE = DEBUG ~ "/textsize"; //$NON-NLS-1$
82 82
83 public static const String DEBUG_FOCUS = DEBUG + "/focus"; //$NON-NLS-1$ 83 public static const String DEBUG_FOCUS = DEBUG ~ "/focus"; //$NON-NLS-1$
84 84
85 public static const String FOCUS_SCROLLING = "focusScrolling"; //$NON-NLS-1$ 85 public static const String FOCUS_SCROLLING = "focusScrolling"; //$NON-NLS-1$
86 86
87 public static const String IGNORE_BODY = "__ignore_body__"; //$NON-NLS-1$ 87 public static const String IGNORE_BODY = "__ignore_body__"; //$NON-NLS-1$
88 88
245 245
246 public static void ensureVisible(Control c) { 246 public static void ensureVisible(Control c) {
247 ScrolledComposite scomp = getScrolledComposite(c); 247 ScrolledComposite scomp = getScrolledComposite(c);
248 if (scomp !is null) { 248 if (scomp !is null) {
249 Object data = scomp.getData(FOCUS_SCROLLING); 249 Object data = scomp.getData(FOCUS_SCROLLING);
250 if (data is null || !data.equals(Boolean.FALSE)) 250 if (data is null || !data.opEquals(Boolean.FALSE))
251 FormUtil.ensureVisible(scomp, c); 251 FormUtil.ensureVisible(scomp, c);
252 } 252 }
253 } 253 }
254 254
255 public static void ensureVisible(ScrolledComposite scomp, Control control) { 255 public static void ensureVisible(ScrolledComposite scomp, Control control) {
508 calpha = calpha is 255 ? 0 : 255; 508 calpha = calpha is 255 ? 0 : 255;
509 } 509 }
510 return new Image(device, data); 510 return new Image(device, data);
511 } 511 }
512 512
513 public static bool mnemonicMatch(String text, char key) { 513 public static bool mnemonicMatch(String text, dchar key) {
514 char mnemonic = findMnemonic(text); 514 char mnemonic = findMnemonic(text);
515 if (mnemonic is '\0') 515 if (mnemonic is '\0')
516 return false; 516 return false;
517 return Character.toUpperCase(key) is Character.toUpperCase(mnemonic); 517 return CharacterToUpper(key) is CharacterToUpper(mnemonic);
518 } 518 }
519 519
520 private static char findMnemonic(String string) { 520 private static char findMnemonic(String string) {
521 int index = 0; 521 int index = 0;
522 int length = string.length(); 522 int length = string.length;
523 do { 523 do {
524 while (index < length && string.charAt(index) !is '&') 524 while (index < length && string.charAt(index) !is '&')
525 index++; 525 index++;
526 if (++index >= length) 526 if (++index >= length)
527 return '\0'; 527 return '\0';