Beispiel #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;
 }
Beispiel #2
0
 LRESULT WM_PAINT(int /*long*/ wParam, int /*long*/ lParam) {
   if (OS.COMCTL32_MAJOR >= 6) {
     return super.WM_PAINT(wParam, lParam);
   }
   PAINTSTRUCT ps = new PAINTSTRUCT();
   GCData data = new GCData();
   data.ps = ps;
   data.hwnd = handle;
   GC gc = new_GC(data);
   if (gc != null) {
     int width = ps.right - ps.left;
     int height = ps.bottom - ps.top;
     if (width != 0 && height != 0) {
       RECT rect = new RECT();
       OS.SetRect(rect, ps.left, ps.top, ps.right, ps.bottom);
       drawWidget(gc, rect);
     }
     gc.dispose();
   }
   return LRESULT.ZERO;
 }
Beispiel #3
0
  /** Compute the minimum size. */
  private Point getTotalSize(Image image, String text) {
    Point size = new Point(0, 0);

    if (image != null) {
      Rectangle r = image.getBounds();
      size.x += r.width;
      size.y += r.height;
    }

    GC gc = new GC(this);
    if (text != null && text.length() > 0) {
      Point e = gc.textExtent(text, DRAW_FLAGS);
      size.x += e.x;
      size.y = Math.max(size.y, e.y);
      if (image != null) size.x += GAP;
    } else {
      size.y = Math.max(size.y, gc.getFontMetrics().getHeight());
    }
    gc.dispose();

    return size;
  }