Example #1
0
 void createHandle(int index) {
   int parentHandle = parent.handle;
   if ((style & SWT.SEPARATOR) != 0) {
     int orientation = (parent.style & SWT.HORIZONTAL) != 0 ? OS.XmVERTICAL : OS.XmHORIZONTAL;
     int[] argList = {
       OS.XmNheight,
       orientation == OS.XmVERTICAL ? DEFAULT_HEIGHT : DEFAULT_SEPARATOR_WIDTH,
       OS.XmNwidth,
       orientation == OS.XmHORIZONTAL ? DEFAULT_WIDTH : DEFAULT_SEPARATOR_WIDTH,
       OS.XmNancestorSensitive,
       1,
       OS.XmNpositionIndex,
       index,
       OS.XmNorientation,
       orientation,
       OS.XmNseparatorType,
       (parent.style & SWT.FLAT) != 0 ? OS.XmSHADOW_ETCHED_IN : OS.XmSHADOW_ETCHED_OUT,
     };
     handle = OS.XmCreateSeparator(parentHandle, null, argList, argList.length / 2);
     if (handle == 0) error(SWT.ERROR_NO_HANDLES);
     return;
   }
   int[] argList = {
     OS.XmNwidth,
     DEFAULT_WIDTH,
     OS.XmNheight,
     DEFAULT_HEIGHT,
     OS.XmNrecomputeSize,
     0,
     OS.XmNhighlightThickness,
     (parent.style & SWT.NO_FOCUS) != 0 ? 0 : 1,
     OS.XmNmarginWidth,
     2,
     OS.XmNmarginHeight,
     1,
     OS.XmNtraversalOn,
     (parent.style & SWT.NO_FOCUS) != 0 ? 0 : 1,
     OS.XmNpositionIndex,
     index,
     OS.XmNshadowType,
     OS.XmSHADOW_OUT,
     OS.XmNancestorSensitive,
     1,
   };
   handle = OS.XmCreateDrawnButton(parentHandle, null, argList, argList.length / 2);
   if (handle == 0) error(SWT.ERROR_NO_HANDLES);
   Control control = parent.findBackgroundControl();
   if (control == null) control = parent;
   setBackgroundPixel(parent.getBackgroundPixel());
 }