Пример #1
0
 @Override
 public Point computeSize(int wHint, int hHint, boolean changed) {
   checkWidget();
   if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
   if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
   int width, height;
   int layoutWidth = layout.getWidth();
   // TEMPORARY CODE
   if (wHint == 0) {
     layout.setWidth(1);
     Rectangle rect = layout.getBounds();
     width = 0;
     height = rect.height;
   } else {
     layout.setWidth(wHint);
     Rectangle rect = layout.getBounds();
     width = rect.width;
     height = rect.height;
   }
   layout.setWidth(layoutWidth);
   if (wHint != SWT.DEFAULT) width = wHint;
   if (hHint != SWT.DEFAULT) height = hHint;
   int border = getBorderWidth();
   width += border * 2;
   height += border * 2;
   return new Point(width, height);
 }
Пример #2
0
 @Override
 int setBounds(int x, int y, int width, int height, boolean move, boolean resize) {
   int result = super.setBounds(x, y, width, height, move, resize);
   if ((result & RESIZED) != 0) {
     layout.setWidth(width > 0 ? width : -1);
     redraw();
   }
   return result;
 }