Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Priya Shanmugam2019-05-17 06:44:05 -0400
committerLakshmi Shanmugam2019-05-17 10:17:58 -0400
commitd119e6e20762735d3205896d791bf71952dc31ec (patch)
tree098c07d81c4b1f78fb76775daea4c24dd9c30b75
parentd9e0e6eefdc3147775d0ff2f742216c49c86c98b (diff)
downloadeclipse.platform.swt-d119e6e20762735d3205896d791bf71952dc31ec.tar.gz
eclipse.platform.swt-d119e6e20762735d3205896d791bf71952dc31ec.tar.xz
eclipse.platform.swt-d119e6e20762735d3205896d791bf71952dc31ec.zip
Bug 537125: Table/Tree header cannot apply font size
Set Table/Tree's font to header cell. Set header's height too in setItemHeight(). Change-Id: I09946f1dd01e08b60d77c31c733e8dc5675c2514
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java9
2 files changed, 18 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
index 161429c0a5..d3374e8e5d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
@@ -632,6 +632,7 @@ void createItem (TableColumn column, int index) {
}
column.createJNIRef ();
NSTableHeaderCell headerCell = (NSTableHeaderCell)new SWTTableHeaderCell ().alloc ().init ();
+ if (font != null) headerCell.setFont(font.handle);
nsColumn.setHeaderCell (headerCell);
display.addWidget (headerCell, column);
column.nsColumn = nsColumn;
@@ -2615,6 +2616,9 @@ public void setColumnOrder (int [] order) {
@Override
void setFont (NSFont font) {
super.setFont (font);
+ for (int i = 0; i < columnCount; i++) {
+ columns[i].nsColumn.headerCell().setFont(font);
+ }
setItemHeight (null, font, !hooks (SWT.MeasureItem));
view.setNeedsDisplay (true);
clearCachedWidth (items);
@@ -2777,6 +2781,11 @@ void setItemHeight (Image image, NSFont font, boolean set) {
NSTableView widget = (NSTableView)view;
if (set || widget.rowHeight () < height) {
widget.setRowHeight (height);
+ if (headerView != null) {
+ NSRect frame = headerView.frame();
+ frame.height = height;
+ headerView.setFrame(frame);
+ }
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
index fcbf5c28ae..171707538d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
@@ -681,6 +681,7 @@ void createItem (TreeColumn column, int index) {
}
column.createJNIRef ();
NSTableHeaderCell headerCell = (NSTableHeaderCell)new SWTTableHeaderCell ().alloc ().init ();
+ if (font != null) headerCell.setFont(font.handle);
nsColumn.setHeaderCell (headerCell);
display.addWidget (headerCell, column);
column.nsColumn = nsColumn;
@@ -2908,6 +2909,9 @@ public void setColumnOrder (int [] order) {
@Override
void setFont (NSFont font) {
super.setFont (font);
+ for (int i = 0; i < columnCount; i++) {
+ columns[i].nsColumn.headerCell().setFont(font);
+ }
setItemHeight (null, font, !hooks (SWT.MeasureItem));
view.setNeedsDisplay (true);
clearCachedWidth (items);
@@ -3109,6 +3113,11 @@ void setItemHeight (Image image, NSFont font, boolean set) {
NSTableView widget = (NSTableView)view;
if (set || widget.rowHeight () < height) {
widget.setRowHeight (height);
+ if (headerView != null) {
+ NSRect frame = headerView.frame();
+ frame.height = height;
+ headerView.setFrame(frame);
+ }
}
}

Back to the top