/** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget(); return itemCount; }
/** * Returns the number of rows in the receiver. When * the receiver has the <code>WRAP</code> style, the * number of rows can be greater than one. Otherwise, * the number of rows is always one. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getRowCount() { checkWidget(); // return 1 as long as we don't support the WRAP style bit return 1; }
/** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount() { checkWidget(); return itemHolder.size(); }
/** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget (); return (int)/*64*/OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0); }
public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget(); int width = wHint, height = hHint; if (wHint == SWT.DEFAULT) width = 0x7FFFFFFF; if (hHint == SWT.DEFAULT) height = 0x7FFFFFFF; int [] result = layout (width, height, false); Point extent = new Point (result [1], result [2]); if (wHint != SWT.DEFAULT) extent.x = wHint; if (hHint != SWT.DEFAULT) extent.y = hHint; Rectangle trim = computeTrim (0, 0, extent.x, extent.y); return new Point (trim.width, trim.height); }
public void setRedraw (boolean redraw) { checkWidget(); super.setRedraw (redraw); if (redraw && drawCount == 0) relayout(); }
@Override public void setRedraw (boolean redraw) { checkWidget (); setDropDownItems (false); super.setRedraw (redraw); setDropDownItems (true); }
/*public*/ void setTabItemList (ToolItem [] tabList) { checkWidget (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { ToolItem item = tabList [i]; if (item == null) error (SWT.ERROR_INVALID_ARGUMENT); if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) error (SWT.ERROR_INVALID_PARENT); } ToolItem [] newList = new ToolItem [tabList.length]; System.arraycopy (tabList, 0, newList, 0, tabList.length); tabList = newList; } this.tabItemList = tabList; }
/*public*/ void setTabItemList (ToolItem [] tabList) { checkWidget (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { ToolItem item = tabList [i]; if (item == null) error (SWT.ERROR_INVALID_ARGUMENT); if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) error (SWT.ERROR_INVALID_PARENT); } ToolItem [] newList = new ToolItem [tabList.length]; System.arraycopy (tabList, 0, newList, 0, tabList.length); tabList = newList; } this.tabItemList = tabList; }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; /* * Feature in GTK. Size of toolbar is calculated incorrectly * and appears as just the overflow arrow, if the arrow is enabled * to display. The fix is to disable it before the computation of * size and enable it if WRAP style is set. */ OS.gtk_toolbar_set_show_arrow (handle, false); Point size = computeNativeSize (handle, wHint, hHint, changed); if ((style & SWT.WRAP) != 0) OS.gtk_toolbar_set_show_arrow (handle, true); return size; }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; /* * Feature in GTK. Size of toolbar is calculated incorrectly * and appears as just the overflow arrow, if the arrow is enabled * to display. The fix is to disable it before the computation of * size and enable it if WRAP style is set. */ OS.gtk_toolbar_set_show_arrow (handle, false); Point size = computeNativeSize (handle, wHint, hHint, changed); if ((style & SWT.WRAP) != 0) OS.gtk_toolbar_set_show_arrow (handle, true); return size; }
/*public*/ void setTabItemList (ToolItem [] tabList) { checkWidget (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { ToolItem item = tabList [i]; if (item == null) error (SWT.ERROR_INVALID_ARGUMENT); if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) error (SWT.ERROR_INVALID_PARENT); } ToolItem [] newList = new ToolItem [tabList.length]; System.arraycopy (tabList, 0, newList, 0, tabList.length); tabList = newList; } this.tabItemList = tabList; }
/*public*/ void setTabItemList (ToolItem [] tabList) { checkWidget (); if (tabList != null) { for (int i=0; i<tabList.length; i++) { ToolItem item = tabList [i]; if (item == null) error (SWT.ERROR_INVALID_ARGUMENT); if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) error (SWT.ERROR_INVALID_PARENT); } ToolItem [] newList = new ToolItem [tabList.length]; System.arraycopy (tabList, 0, newList, 0, tabList.length); tabList = newList; } this.tabItemList = tabList; }
/** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget(); long /*int*/ list = OS.gtk_container_get_children (handle); if (list == 0) return 0; int itemCount = OS.g_list_length (list); OS.g_list_free (list); return itemCount; }
/** * Returns the number of items contained in the receiver. * * @return the number of items * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public int getItemCount () { checkWidget(); int /*long*/ list = OS.gtk_container_get_children (handle); if (list == 0) return 0; int itemCount = OS.g_list_length (list); OS.g_list_free (list); return itemCount; }
@Override public void setToolTipText (String string) { checkWidget(); super.setToolTipText (string); Shell shell = _getShell (); ToolItem [] items = getItems (); for (int i = 0; i < items.length; i++) { String newString = string != null ? null : items [i].toolTipText; shell.setToolTipText (items [i].handle, newString); } }
@Override public void setToolTipText (String string) { checkWidget(); super.setToolTipText (string); Shell shell = _getShell (); ToolItem [] items = getItems (); for (int i = 0; i < items.length; i++) { String newString = string != null ? null : items [i].toolTipText; shell.setToolTipText (items [i].handle, newString); } }
public Rectangle getBounds () { checkWidget(); if (nsToolbar != null) { // The NSToolbar's view will always be a child of the Shell, so we can just // convert the frame to window-relative coordinates. NSRect rect = view.frame(); rect = view.convertRect_toView_(rect, null); return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); } return super.getBounds(); }
@Override public void setToolTipText (String string) { checkWidget(); super.setToolTipText (string); Shell shell = _getShell (); ToolItem [] items = getItems (); for (int i = 0; i < items.length; i++) { String newString = string != null ? null : items [i].toolTipText; shell.setToolTipText (items [i].handle, newString); } }
@Override public boolean setParent (Composite parent) { checkWidget (); if (!super.setParent (parent)) return false; int /*long*/ hwndParent = parent.handle; OS.SendMessage (handle, OS.TB_SETPARENT, hwndParent, 0); /* * Bug in Windows. When a tool bar is reparented, the tooltip * control that is automatically created for the item is not * reparented to the new shell. The fix is to move the tooltip * over using SetWindowLongPtr(). Note that for some reason, * SetParent() does not work. */ int /*long*/ hwndShell = parent.getShell ().handle; int /*long*/ hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0); OS.SetWindowLongPtr (hwndToolTip, OS.GWLP_HWNDPARENT, hwndShell); return true; }