| Summary: | [CSS] CTabItem should support color, background-color | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Kevin McGuire <Kevin_McGuire> | ||||||||
| Component: | UI | Assignee: | Project Inbox <e4.ui-inbox> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | kai.toedter, remy.suen | ||||||||
| Version: | 0.9 | ||||||||||
| Target Milestone: | 0.9 RC1 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 282898 | ||||||||||
| Attachments: |
|
||||||||||
(In reply to comment #0) > Under the covers it would call CTabFolder API (since that's where the colors > are stored). Kevin, you are speaking of CTabFolder's setForeground/setSelectionForeground and setBackground/setSelectionBackground, correct? > Certain things wouldn't work though, like: > > CTabItem { > color: black; > } > > CTabItem.special { > color: green; > } > > since a given CTabFolder can only maintain two colors, one for selected and one > for non-selected tabs. This should change if SWT implements bug 280969. (In reply to comment #1) > (In reply to comment #0) > > Under the covers it would call CTabFolder API (since that's where the colors > > are stored). > > Kevin, you are speaking of CTabFolder's setForeground/setSelectionForeground > and setBackground/setSelectionBackground, correct? Correct Remi. Conceptually from a CSS point of view, these should be set on the tabs themselves. One problem I hit in trying to implement Linda's design mockup is that setBackground() sets both the background area of the tab folder itself (ie. the top area if there were no tabs), as well as the color of the unselected tab. We wanted those to be different. In ETabFolder/ETabItem I added another color for the tab area background, which presently is hardcoded to Linda's design. I want to be able to set it from the CSS obviously. To do so, we need to be able to style from CSS the tabs themselves (why I'm discussing all this in this bug). So we'd have: ETabItem { background: ...; /* unselected tab background color */ } ETabItem:selected { background: ...; /* selected tab background color */ } ETabFolder { background: ...; /* the NEW tab area background color" } Otherwise we'd need to add a new property for ETabFolder, "tabAreaBackground:" or something ucky. It's a bit tight but I'd love to be able to get this fixed this week. See bug #282898. > This should change if SWT implements bug 280969. Cool! We could apply this to ETabFolder/Item but maybe post 0.9 as I have something now that works for the cases we care about, we just minus the CSS. Should consider for RC1 as would allow us to fix bug #282898 Created attachment 141376 [details] CTabItem color attributes patch v1 This patch reuses the same (somewhat annoying and verbose) class checking logic to consider Widgets instead of Controls that we introduced with attachment 139714 [details]. Created attachment 141377 [details]
CTabItem color attributes patch v2
Whoops, I forgot to include GradientTest in my patch.
(In reply to comment #5) > Created an attachment (id=141377) [details] > CTabItem color attributes patch v2 If a style sheet simply defines a colour without defining one for the "selected" pseudo, the selection colour will be set as the "parent" one's anyway. (In reply to comment #7) > If a style sheet simply defines a colour without defining one for the > "selected" pseudo, the selection colour will be set as the "parent" one's > anyway. I guess it's questionable as to whether this is a problem or not. If the person thinks about the API then it doesn't really map right. On the other hand, if one just wants the foreground colour to change, it may be their intent to set it at a "global" level encompassing both unselected and selected foreground colours. Remy, with this patch, CTabFolder:selected would no longer work for tab background and text coloring, right? It's a complete switch to CTabItem? Just wondering if that'd be harsh for adopters for RC1 ... but maybe I need to stop thinking about backwards compat :) Created attachment 141579 [details] CTabItem color attributes patch v2b This patch v2b will alter AbstractCSSEngine to correct the problem described by comment 7, if it really is a problem. From testing CTabFolder, this does not appear to be an actual regression, that is, our original code exhibited the identical behaviour for CTabFolder styling. (In reply to comment #9) > Remy, with this patch, CTabFolder:selected would no longer work for tab > background and text coloring, right? It's a complete switch to CTabItem? This is correct. I could attempt to make modifications to the code to keep it in if you wish. Released, thanks for the patch Remy! (In reply to comment #10) > This patch v2b will alter AbstractCSSEngine to correct the problem described by > comment 7, if it really is a problem. From testing CTabFolder, this does not > appear to be an actual regression, that is, our original code exhibited the > identical behaviour for CTabFolder styling. Great! > (In reply to comment #9) > > Remy, with this patch, CTabFolder:selected would no longer work for tab > > background and text coloring, right? It's a complete switch to CTabItem? > > This is correct. I could attempt to make modifications to the code to keep it > in if you wish. Decided not to worry about it. Fact is, I'll be changing what ETabFolder { background-color: } means wrt tabs so I think the 'breakage' in terms of who now gets styled and why is unavoidable and acceptable given it's an incubator. Just need to inform the community once all the changes are in. Kai, FYI. I will update the contacts demo. Released changes to demo.contacts and demo.e4photo. Kai, do you want to double check the contacts demo to make sure it still looks like you intended? |
We should support color and background-color for CTabItem. This would allow things like: CTabItem { color: black; } CTabItem:selected { color: orange; } Under the covers it would call CTabFolder API (since that's where the colors are stored). Certain things wouldn't work though, like: CTabItem { color: black; } CTabItem.special { color: green; } since a given CTabFolder can only maintain two colors, one for selected and one for non-selected tabs.