本文整理了Java中org.eclipse.swt.widgets.Tree.hooks()
方法的一些代码示例,展示了Tree.hooks()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.hooks()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:hooks
暂无
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
boolean isCustomToolTip () {
return hooks (SWT.MeasureItem);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
void enableDrag (boolean enabled) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if (enabled && hooks (SWT.DragDetect)) {
bits &= ~OS.TVS_DISABLEDRAGDROP;
} else {
bits |= OS.TVS_DISABLEDRAGDROP;
}
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
LRESULT WM_HSCROLL (int /*long*/ wParam, int /*long*/ lParam) {
boolean fixScroll = false;
if ((style & SWT.DOUBLE_BUFFERED) != 0) {
fixScroll = (style & SWT.VIRTUAL) != 0 || hooks (SWT.EraseItem) || hooks (SWT.PaintItem);
}
if (fixScroll) {
style &= ~SWT.DOUBLE_BUFFERED;
if (explorerTheme) {
OS.SendMessage (handle, OS.TVM_SETEXTENDEDSTYLE, OS.TVS_EX_DOUBLEBUFFER, 0);
}
}
LRESULT result = super.WM_HSCROLL (wParam, lParam);
if (fixScroll) {
style |= SWT.DOUBLE_BUFFERED;
if (explorerTheme) {
OS.SendMessage (handle, OS.TVM_SETEXTENDEDSTYLE, OS.TVS_EX_DOUBLEBUFFER, OS.TVS_EX_DOUBLEBUFFER);
}
}
if (result != null) return result;
return result;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void redraw (int columnIndex) {
if (parent.ignoreRedraw || !isDrawing()) return;
/* redraw the full item if columnIndex == -1 */
NSOutlineView outlineView = (NSOutlineView) parent.view;
NSRect rect;
if (columnIndex == -1 || parent.hooks (SWT.MeasureItem) || parent.hooks (SWT.EraseItem) || parent.hooks (SWT.PaintItem)) {
rect = outlineView.rectOfRow (outlineView.rowForItem (handle));
} else {
int index;
if (parent.columnCount == 0) {
index = (parent.style & SWT.CHECK) != 0 ? 1 : 0;
} else {
if (0 <= columnIndex && columnIndex < parent.columnCount) {
index = parent.indexOf (parent.columns[columnIndex].nsColumn);
} else {
return;
}
}
rect = outlineView.frameOfCellAtColumn (index, outlineView.rowForItem (handle));
}
outlineView.setNeedsDisplayInRect (rect);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
case OS.SB_PAGEDOWN:
case OS.SB_PAGEUP:
fixScroll = (style & SWT.VIRTUAL) != 0 || hooks (SWT.EraseItem) || hooks (SWT.PaintItem);
break;
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void highlightSelectionInClipRect(long /*int*/ id, long /*int*/ sel, long /*int*/ rect) {
if (hooks (SWT.EraseItem)) return;
if ((style & SWT.HIDE_SELECTION) != 0 && !hasFocus()) return;
NSRect clipRect = new NSRect ();
OS.memmove (clipRect, rect, NSRect.sizeof);
callSuper (id, sel, clipRect);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void redraw () {
if (parent.currentItem == this || !parent.getDrawing ()) return;
int /*long*/ hwnd = parent.handle;
if (!OS.IsWindowVisible (hwnd)) return;
/*
* When there are no columns and the tree is not
* full selection, redraw only the text. This is
* an optimization to reduce flashing.
*/
boolean full = (parent.style & (SWT.FULL_SELECTION | SWT.VIRTUAL)) != 0;
if (!full) {
full = parent.columnCount != 0;
if (!full) {
if (parent.hooks (SWT.EraseItem) || parent.hooks (SWT.PaintItem)) {
full = true;
}
}
}
RECT rect = new RECT ();
if (OS.TreeView_GetItemRect (hwnd, handle, rect, !full)) {
OS.InvalidateRect (hwnd, rect, true);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void updateFullSelection () {
if ((style & SWT.FULL_SELECTION) != 0) {
int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
if ((newBits & OS.TVS_FULLROWSELECT) != 0) {
if (!OS.IsWindowEnabled (handle) || findImageControl () != null) {
if (!explorerTheme) newBits &= ~OS.TVS_FULLROWSELECT;
}
} else {
if (OS.IsWindowEnabled (handle) && findImageControl () == null) {
if (!hooks (SWT.EraseItem) && !hooks (SWT.PaintItem)) {
newBits |= OS.TVS_FULLROWSELECT;
}
}
}
if (newBits != oldBits) {
OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
OS.InvalidateRect (handle, null, true);
}
}
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void setFont (NSFont font) {
super.setFont (font);
setItemHeight (null, font, !hooks (SWT.MeasureItem));
view.setNeedsDisplay (true);
clearCachedWidth (items);
setScrollWidth ();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
TreeItem getItemInPixels (Point point) {
TVHITTESTINFO lpht = new TVHITTESTINFO ();
lpht.x = point.x;
lpht.y = point.y;
OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
if (lpht.hItem != 0) {
int flags = OS.TVHT_ONITEM;
if ((style & SWT.FULL_SELECTION) != 0) {
flags |= OS.TVHT_ONITEMRIGHT | OS.TVHT_ONITEMINDENT;
} else {
if (hooks (SWT.MeasureItem)) {
lpht.flags &= ~(OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL);
if (hitTestSelection (lpht.hItem, lpht.x, lpht.y)) {
lpht.flags |= OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL;
}
}
}
if ((lpht.flags & flags) != 0) return _getItem (lpht.hItem);
}
return null;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW nmcd, int /*long*/ wParam, int /*long*/ lParam) {
if (explorerTheme) {
if ((OS.IsWindowEnabled (handle) && hooks (SWT.EraseItem)) || findImageControl () != null) {
RECT rect = new RECT ();
OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
drawBackground (nmcd.hdc, rect);
}
}
return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
if (!hooks (SWT.MeasureItem) && !hooks (SWT.EraseItem) && !hooks (SWT.PaintItem)) {
customDraw = false;
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
NSSize cellSize (long /*int*/ id, long /*int*/ sel) {
NSSize size = super.cellSize(id, sel);
NSCell cell = new NSCell(id);
NSImage image = cell.image();
if (image != null) size.width += imageBounds.width + IMAGE_GAP;
if (hooks(SWT.MeasureItem)) {
long /*int*/ [] outValue = new long /*int*/ [1];
OS.object_getInstanceVariable(id, Display.SWT_ROW, outValue);
TreeItem item = (TreeItem) display.getWidget (outValue [0]);
OS.object_getInstanceVariable(id, Display.SWT_COLUMN, outValue);
long /*int*/ tableColumn = outValue[0];
int columnIndex = 0;
for (int i=0; i<columnCount; i++) {
if (columns [i].nsColumn.id == tableColumn) {
columnIndex = i;
break;
}
}
sendMeasureItem (item, cell.isHighlighted(), columnIndex, size);
}
return size;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
NSRect expansionRect;
if (rect.width != 0 && rect.height != 0) {
if (hooks(SWT.MeasureItem)) {
expansionRect = cellRect;
NSSize cellSize = cell.cellSize();
if (hooks(SWT.MeasureItem)) {
expansionRect = cellRect;
NSSize cellSize = cell.cellSize();
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
boolean canDragRowsWithIndexes_atPoint(long /*int*/ id, long /*int*/ sel, long /*int*/ rowIndexes, NSPoint mouseDownPoint) {
if (!super.canDragRowsWithIndexes_atPoint(id, sel, rowIndexes, mouseDownPoint)) return false;
// If the current row is not selected and the user is not attempting to modify the selection, select the row first.
NSTableView widget = (NSTableView)view;
long /*int*/ row = widget.rowAtPoint(mouseDownPoint);
long /*int*/ modifiers = NSApplication.sharedApplication().currentEvent().modifierFlags();
boolean drag = (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect);
if (drag) {
if (!widget.isRowSelected(row) && (modifiers & (OS.NSCommandKeyMask | OS.NSShiftKeyMask | OS.NSAlternateKeyMask | OS.NSControlKeyMask)) == 0) {
NSIndexSet set = (NSIndexSet)new NSIndexSet().alloc();
set = set.initWithIndex(row);
widget.selectRowIndexes (set, false);
set.release();
}
}
// The clicked row must be selected to initiate a drag.
return (widget.isRowSelected(row) && drag) || !hasFocus();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
boolean hitTestSelection (int /*long*/ hItem, int x, int y) {
if (hItem == 0) return false;
TreeItem item = _getItem (hItem);
if (item == null) return false;
if (!hooks (SWT.MeasureItem)) return false;
boolean result = false;
//BUG? - moved columns, only hittest first column
//BUG? - check drag detect
int [] order = new int [1], index = new int [1];
int /*long*/ hDC = OS.GetDC (handle);
int /*long*/ oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
int /*long*/ hFont = item.fontHandle (order [index [0]]);
if (hFont != -1) hFont = OS.SelectObject (hDC, hFont);
int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
int detail = (state & OS.TVIS_SELECTED) != 0 ? SWT.SELECTED : 0;
Event event = sendMeasureItemEvent (item, order [index [0]], hDC, detail);
if (event.getBoundsInPixels ().contains (x, y)) result = true;
if (newFont != 0) OS.SelectObject (hDC, oldFont);
OS.ReleaseDC (handle, hDC);
// if (isDisposed () || item.isDisposed ()) return false;
return result;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
sendMeasure = cached;
if (sendMeasure && parent.hooks (SWT.MeasureItem)) {
gc.setFont (font);
Event event = new Event ();
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void sendMeasureEvent (long /*int*/ cell, long /*int*/ width, long /*int*/ height) {
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell) && hooks (SWT.MeasureItem)) {
long /*int*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TreeItem item = null;
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void sendMeasureEvent (int /*long*/ cell, int /*long*/ width, int /*long*/ height) {
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell) && hooks (SWT.MeasureItem)) {
int /*long*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TreeItem item = null;
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void sendMeasureEvent (int /*long*/ cell, int /*long*/ width, int /*long*/ height) {
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell) && hooks (SWT.MeasureItem)) {
int /*long*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TreeItem item = null;
内容来源于网络,如有侵权,请联系作者删除!