Esempio n. 1
0
  /** Creates the "Control" group. */
  void createControlGroup() {
    super.createControlGroup();

    /* Create the group */
    alignmentGroup = new Group(controlGroup, SWT.NONE);
    alignmentGroup.setLayout(new GridLayout());
    alignmentGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    alignmentGroup.setText(ControlExample.getResourceString("Alignment"));

    /* Create the controls */
    leftButton = new Button(alignmentGroup, SWT.RADIO);
    leftButton.setText(ControlExample.getResourceString("Left"));
    centerButton = new Button(alignmentGroup, SWT.RADIO);
    centerButton.setText(ControlExample.getResourceString("Center"));
    rightButton = new Button(alignmentGroup, SWT.RADIO);
    rightButton.setText(ControlExample.getResourceString("Right"));

    /* Add the listeners */
    SelectionListener selectionListener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            if (!((Button) event.widget).getSelection()) return;
            setExampleWidgetAlignment();
          }
        };
    leftButton.addSelectionListener(selectionListener);
    centerButton.addSelectionListener(selectionListener);
    rightButton.addSelectionListener(selectionListener);
  }
Esempio n. 2
0
 /** Sets the state of the "Example" widgets. */
 void setExampleWidgetState() {
   super.setExampleWidgetState();
   Control[] controls = getExampleWidgets();
   if (controls.length != 0) {
     leftButton.setSelection((controls[0].getStyle() & SWT.LEFT) != 0);
     centerButton.setSelection((controls[0].getStyle() & SWT.CENTER) != 0);
     rightButton.setSelection((controls[0].getStyle() & SWT.RIGHT) != 0);
   }
 }
Esempio n. 3
0
 /** Sets the state of the "Example" widgets. */
 void setExampleWidgetState() {
   super.setExampleWidgetState();
   horizontalButton.setSelection((canvas.getStyle() & SWT.H_SCROLL) != 0);
   verticalButton.setSelection((canvas.getStyle() & SWT.V_SCROLL) != 0);
   borderButton.setSelection((canvas.getStyle() & SWT.BORDER) != 0);
   noBackgroundButton.setSelection((canvas.getStyle() & SWT.NO_BACKGROUND) != 0);
   noFocusButton.setSelection((canvas.getStyle() & SWT.NO_FOCUS) != 0);
   noMergePaintsButton.setSelection((canvas.getStyle() & SWT.NO_MERGE_PAINTS) != 0);
   noRedrawResizeButton.setSelection((canvas.getStyle() & SWT.NO_REDRAW_RESIZE) != 0);
   setCaret();
 }
Esempio n. 4
0
  /** Creates the "Example" group. */
  void createExampleGroup() {
    super.createExampleGroup();

    /* Create a group for the canvas widget */
    canvasGroup = new Group(exampleGroup, SWT.NONE);
    canvasGroup.setLayout(new GridLayout());
    canvasGroup.setLayoutData(
        new GridData(
            GridData.GRAB_HORIZONTAL
                | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.VERTICAL_ALIGN_FILL));
    canvasGroup.setText("Canvas");
  }
Esempio n. 5
0
  /** Creates the "Example" group. */
  void createExampleGroup() {
    super.createExampleGroup();
    exampleGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    /*
     * Create a group for the text widget to display
     * the results returned by the example dialogs.
     */
    resultGroup = new Group(exampleGroup, SWT.NONE);
    resultGroup.setLayout(new GridLayout());
    resultGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    resultGroup.setText(ControlExample.getResourceString("Dialog_Result"));
  }
Esempio n. 6
0
  /** Creates the "Other" group. */
  void createOtherGroup() {
    super.createOtherGroup();

    /* Create display controls specific to this example */
    caretButton = new Button(otherGroup, SWT.CHECK);
    caretButton.setText(ControlExample.getResourceString("Caret"));
    fillDamageButton = new Button(otherGroup, SWT.CHECK);
    fillDamageButton.setText(ControlExample.getResourceString("FillDamage"));

    /* Add the listeners */
    caretButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            setCaret();
          }
        });
  }
Esempio n. 7
0
  /**
   * Creates the tab folder page.
   *
   * @param tabFolder org.eclipse.swt.widgets.TabFolder
   * @return the new page for the tab folder
   */
  Composite createTabFolderPage(TabFolder tabFolder) {
    super.createTabFolderPage(tabFolder);

    /*
     * Add a resize listener to the tabFolderPage so that
     * if the user types into the example widget to change
     * its preferred size, and then resizes the shell, we
     * recalculate the preferred size correctly.
     */
    tabFolderPage.addControlListener(
        new ControlAdapter() {
          public void controlResized(ControlEvent e) {
            setExampleWidgetSize();
          }
        });

    return tabFolderPage;
  }
Esempio n. 8
0
  /** Creates the "Style" group. */
  void createStyleGroup() {
    super.createStyleGroup();

    /* Create the extra widgets */
    horizontalButton = new Button(styleGroup, SWT.CHECK);
    horizontalButton.setText("SWT.H_SCROLL");
    horizontalButton.setSelection(true);
    verticalButton = new Button(styleGroup, SWT.CHECK);
    verticalButton.setText("SWT.V_SCROLL");
    verticalButton.setSelection(true);
    borderButton = new Button(styleGroup, SWT.CHECK);
    borderButton.setText("SWT.BORDER");
    noBackgroundButton = new Button(styleGroup, SWT.CHECK);
    noBackgroundButton.setText("SWT.NO_BACKGROUND");
    noFocusButton = new Button(styleGroup, SWT.CHECK);
    noFocusButton.setText("SWT.NO_FOCUS");
    noMergePaintsButton = new Button(styleGroup, SWT.CHECK);
    noMergePaintsButton.setText("SWT.NO_MERGE_PAINTS");
    noRedrawResizeButton = new Button(styleGroup, SWT.CHECK);
    noRedrawResizeButton.setText("SWT.NO_REDRAW_RESIZE");
  }
Esempio n. 9
0
 /** Recreates the "Example" widgets. */
 void recreateExampleWidgets() {
   if (textWidget == null) {
     super.recreateExampleWidgets();
   }
 }