Exemple #1
0
 void enableWidget(boolean enabled) {
   if (OS.COMCTL32_MAJOR >= 6) {
     LITEM item = new LITEM();
     item.mask = OS.LIF_ITEMINDEX | OS.LIF_STATE;
     item.stateMask = OS.LIS_ENABLED;
     item.state = enabled ? OS.LIS_ENABLED : 0;
     while (OS.SendMessage(handle, OS.LM_SETITEM, 0, item) != 0) {
       item.iLink++;
     }
   } else {
     TextStyle linkStyle = new TextStyle(null, enabled ? linkColor : disabledColor, null);
     linkStyle.underline = true;
     for (int i = 0; i < offsets.length; i++) {
       Point point = offsets[i];
       layout.setStyle(linkStyle, point.x, point.y);
     }
     redraw();
   }
   /*
    * Feature in Windows.  For some reason, setting
    * LIS_ENABLED state using LM_SETITEM causes the
    * SysLink to become enabled.  To be specific,
    * calling IsWindowEnabled() returns true.  The
    * fix is disable the SysLink after LM_SETITEM.
    */
   super.enableWidget(enabled);
 }
 @Override
 void createWidget(int index) {
   super.createWidget(index);
   layout.setFont(getFont());
   text = "";
   initAccessible();
 }
Exemple #3
0
 void createWidget() {
   super.createWidget();
   text = "";
   if (OS.COMCTL32_MAJOR < 6) {
     if ((style & SWT.MIRRORED) != 0) {
       layout.setOrientation(SWT.RIGHT_TO_LEFT);
     }
     initAccessible();
   }
 }
Exemple #4
0
 void releaseWidget() {
   super.releaseWidget();
   if (layout != null) layout.dispose();
   layout = null;
   if (linkColor != null) linkColor.dispose();
   linkColor = null;
   disabledColor = null;
   offsets = null;
   ids = null;
   mnemonics = null;
   text = null;
 }
 @Override
 void enableWidget(boolean enabled) {
   super.enableWidget(enabled);
   if (isDisposed()) return;
   TextStyle linkStyle = new TextStyle(null, enabled ? linkColor : disabledColor, null);
   linkStyle.underline = true;
   for (int i = 0; i < offsets.length; i++) {
     Point point = offsets[i];
     layout.setStyle(linkStyle, point.x, point.y);
   }
   redraw();
 }
Exemple #6
0
 void createHandle() {
   super.createHandle();
   state |= THEME_BACKGROUND;
   if (OS.COMCTL32_MAJOR < 6) {
     layout = new TextLayout(display);
     if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
       linkColor = Color.win32_new(display, OS.GetSysColor(OS.COLOR_HOTLIGHT));
     } else {
       linkColor = new Color(display, LINK_FOREGROUND);
     }
     disabledColor = Color.win32_new(display, OS.GetSysColor(OS.COLOR_GRAYTEXT));
     offsets = new Point[0];
     ids = new String[0];
     mnemonics = new int[0];
     selection = new Point(-1, -1);
     focusIndex = mouseDownIndex = -1;
   }
 }
 @Override
 void showWidget() {
   super.showWidget();
   fixStyle(handle);
 }
 @Override
 void setOrientation(boolean create) {
   super.setOrientation(create);
   layout.setOrientation(style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT));
   if (!create) redraw(true);
 }
 @Override
 void setFontDescription(long /*int*/ font) {
   super.setFontDescription(font);
   layout.setFont(Font.gtk_new(display, font));
 }