|
|
|
Re: Styling MPartStack tab-height with relative height [message #1727802 is a reply to message #1727659] |
Sun, 27 March 2016 18:29 |
Andreas Buchen Messages: 123 Registered: July 2009 |
Senior Member |
|
|
I now configured a custom renderer:
.MPartStack {
swt-tab-renderer: url('bundleclass://name.abuchen.portfolio.ui/name.abuchen.portfolio.ui.renderers.CTabRendering');
}
with a trivial implementation:
public class CTabRendering extends CTabFolderRenderer
{
public CTabRendering(CTabFolder parent)
{
super(parent);
}
@Override
protected Point computeSize(int part, int state, GC gc, int wHint, int hHint)
{
if (part != PART_HEADER)
return super.computeSize(part, state, gc, wHint, hHint);
int height = gc.textExtent("Default", SWT.DRAW_TRANSPARENT | SWT.DRAW_MNEMONIC).y + 12; //$NON-NLS-1$
Rectangle trim = computeTrim(part, state, 0, 0, 0, height);
return new Point(trim.width, trim.height);
}
}
(Alternatively, one could / should iterate over the tabs and compute individual sizes. However, in my use case, I do not have icons and alternative fonts).
|
|
|
Powered by
FUDForum. Page generated in 0.03111 seconds