Ejemplo n.º 1
0
 @Override
 protected boolean setFocus(boolean focus) {
   if (focus) {
     for (VControl child : children) {
       if (VTracker.instance().setFocusControl(child)) {
         return true;
       }
     }
     return false;
   } else {
     for (VControl child : children) {
       child.setFocus(false);
     }
     return true;
   }
 }
Ejemplo n.º 2
0
  public VPanel(Composite parent, int style) {
    this((VPanel) null, style & ~SWT.BORDER);

    isTopLevel = true;

    composite = parent;

    topLevelListener =
        new Listener() {
          public void handleEvent(Event event) {
            switch (event.type) {
              case SWT.Dispose:
                dispose(false);
                break;
                //				case SWT.FocusIn:
                //					setFocus();
                //					break;
              case SWT.Paint:
                paintControl(event);
                break;
            }
          }
        };

    composite.addListener(SWT.Dispose, topLevelListener);
    composite.addListener(SWT.FocusIn, topLevelListener);
    composite.addListener(SWT.Paint, topLevelListener);

    composite.setLayout(
        new Layout() {
          protected Point computeSize(
              Composite composite, int wHint, int hHint, boolean flushCache) {
            return VPanel.this.computeSize(wHint, hHint, flushCache);
          }

          protected void layout(Composite composite, boolean flushCache) {
            VPanel.this.setBounds(composite.getClientArea());
            VPanel.this.layout(flushCache);
          }
        });

    VTracker.addTopLevelPanel(this);
    composite.setData("cwt_vcontrol", this);
  }