private Point getChevronLocation(CTabFolder tabFolder) { // get the last visible item int numItems = tabFolder.getItemCount(); CTabItem item = null; for (int i = 0; i < numItems; i++) { CTabItem tempItem = tabFolder.getItem(i); if (tempItem.isShowing()) { item = tempItem; } } // if we have no visible tabs, abort. if (item == null) { return new Point(0, 0); } Rectangle itemBounds = item.getBounds(); int x = itemBounds.x + itemBounds.width; int y = itemBounds.y + itemBounds.height; return new Point(x, y); }
private Point getChevronLocation(CTabFolder tabFolder) { // get the last visible item int numItems = tabFolder.getItemCount(); CTabItem item = null; for (int i = 0; i < numItems; i++) { CTabItem tempItem = tabFolder.getItem(i); if (tempItem.isShowing()) { item = tempItem; } } // if we have no visible tabs, abort. if (item == null) { return new Point(0, 0); } Rectangle itemBounds = item.getBounds(); int x = itemBounds.x + itemBounds.width; int y = itemBounds.y + itemBounds.height; return new Point(x, y); }
@Override public void getLocation(AccessibleControlEvent e) { Rectangle location = null; Point pt = null; int childID = e.childID; if (childID == ACC.CHILDID_SELF) { location = getBounds(); pt = getParent().toDisplay(location.x, location.y); } else { if (childID >= 0 && childID < items.length && items[childID].showing) { location = items[childID].getBounds(); } if (location != null) { pt = toDisplay(location.x, location.y); } } if (location != null && pt != null) { e.x = pt.x; e.y = pt.y; e.width = location.width; e.height = location.height; } }
@Override public void getLocation(AccessibleControlEvent e) { Rectangle location = null; Point pt = null; int childID = e.childID; if (childID == ACC.CHILDID_SELF) { location = getBounds(); pt = getParent().toDisplay(location.x, location.y); } else { if (childID >= 0 && childID < items.length && items[childID].showing) { location = items[childID].getBounds(); } if (location != null) { pt = toDisplay(location.x, location.y); } } if (location != null && pt != null) { e.x = pt.x; e.y = pt.y; e.width = location.width; e.height = location.height; } }
public void getLocation(AccessibleControlEvent e) { Rectangle location = null; Point pt = null; int childID = e.childID; if (childID == ACC.CHILDID_SELF) { location = getBounds(); pt = getParent().toDisplay(location.x, location.y); } else { if (childID >= 0 && childID < items.length && items[childID].showing) { location = items[childID].getBounds(); } if (location != null) { pt = toDisplay(location.x, location.y); } } if (location != null && pt != null) { e.x = pt.x; e.y = pt.y; e.width = location.width; e.height = location.height; } }
void onMenuDetect(Event event) { if (event.detail == SWT.MENU_KEYBOARD) { if (selectedIndex != -1) { CTabItem item = items[selectedIndex]; Rectangle rect = getDisplay().map(this, null, item.getBounds()); if (!rect.contains(event.x, event.y)) { /* If the mouse is not in the currently-selected tab, * then pop up the menu near the top-right corner of the current tab. */ Rectangle itemTrim = renderer.computeTrim(selectedIndex, SWT.NONE, 0, 0, 0, 0); Rectangle closeTrim = renderer.computeTrim(CTabFolderRenderer.PART_CLOSE_BUTTON, SWT.NONE, 0, 0, 0, 0); event.x = rect.x + rect.width - item.closeRect.width + itemTrim.x - closeTrim.width; event.y = rect.y - itemTrim.y - closeTrim.y; } } } } void onMouseDoubleClick(Event event) {
void onMenuDetect(Event event) { if (event.detail == SWT.MENU_KEYBOARD) { if (selectedIndex != -1) { CTabItem item = items[selectedIndex]; Rectangle rect = getDisplay().map(this, null, item.getBounds()); if (!rect.contains(event.x, event.y)) { /* If the mouse is not in the currently-selected tab, * then pop up the menu near the top-right corner of the current tab. */ Rectangle itemTrim = renderer.computeTrim(selectedIndex, SWT.NONE, 0, 0, 0, 0); Rectangle closeTrim = renderer.computeTrim(CTabFolderRenderer.PART_CLOSE_BUTTON, SWT.NONE, 0, 0, 0, 0); event.x = rect.x + rect.width - item.closeRect.width + itemTrim.x - closeTrim.width; event.y = rect.y - itemTrim.y - closeTrim.y; } } } } void onMouseDoubleClick(Event event) {
void onMenuDetect(Event event) { if (event.detail == SWT.MENU_KEYBOARD) { if (selectedIndex != -1) { CTabItem item = items[selectedIndex]; Rectangle rect = getDisplay().map(this, null, item.getBounds()); if (!rect.contains(event.x, event.y)) { /* If the mouse is not in the currently-selected tab, * then pop up the menu near the top-right corner of the current tab. */ Rectangle itemTrim = renderer.computeTrim(selectedIndex, SWT.NONE, 0, 0, 0, 0); Rectangle closeTrim = renderer.computeTrim(CTabFolderRenderer.PART_CLOSE_BUTTON, SWT.NONE, 0, 0, 0, 0); event.x = rect.x + rect.width - item.closeRect.width + itemTrim.x - closeTrim.width; event.y = rect.y - itemTrim.y - closeTrim.y; } } } } void onMouseDoubleClick(Event event) {
@Override public void getChildAtPoint(AccessibleControlEvent e) { Point testPoint = toControl(e.x, e.y); int childID = ACC.CHILDID_NONE; for (int i = 0; i < items.length; i++) { if (items[i].getBounds().contains(testPoint)) { childID = i; break; } } if (childID == ACC.CHILDID_NONE) { Rectangle location = getBounds(); location.x = location.y = 0; location.height = location.height - getClientArea().height; if (location.contains(testPoint)) { childID = ACC.CHILDID_SELF; } } e.childID = childID; }
@Override public void getChildAtPoint(AccessibleControlEvent e) { Point testPoint = toControl(e.x, e.y); int childID = ACC.CHILDID_NONE; for (int i = 0; i < items.length; i++) { if (items[i].getBounds().contains(testPoint)) { childID = i; break; } } if (childID == ACC.CHILDID_NONE) { Rectangle location = getBounds(); location.x = location.y = 0; location.height = location.height - getClientArea().height; if (location.contains(testPoint)) { childID = ACC.CHILDID_SELF; } } e.childID = childID; }
void onMenuDetect(Event event) { if (event.detail == SWT.MENU_KEYBOARD) { if (selectedIndex != -1) { CTabItem item = items[selectedIndex]; Rectangle rect = getDisplay().map(this, null, item.getBounds()); if (!rect.contains(event.x, event.y)) { /* If the mouse is not in the currently-selected tab, * then pop up the menu near the top-right corner of the current tab. */ Rectangle itemTrim = renderer.computeTrim(selectedIndex, SWT.NONE, 0, 0, 0, 0); Rectangle closeTrim = renderer.computeTrim(CTabFolderRenderer.PART_CLOSE_BUTTON, SWT.NONE, 0, 0, 0, 0); event.x = rect.x + rect.width - item.closeRect.width + itemTrim.x - closeTrim.width; event.y = rect.y - itemTrim.y - closeTrim.y; } } } } void onMouseDoubleClick(Event event) {
public void getChildAtPoint(AccessibleControlEvent e) { Point testPoint = toControl(e.x, e.y); int childID = ACC.CHILDID_NONE; for (int i = 0; i < items.length; i++) { if (items[i].getBounds().contains(testPoint)) { childID = i; break; } } if (childID == ACC.CHILDID_NONE) { Rectangle location = getBounds(); location.x = location.y = 0; location.height = location.height - getClientArea().height; if (location.contains(testPoint)) { childID = ACC.CHILDID_SELF; } } e.childID = childID; }
@Override public void getChildAtPoint(AccessibleControlEvent e) { Point testPoint = toControl(e.x, e.y); int childID = ACC.CHILDID_NONE; for (int i = 0; i < items.length; i++) { if (items[i].getBounds().contains(testPoint)) { childID = i; break; } } if (childID == ACC.CHILDID_NONE) { Rectangle location = getBounds(); location.x = location.y = 0; location.height = location.height - getClientArea().height; if (location.contains(testPoint)) { childID = ACC.CHILDID_SELF; } } e.childID = childID; }
@Override public void getChildAtPoint(AccessibleControlEvent e) { Point testPoint = toControl(e.x, e.y); int childID = ACC.CHILDID_NONE; for (int i = 0; i < items.length; i++) { if (items[i].getBounds().contains(testPoint)) { childID = i; break; } } if (childID == ACC.CHILDID_NONE) { Rectangle location = getBounds(); location.x = location.y = 0; location.height = location.height - getClientArea().height; if (location.contains(testPoint)) { childID = ACC.CHILDID_SELF; } } e.childID = childID; }
/** * @param dragElement */ private void showFrame(MUIElement dragElement) { CTabFolder ctf = (CTabFolder) dropStack.getWidget(); CTabItem[] items = ctf.getItems(); CTabItem item = null; for (CTabItem tabItem : items) { if (tabItem.getData(AbstractPartRenderer.OWNING_ME) == dragElement) { item = tabItem; break; } } Rectangle bounds = item.getBounds(); bounds = Display.getCurrent().map(dropCTF, null, bounds); Rectangle outerBounds = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6); dndManager.frameRect(outerBounds); }
/** * @param dragElement */ private void showFrame(MUIElement dragElement) { CTabFolder ctf = (CTabFolder) dropStack.getWidget(); CTabItem[] items = ctf.getItems(); CTabItem item = null; for (int i = 0; i < items.length; i++) { if (items[i].getData(AbstractPartRenderer.OWNING_ME) == dragElement) { item = items[i]; break; } } Rectangle bounds = item.getBounds(); bounds = Display.getCurrent().map(dropCTF, null, bounds); Rectangle outerBounds = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6); dndManager.frameRect(outerBounds); }
public void preserveValues( final Widget widget ) { CTabItem item = ( CTabItem )widget; CTabFolder parent = item.getParent(); IWidgetAdapter adapter = WidgetUtil.getAdapter( item ); adapter.preserve( PROP_TEXT, getShortenedText( item ) ); adapter.preserve( PROP_IMAGE, getImage( item ) ); WidgetLCAUtil.preserveToolTipText( item, item.getToolTipText() ); adapter.preserve( PROP_BOUNDS, item.getBounds() ); adapter.preserve( PROP_SELECTED, isItemSelected( item ) ); boolean closeVisible = parent.getUnselectedCloseVisible(); adapter.preserve( PROP_UNSELECTED_CLOSE_VISIBLE, Boolean.valueOf( closeVisible ) ); adapter.preserve( PROP_SHOWING, Boolean.valueOf( item.isShowing() ) ); adapter.preserve( PROP_SHOW_CLOSE, Boolean.valueOf( item.getShowClose() ) ); adapter.preserve( PROP_FIRST_ITEM, Boolean.valueOf( item == item.getParent().getItem( 0 ) ) ); preserveFont( item ); WidgetLCAUtil.preserveCustomVariant( item ); }
public void renderChanges( final Widget widget ) throws IOException { CTabItem item = ( CTabItem )widget; WidgetLCAUtil.writeBounds( item, item.getParent(), item.getBounds() ); writeText( item ); writeImage( item ); writeFont( item ); WidgetLCAUtil.writeToolTip( item, item.getToolTipText() ); writeShowing( item ); writeShowClose( item ); writeUnselectedCloseVisible( item ); writeSelection( item ); writeFirstItem( item ); WidgetLCAUtil.writeCustomVariant( item ); }
@Override public void preserveValues( CTabItem item ) { WidgetLCAUtil.preserveToolTipText( item, item.getToolTipText() ); WidgetLCAUtil.preserveBounds( item, item.getBounds() ); WidgetLCAUtil.preserveFont( item, getFont( item ) ); preserveProperty( item, PROP_TEXT, getText( item ) ); preserveProperty( item, PROP_IMAGE, getImage( item ) ); preserveProperty( item, PROP_SHOWING, item.isShowing() ); preserveProperty( item, PROP_SHOW_CLOSE, item.getShowClose() ); preserveProperty( item, PROP_BADGE, getBadge( item ) ); }
@Override public void renderChanges( CTabItem item ) throws IOException { WidgetLCAUtil.renderCustomVariant( item ); WidgetLCAUtil.renderData( item ); WidgetLCAUtil.renderToolTip( item, item.getToolTipText() ); WidgetLCAUtil.renderBounds( item, item.getBounds() ); WidgetLCAUtil.renderFont( item, getFont( item ) ); renderText( item ); renderMnemonicIndex( item ); renderProperty( item, PROP_IMAGE, getImage( item ), null ); renderProperty( item, PROP_SHOWING, item.isShowing(), true ); renderProperty( item, PROP_SHOW_CLOSE, item.getShowClose(), false ); renderProperty( item, PROP_BADGE, getBadge( item ), null ); }