expanded = true;
if ((expansionStyle & EXPANDED) != 0)
expanded = true;
if (toggle != null) {
toggle.setExpanded(expanded);
toggle.addHyperlinkListener(new HyperlinkAdapter() {
public void linkActivated(HyperlinkEvent e) {
toggleState();
}
});
toggle.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
if (textLabel instanceof Label && !isFixedStyle())
textLabel.setForeground(toggle.hover ? toggle
.getHoverDecorationColor()
: getTitleBarForeground());
}
});
toggle.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.ARROW_UP) {
verticalMove(false);
e.doit = false;
} else if (e.keyCode == SWT.ARROW_DOWN) {
verticalMove(true);
e.doit = false;
}
}
});
if ((getExpansionStyle()&FOCUS_TITLE)==0) {
toggle.paintFocus=false;
toggle.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
if (textLabel != null) {
textLabel.redraw();
}
}
public void focusLost(FocusEvent e) {
if (textLabel != null) {
textLabel.redraw();
}
}
});
}
}
if ((expansionStyle & FOCUS_TITLE) != 0) {
Hyperlink link = new Hyperlink(this, SWT.WRAP);
link.addHyperlinkListener(new HyperlinkAdapter() {
public void linkActivated(HyperlinkEvent e) {
programmaticToggleState();
}
});
textLabel = link;