Example #1
0
 void drawWidget(GC gc, RECT rect) {
   drawBackground(gc.handle, rect);
   int selStart = selection.x;
   int selEnd = selection.y;
   if (selStart > selEnd) {
     selStart = selection.y;
     selEnd = selection.x;
   }
   // temporary code to disable text selection
   selStart = selEnd = -1;
   if (!OS.IsWindowEnabled(handle)) gc.setForeground(disabledColor);
   layout.draw(gc, 0, 0, selStart, selEnd, null, null);
   if (hasFocus() && focusIndex != -1) {
     Rectangle[] rects = getRectangles(focusIndex);
     for (int i = 0; i < rects.length; i++) {
       Rectangle rectangle = rects[i];
       gc.drawFocus(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
     }
   }
   if (hooks(SWT.Paint) || filters(SWT.Paint)) {
     Event event = new Event();
     event.gc = gc;
     event.x = rect.left;
     event.y = rect.top;
     event.width = rect.right - rect.left;
     event.height = rect.bottom - rect.top;
     sendEvent(SWT.Paint, event);
     event.gc = null;
   }
 }