@Override public Font getFont(int columnIndex) { return item.getFont(columnIndex); }
@Override public Font getFont(int columnIndex) { return item.getFont(columnIndex); }
public Font getFont(int columnIndex) { return item.getFont(columnIndex); }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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> * * @since 3.0 */ public Font getFont (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.columnCount); if (0 > index || index > count - 1) return getFont (); if (cellFont == null || cellFont [index] == null) return getFont (); return cellFont [index]; }
private TableItem max( TableItem item1, TableItem item2 ) { TableItem result; int item1TextWidth = getStringExtent( item1.getFont(), item1.getText( 0 ) ).x; int item2TextWidth = getStringExtent( item2.getFont(), item2.getText( 0 ) ).x; if( item1TextWidth > item2TextWidth ) { result = item1; } else { result = item2; } return result; }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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> * * @since 3.0 */ public Font getFont (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.columnCount); if (0 > index || index > count - 1) return getFont (); if (cellFont == null || cellFont [index] == null) return getFont (); return cellFont [index]; }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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> * * @since 3.0 */ public Font getFont (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.columnCount); if (0 > index || index > count -1) return getFont (); if (cellFont == null || cellFont [index] == null) return getFont (); return cellFont [index]; }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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> * * @since 3.0 */ public Font getFont (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.columnCount); if (0 > index || index > count - 1) return getFont (); if (cellFont == null || cellFont [index] == null) return getFont (); return cellFont [index]; }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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> * * @since 3.0 */ public Font getFont (int index) { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count -1) return getFont (); if (cellFont == null || cellFont [index] == null) return getFont (); return cellFont [index]; }
public static void bold(TableItem item, int index) { item.setFont(index, bold(item.getFont(), item.getDisplay())); }
/** * Returns the font that the receiver will use to paint textual information * for the specified cell in this item. * * @param index the column index * @return the receiver's font * * @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 Font getFont( int index ) { checkWidget(); if( !parent.checkData( this, parent.indexOf( this ) ) ) { error( SWT.ERROR_WIDGET_DISPOSED ); } Font result = getFont(); if( hasData( index ) && data[ index ].font != null ) { result = data[ index ].font; } return result; }
private int updateTextLayout(TableItem item, int index, boolean isSelected) { fSharedLayout.setFont(item.getFont(index)); // XXX: needed to clear the style info, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226090 fSharedLayout.setText(""); //$NON-NLS-1$ fSharedLayout.setText(item.getText(index)); int originalTextWidth= fSharedLayout.getBounds().width; // text width without any styles StyleRange[] ranges= getStyledRanges(item, index); if (ranges != null) { for (int i= 0; i < ranges.length; i++) { StyleRange curr= ranges[i]; if (isSelected) { curr= (StyleRange) curr.clone(); curr.foreground= null; curr.background= null; } fSharedLayout.setStyle(curr, curr.start, curr.start + curr.length - 1); } } return fSharedLayout.getBounds().width - originalTextWidth; }
private int updateTextLayout(TableItem item, int index, boolean isSelected) { fSharedLayout.setFont(item.getFont(index)); // XXX: needed to clear the style info, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=226090 fSharedLayout.setText(""); //$NON-NLS-1$ fSharedLayout.setText(item.getText(index)); int originalTextWidth= fSharedLayout.getBounds().width; // text width without any styles StyleRange[] ranges= getStyledRanges(item, index); if (ranges != null) { for (StyleRange range : ranges) { StyleRange curr= range; if (isSelected) { curr= (StyleRange) curr.clone(); curr.foreground= null; curr.background= null; } fSharedLayout.setStyle(curr, curr.start, curr.start + curr.length - 1); } } return fSharedLayout.getBounds().width - originalTextWidth; }
/** * Sets the font of TableItem 0. */ void setItemFont () { if (!instance.startup) { table1.getItem (0).setFont (itemFont); } /* Set the font item's image to match the font of the item. */ Font ft = itemFont; if (ft == null) ft = table1.getItem (0).getFont (); TableItem item = colorAndFontTable.getItem(ITEM_FONT); Image oldImage = item.getImage(); if (oldImage != null) oldImage.dispose(); item.setImage (fontImage(ft)); item.setFont(ft); colorAndFontTable.layout (); }
/** * Sets the font of the Row 0 TableItem in column 1. */ void setCellFont () { if (!instance.startup) { table1.getItem (0).setFont (1, cellFont); } /* Set the font item's image to match the font of the item. */ Font ft = cellFont; if (ft == null) ft = table1.getItem (0).getFont (1); TableItem item = colorAndFontTable.getItem(CELL_FONT); Image oldImage = item.getImage(); if (oldImage != null) oldImage.dispose(); item.setImage (fontImage(ft)); item.setFont(ft); colorAndFontTable.layout (); }
data.paintRect = widget.frame (); GC gc = GC.cocoa_new (this, data); gc.setFont (item.getFont (columnIndex)); Event event = new Event (); event.item = item;
Event sendPaintItemEvent (TableItem item, NMTTCUSTOMDRAW nmcd, int column, RECT itemRect) { int nSavedDC = OS.SaveDC (nmcd.hdc); RECT insetRect = toolTipInset (itemRect); OS.SetWindowOrgEx (nmcd.hdc, insetRect.left, insetRect.top, null); GCData data = new GCData (); data.device = display; data.font = item.getFont (column); data.foreground = OS.GetTextColor (nmcd.hdc); data.background = OS.GetBkColor (nmcd.hdc); data.uiState = (int)/*64*/OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); GC gc = GC.win32_new (nmcd.hdc, data); Event event = new Event (); event.item = item; event.index = column; event.gc = gc; event.detail |= SWT.FOREGROUND; event.setBoundsInPixels(new Rectangle(itemRect.left, itemRect.top, itemRect.right - itemRect.left, itemRect.bottom - itemRect.top)); //gc.setClipping (cellRect.left, cellRect.top, cellWidth, cellHeight); sendEvent (SWT.PaintItem, event); event.gc = null; gc.dispose (); OS.RestoreDC (nmcd.hdc, nSavedDC); return event; }
Event sendEraseItemEvent (TableItem item, NMTTCUSTOMDRAW nmcd, int column, RECT cellRect) { int nSavedDC = OS.SaveDC (nmcd.hdc); RECT insetRect = toolTipInset (cellRect); OS.SetWindowOrgEx (nmcd.hdc, insetRect.left, insetRect.top, null); GCData data = new GCData (); data.device = display; data.foreground = OS.GetTextColor (nmcd.hdc); data.background = OS.GetBkColor (nmcd.hdc); data.font = item.getFont (column); data.uiState = (int)/*64*/OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); GC gc = GC.win32_new (nmcd.hdc, data); Event event = new Event (); event.item = item; event.index = column; event.gc = gc; event.detail |= SWT.FOREGROUND; event.setBoundsInPixels(new Rectangle(cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top)); //gc.setClipping (event.x, event.y, event.width, event.height); sendEvent (SWT.EraseItem, event); event.gc = null; //int newTextClr = data.foreground; gc.dispose (); OS.RestoreDC (nmcd.hdc, nSavedDC); return event; }
Font font= tableItem.getFont(event.index); processColoredLabel(coloredLabel, gc, textBounds, isSelected, font);
gc.setFont (item.getFont (columnIndex)); Event event = new Event (); event.item = item;