Example #1
0
 long /*int*/ gtk_activate(long /*int*/ widget) {
   Event event = new Event();
   event.item = this;
   int type = OS.gtk_expander_get_expanded(handle) ? SWT.Collapse : SWT.Expand;
   parent.sendEvent(type, event);
   return 0;
 }
Example #2
0
 long /*int*/ windowProc(long /*int*/ handle, long /*int*/ user_data) {
   switch ((int) /*64*/ user_data) {
     case ACTIVATE_INVERSE:
       {
         expanded = OS.gtk_expander_get_expanded(handle);
         parent.layoutItems(0, false);
         return 0;
       }
   }
   return super.windowProc(handle, user_data);
 }
Example #3
0
  void resizeControl(int yScroll) {
    if (control != null && !control.isDisposed()) {
      boolean visible = OS.gtk_expander_get_expanded(handle);
      if (visible) {
        int x = OS.GTK_WIDGET_X(clientHandle);
        int y = OS.GTK_WIDGET_Y(clientHandle);
        if (x != -1 && y != -1) {
          int width = OS.GTK_WIDGET_WIDTH(clientHandle);
          int height = OS.GTK_WIDGET_HEIGHT(clientHandle);
          int[] property = new int[1];
          OS.gtk_widget_style_get(handle, OS.focus_line_width, property, 0);
          y += property[0] * 2;
          height -= property[0] * 2;

          /*
           * Feature in GTK. When the ExpandBar is resize too small the control
           * shows up on top of the vertical scrollbar. This happen because the
           * GtkExpander does not set the size of child smaller than the request
           * size of its parent and because the control is not parented in the
           * hierarchy of the GtkScrolledWindow.
           * The fix is calculate the width ourselves when the scrollbar is visible.
           */
          ScrollBar vBar = parent.verticalBar;
          if (vBar != null) {
            if (OS.GTK_WIDGET_VISIBLE(vBar.handle)) {
              width =
                  OS.GTK_WIDGET_WIDTH(parent.scrolledHandle)
                      - parent.vScrollBarWidth()
                      - 2 * parent.spacing;
            }
          }
          control.setBounds(x, y - yScroll, width, Math.max(0, height), true, true);
        }
      }
      control.setVisible(visible);
    }
  }