diff options
author | Lakshmi Shanmugam <lshanmug@in.ibm.com> | 2012-02-24 18:56:25 +0530 |
---|---|---|
committer | Lakshmi Shanmugam <lshanmug@in.ibm.com> | 2012-02-24 18:56:25 +0530 |
commit | ffbb45ebcfe4cf4170e71894082281c96df7160f (patch) | |
tree | 0bde4048c80d7c775a85e579347621c3872ae214 /bundles | |
parent | a8189a6964395deccbdaed68f022dc5abf6d4402 (diff) | |
download | eclipse.platform.swt-ffbb45ebcfe4cf4170e71894082281c96df7160f.tar.gz eclipse.platform.swt-ffbb45ebcfe4cf4170e71894082281c96df7160f.tar.xz eclipse.platform.swt-ffbb45ebcfe4cf4170e71894082281c96df7160f.zip |
Bug 355341-[10.7] TabFolder doesn't look native
(selected item's text not inverted)
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java | 13 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java | 11 |
2 files changed, 16 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java index b842321ae6..c6f423843a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java @@ -156,11 +156,6 @@ public Rectangle computeTrim (int x, int y, int width, int height) { return super.computeTrim (x, y, width, height); } -NSAttributedString createString(String text) { - NSAttributedString attribStr = createString(text, null, foreground, 0, false, true, true); - return attribStr; -} - void createHandle () { NSTabView widget = (NSTabView)new SWTTabView().alloc(); widget.init (); @@ -501,15 +496,17 @@ void reskinChildren (int flags) { void setFont (NSFont font) { ((NSTabView)view).setFont(font); + int index = getSelectionIndex(); for (int i = 0; i < itemCount; i++) { - items[i].updateText(); + items[i].updateText(i == index); } } void setForeground (float /*double*/ [] color) { super.setForeground(color); + int index = getSelectionIndex(); for (int i = 0; i < itemCount; i++) { - items[i].updateText(); + items[i].updateText(i == index); } } @@ -644,6 +641,7 @@ void tabView_willSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long if (currentIndex != -1) { TabItem selected = items [currentIndex]; if (selected != null) { + if (OS.VERSION >= 0x1070) selected.updateText(false); Control control = selected.control; if (control != null && !control.isDisposed ()) { control.setVisible (false); @@ -654,6 +652,7 @@ void tabView_willSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long if (control != null && !control.isDisposed ()) { control.setVisible (true); } + if (OS.VERSION >= 0x1070) item.updateText(true); break; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java index 481c041fb7..697dd89337 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java @@ -433,10 +433,19 @@ String tooltipText () { } void updateText () { + NSTabViewItem selected = ((NSTabView)parent.view).selectedTabViewItem(); + updateText(selected != null && selected.id == nsItem.id); +} + +void updateText (boolean selected) { if (attriStr != null) { attriStr.release(); } - attriStr = parent.createString(getText()); + float /*double*/ [] foreground = parent.foreground; + if (foreground == null && selected && OS.VERSION >= 0x1070) { + foreground = display.getNSColorRGB(NSColor.alternateSelectedControlTextColor()); + } + attriStr = parent.createString(text, null, foreground, 0, false, true, true); //force parent to resize nsItem.setLabel(NSString.string()); } |