Example #1
0
 LRESULT WM_PRINTCLIENT(int /*long*/ wParam, int /*long*/ lParam) {
   LRESULT result = super.WM_PRINTCLIENT(wParam, lParam);
   if (OS.COMCTL32_MAJOR < 6) {
     RECT rect = new RECT();
     OS.GetClientRect(handle, rect);
     GCData data = new GCData();
     data.device = display;
     data.foreground = getForegroundPixel();
     GC gc = GC.win32_new(wParam, data);
     drawWidget(gc, rect);
     gc.dispose();
   }
   return result;
 }
 LRESULT wmDrawChild(long /*int*/ wParam, long /*int*/ lParam) {
   DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT();
   OS.MoveMemory(struct, lParam, DRAWITEMSTRUCT.sizeof);
   if (image != null) {
     GCData data = new GCData();
     data.device = display;
     GC gc = GC.win32_new(struct.hDC, data);
     /*
      * Bug in Windows.  When a bitmap is included in the
      * menu bar, the HDC seems to already include the left
      * coordinate.  The fix is to ignore this value when
      * the item is in a menu bar.
      */
     int x = (parent.style & SWT.BAR) != 0 ? MARGIN_WIDTH * 2 : struct.left;
     Image image = getEnabled() ? this.image : new Image(display, this.image, SWT.IMAGE_DISABLE);
     gc.drawImage(image, x, struct.top + MARGIN_HEIGHT);
     if (this.image != image) image.dispose();
     gc.dispose();
   }
   if (parent.foreground != -1) OS.SetTextColor(struct.hDC, parent.foreground);
   return null;
 }