/** * Returns the tab item at the given point in the receiver or null if no such item exists. The * point is in the coordinate system of the receiver. * * @param point the point used to locate the item * @return the tab item at the given point, or null if the point is not in a tab item * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the point is null * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> * * @since 3.4 */ public TabItem getItem(Point point) { checkWidget(); if (point == null) error(SWT.ERROR_NULL_ARGUMENT); long /*int*/ list = OS.gtk_container_get_children(handle); if (list == 0) return null; int itemCount = OS.g_list_length(list); OS.g_list_free(list); for (int i = 0; i < itemCount; i++) { TabItem item = items[i]; Rectangle rect = item.getBounds(); if (rect.contains(point)) return item; } return null; }
void resizeControl() { if (control != null && !control.isDisposed()) { /* * Set the size and location of the control * separately to minimize flashing in the * case where the control does not resize * to the size that was requested. This * case can occur when the control is a * combo box. */ Rectangle itemRect = getBounds(); control.setSize(itemRect.width, itemRect.height); Rectangle rect = control.getBounds(); rect.x = itemRect.x + (itemRect.width - rect.width) / 2; rect.y = itemRect.y + (itemRect.height - rect.height) / 2; control.setLocation(rect.x, rect.y); } }