1 package org
.argeo
.cms
.ui
.eclipse
.forms
;
3 import org
.eclipse
.jface
.resource
.JFaceResources
;
4 import org
.eclipse
.jface
.window
.Window
;
5 import org
.eclipse
.swt
.SWT
;
6 //import org.eclipse.swt.custom.CCombo;
7 import org
.eclipse
.swt
.custom
.ScrolledComposite
;
8 import org
.eclipse
.swt
.events
.FocusAdapter
;
9 import org
.eclipse
.swt
.events
.FocusEvent
;
10 import org
.eclipse
.swt
.events
.KeyAdapter
;
11 import org
.eclipse
.swt
.events
.KeyEvent
;
12 import org
.eclipse
.swt
.events
.MouseAdapter
;
13 import org
.eclipse
.swt
.events
.MouseEvent
;
14 // RAP [rh] Paint events missing
15 //import org.eclipse.swt.events.PaintEvent;
16 //import org.eclipse.swt.events.PaintListener;
17 import org
.eclipse
.swt
.graphics
.Color
;
18 import org
.eclipse
.swt
.graphics
.Font
;
20 //import org.eclipse.swt.graphics.GC;
21 import org
.eclipse
.swt
.graphics
.Point
;
22 //import org.eclipse.swt.graphics.RGB;
23 //import org.eclipse.swt.graphics.Rectangle;
24 import org
.eclipse
.swt
.widgets
.Button
;
25 import org
.eclipse
.swt
.widgets
.Composite
;
26 import org
.eclipse
.swt
.widgets
.Control
;
27 import org
.eclipse
.swt
.widgets
.Display
;
28 //import org.eclipse.swt.widgets.Event;
29 import org
.eclipse
.swt
.widgets
.Label
;
30 //import org.eclipse.swt.widgets.Listener;
31 import org
.eclipse
.swt
.widgets
.Table
;
32 import org
.eclipse
.swt
.widgets
.Text
;
33 import org
.eclipse
.swt
.widgets
.Tree
;
34 import org
.eclipse
.swt
.widgets
.Widget
;
35 //import org.eclipse.ui.forms.FormColors;
36 //import org.eclipse.ui.forms.HyperlinkGroup;
37 //import org.eclipse.ui.forms.IFormColors;
38 //import org.eclipse.ui.internal.forms.widgets.FormFonts;
39 //import org.eclipse.ui.internal.forms.widgets.FormUtil;
42 * The toolkit is responsible for creating SWT controls adapted to work in
43 * Eclipse forms. In addition to changing their presentation properties (fonts,
44 * colors etc.), various listeners are attached to make them behave correctly in
47 * In addition to being the control factory, the toolkit is also responsible for
48 * painting flat borders for select controls, managing hyperlink groups and
51 * The toolkit creates some of the most common controls used to populate Eclipse
52 * forms. Controls that must be created using their constructors,
53 * <code>adapt()</code> method is available to change its properties in the
54 * same way as with the supported toolkit controls.
56 * Typically, one toolkit object is created per workbench part (for example, an
57 * editor or a form wizard). The toolkit is disposed when the part is disposed.
58 * To conserve resources, it is possible to create one color object for the
59 * entire plug-in and share it between several toolkits. The plug-in is
60 * responsible for disposing the colors (disposing the toolkit that uses shared
61 * color object will not dispose the colors).
63 * FormToolkit is normally instantiated, but can also be subclassed if some of
64 * the methods needs to be modified. In those cases, <code>super</code> must
65 * be called to preserve normal behaviour.
69 public class FormToolkit
{
70 public static final String KEY_DRAW_BORDER
= "FormWidgetFactory.drawBorder"; //$NON-NLS-1$
72 public static final String TREE_BORDER
= "treeBorder"; //$NON-NLS-1$
74 public static final String TEXT_BORDER
= "textBorder"; //$NON-NLS-1$
76 private int borderStyle
= SWT
.NULL
;
78 private FormColors colors
;
80 private int orientation
= Window
.getDefaultOrientation();
82 // private KeyListener deleteListener;
83 // RAP [rh] Paint events missing
84 // private BorderPainter borderPainter;
86 private BoldFontHolder boldFontHolder
;
88 // private HyperlinkGroup hyperlinkGroup;
90 private boolean isDisposed
= false;
93 VisibilityHandler visibilityHandler
;
96 KeyboardHandler keyboardHandler
;
98 // RAP [rh] Paint events missing
99 // private class BorderPainter implements PaintListener {
100 // public void paintControl(PaintEvent event) {
101 // Composite composite = (Composite) event.widget;
102 // Control[] children = composite.getChildren();
103 // for (int i = 0; i < children.length; i++) {
104 // Control c = children[i];
105 // boolean inactiveBorder = false;
106 // boolean textBorder = false;
107 // if (!c.isVisible())
110 // * if (c.getEnabled() == false && !(c instanceof CCombo))
113 // if (c instanceof Hyperlink)
115 // Object flag = c.getData(KEY_DRAW_BORDER);
116 // if (flag != null) {
117 // if (flag.equals(Boolean.FALSE))
119 // if (flag.equals(TREE_BORDER))
120 // inactiveBorder = true;
121 // else if (flag.equals(TEXT_BORDER))
122 // textBorder = true;
124 // if (getBorderStyle() == SWT.BORDER) {
125 // if (!inactiveBorder && !textBorder) {
128 // if (c instanceof Text || c instanceof Table
129 // || c instanceof Tree)
132 // if (!inactiveBorder
133 // && (c instanceof Text || c instanceof CCombo || textBorder)) {
134 // Rectangle b = c.getBounds();
136 // gc.setForeground(c.getBackground());
137 // gc.drawRectangle(b.x - 1, b.y - 1, b.width + 1,
139 // // gc.setForeground(getBorderStyle() == SWT.BORDER ? colors
140 // // .getBorderColor() : colors.getForeground());
141 // gc.setForeground(colors.getBorderColor());
142 // if (c instanceof CCombo)
143 // gc.drawRectangle(b.x - 1, b.y - 1, b.width + 1,
146 // gc.drawRectangle(b.x - 1, b.y - 2, b.width + 1,
148 // } else if (inactiveBorder || c instanceof Table
149 // || c instanceof Tree) {
150 // Rectangle b = c.getBounds();
152 // gc.setForeground(colors.getBorderColor());
153 // gc.drawRectangle(b.x - 1, b.y - 1, b.width + 1,
160 private static class VisibilityHandler
extends FocusAdapter
{
161 public void focusGained(FocusEvent e
) {
163 if (w
instanceof Control
) {
164 FormUtil
.ensureVisible((Control
) w
);
169 private static class KeyboardHandler
extends KeyAdapter
{
170 public void keyPressed(KeyEvent e
) {
172 if (w
instanceof Control
) {
174 FormUtil
.processKey(e
.keyCode
, (Control
) w
);
179 private class BoldFontHolder
{
180 private Font normalFont
;
182 private Font boldFont
;
184 public BoldFontHolder() {
187 public Font
getBoldFont(Font font
) {
188 createBoldFont(font
);
192 private void createBoldFont(Font font
) {
193 if (normalFont
== null || !normalFont
.equals(font
)) {
197 if (boldFont
== null) {
198 boldFont
= FormFonts
.getInstance().getBoldFont(colors
.getDisplay(),
203 public void dispose() {
204 if (boldFont
!= null) {
205 FormFonts
.getInstance().markFinished(boldFont
);
212 * Creates a toolkit that is self-sufficient (will manage its own colors).
214 * Clients that call this method must call {@link #dispose()} when they
215 * are finished using the toolkit.
218 public FormToolkit(Display display
) {
219 this(new FormColors(display
));
223 * Creates a toolkit that will use the provided (shared) colors. The toolkit
224 * will dispose the colors if and only if they are <b>not</b> marked as
225 * shared via the <code>markShared()</code> method.
227 * Clients that call this method must call {@link #dispose()} when they
228 * are finished using the toolkit.
233 public FormToolkit(FormColors colors
) {
234 this.colors
= colors
;
239 * Creates a button as a part of the form.
244 * an optional text for the button (can be <code>null</code>)
246 * the button style (for example, <code>SWT.PUSH</code>)
247 * @return the button widget
249 public Button
createButton(Composite parent
, String text
, int style
) {
250 Button button
= new Button(parent
, style
| SWT
.FLAT
| orientation
);
252 button
.setText(text
);
253 adapt(button
, true, true);
258 * Creates the composite as a part of the form.
261 * the composite parent
262 * @return the composite widget
264 public Composite
createComposite(Composite parent
) {
265 return createComposite(parent
, SWT
.NULL
);
269 * Creates the composite as part of the form using the provided style.
272 * the composite parent
274 * the composite style
275 * @return the composite widget
277 public Composite
createComposite(Composite parent
, int style
) {
278 // Composite composite = new LayoutComposite(parent, style | orientation);
279 Composite composite
= new Composite(parent
, style
| orientation
);
285 * Creats the composite that can server as a separator between various parts
286 * of a form. Separator height should be controlled by setting the height
287 * hint on the layout data for the composite.
290 * the separator parent
291 * @return the separator widget
293 // RAP [rh] createCompositeSeparator: currently no useful implementation possible, delete?
294 public Composite
createCompositeSeparator(Composite parent
) {
295 final Composite composite
= new Composite(parent
, orientation
);
296 // RAP [rh] GC and paint events missing
297 // composite.addListener(SWT.Paint, new Listener() {
298 // public void handleEvent(Event e) {
299 // if (composite.isDisposed())
301 // Rectangle bounds = composite.getBounds();
303 // gc.setForeground(colors.getColor(IFormColors.SEPARATOR));
304 // if (colors.getBackground() != null)
305 // gc.setBackground(colors.getBackground());
306 // gc.fillGradientRectangle(0, 0, bounds.width, bounds.height,
310 // if (parent instanceof Section)
311 // ((Section) parent).setSeparatorControl(composite);
316 * Creates a label as a part of the form.
322 * @return the label widget
324 public Label
createLabel(Composite parent
, String text
) {
325 return createLabel(parent
, text
, SWT
.NONE
);
329 * Creates a label as a part of the form.
337 * @return the label widget
339 public Label
createLabel(Composite parent
, String text
, int style
) {
340 Label label
= new Label(parent
, style
| orientation
);
343 adapt(label
, false, false);
348 * Creates a hyperlink as a part of the form. The hyperlink will be added to
349 * the hyperlink group that belongs to this toolkit.
352 * the hyperlink parent
354 * the text of the hyperlink
356 * the hyperlink style
357 * @return the hyperlink widget
359 // public Hyperlink createHyperlink(Composite parent, String text, int style) {
360 // Hyperlink hyperlink = new Hyperlink(parent, style | orientation);
362 // hyperlink.setText(text);
363 // hyperlink.addFocusListener(visibilityHandler);
364 // hyperlink.addKeyListener(keyboardHandler);
365 // hyperlinkGroup.add(hyperlink);
370 * Creates an image hyperlink as a part of the form. The hyperlink will be
371 * added to the hyperlink group that belongs to this toolkit.
374 * the hyperlink parent
376 * the hyperlink style
377 * @return the image hyperlink widget
379 // public ImageHyperlink createImageHyperlink(Composite parent, int style) {
380 // ImageHyperlink hyperlink = new ImageHyperlink(parent, style
382 // hyperlink.addFocusListener(visibilityHandler);
383 // hyperlink.addKeyListener(keyboardHandler);
384 // hyperlinkGroup.add(hyperlink);
389 * Creates a rich text as a part of the form.
392 * the rich text parent
394 * if <code>true</code>, the toolkit will monitor focus
395 * transfers to ensure that the hyperlink in focus is visible in
397 * @return the rich text widget
400 // public FormText createFormText(Composite parent, boolean trackFocus) {
401 // FormText engine = new FormText(parent, SWT.WRAP | orientation);
402 // engine.marginWidth = 1;
403 // engine.marginHeight = 0;
404 // engine.setHyperlinkSettings(getHyperlinkGroup());
405 // adapt(engine, trackFocus, true);
406 // engine.setMenu(parent.getMenu());
411 * Adapts a control to be used in a form that is associated with this
412 * toolkit. This involves adjusting colors and optionally adding handlers to
413 * ensure focus tracking and keyboard management.
418 * if <code>true</code>, form will be scrolled horizontally
419 * and/or vertically if needed to ensure that the control is
420 * visible when it gains focus. Set it to <code>false</code> if
421 * the control is not capable of gaining focus.
422 * @param trackKeyboard
423 * if <code>true</code>, the control that is capable of
424 * gaining focus will be tracked for certain keys that are
425 * important to the underlying form (for example, PageUp,
426 * PageDown, ScrollUp, ScrollDown etc.). Set it to
427 * <code>false</code> if the control is not capable of gaining
428 * focus or these particular key event are already used by the
431 public void adapt(Control control
, boolean trackFocus
, boolean trackKeyboard
) {
432 control
.setBackground(colors
.getBackground());
433 control
.setForeground(colors
.getForeground());
434 // if (control instanceof ExpandableComposite) {
435 // ExpandableComposite ec = (ExpandableComposite) control;
436 // if (ec.toggle != null) {
438 // ec.toggle.addFocusListener(visibilityHandler);
439 // if (trackKeyboard)
440 // ec.toggle.addKeyListener(keyboardHandler);
442 // if (ec.textLabel != null) {
444 // ec.textLabel.addFocusListener(visibilityHandler);
445 // if (trackKeyboard)
446 // ec.textLabel.addKeyListener(keyboardHandler);
451 control
.addFocusListener(visibilityHandler
);
453 control
.addKeyListener(keyboardHandler
);
457 * Adapts a composite to be used in a form associated with this toolkit.
460 * the composite to adapt
462 public void adapt(Composite composite
) {
463 composite
.setBackground(colors
.getBackground());
464 composite
.addMouseListener(new MouseAdapter() {
465 public void mouseDown(MouseEvent e
) {
466 ((Control
) e
.widget
).setFocus();
469 if (composite
.getParent() != null)
470 composite
.setMenu(composite
.getParent().getMenu());
474 * A helper method that ensures the provided control is visible when
475 * ScrolledComposite is somewhere in the parent chain. If scroll bars are
476 * visible and the control is clipped, the client of the scrolled composite
477 * will be scrolled to reveal the control.
480 * the control to reveal
482 public static void ensureVisible(Control c
) {
483 FormUtil
.ensureVisible(c
);
487 * Creates a section as a part of the form.
491 * @param sectionStyle
493 * @return the section widget
495 // public Section createSection(Composite parent, int sectionStyle) {
496 // Section section = new Section(parent, orientation, sectionStyle);
497 // section.setMenu(parent.getMenu());
498 // adapt(section, true, true);
499 // if (section.toggle != null) {
500 // section.toggle.setHoverDecorationColor(colors
501 // .getColor(IFormColors.TB_TOGGLE_HOVER));
502 // section.toggle.setDecorationColor(colors
503 // .getColor(IFormColors.TB_TOGGLE));
505 // section.setFont(boldFontHolder.getBoldFont(parent.getFont()));
506 // if ((sectionStyle & Section.TITLE_BAR) != 0
507 // || (sectionStyle & Section.SHORT_TITLE_BAR) != 0) {
508 // colors.initializeSectionToolBarColors();
509 // section.setTitleBarBackground(colors.getColor(IFormColors.TB_BG));
510 // section.setTitleBarBorderColor(colors
511 // .getColor(IFormColors.TB_BORDER));
513 // // call setTitleBarForeground regardless as it also sets the label color
514 // section.setTitleBarForeground(colors
515 // .getColor(IFormColors.TB_TOGGLE));
520 * Creates an expandable composite as a part of the form.
523 * the expandable composite parent
524 * @param expansionStyle
525 * the expandable composite style
526 * @return the expandable composite widget
528 // public ExpandableComposite createExpandableComposite(Composite parent,
529 // int expansionStyle) {
530 // ExpandableComposite ec = new ExpandableComposite(parent, orientation,
532 // ec.setMenu(parent.getMenu());
533 // adapt(ec, true, true);
534 // ec.setFont(boldFontHolder.getBoldFont(ec.getFont()));
539 * Creates a separator label as a part of the form.
542 * the separator parent
544 * the separator style
545 * @return the separator label
547 public Label
createSeparator(Composite parent
, int style
) {
548 Label label
= new Label(parent
, SWT
.SEPARATOR
| style
| orientation
);
549 label
.setBackground(colors
.getBackground());
550 label
.setForeground(colors
.getBorderColor());
555 * Creates a table as a part of the form.
561 * @return the table widget
563 public Table
createTable(Composite parent
, int style
) {
564 Table table
= new Table(parent
, style
| borderStyle
| orientation
);
565 adapt(table
, false, false);
566 // hookDeleteListener(table);
571 * Creates a text as a part of the form.
576 * the text initial value
577 * @return the text widget
579 public Text
createText(Composite parent
, String value
) {
580 return createText(parent
, value
, SWT
.SINGLE
);
584 * Creates a text as a part of the form.
589 * the text initial value
592 * @return the text widget
594 public Text
createText(Composite parent
, String value
, int style
) {
595 Text text
= new Text(parent
, borderStyle
| style
| orientation
);
598 text
.setForeground(colors
.getForeground());
599 text
.setBackground(colors
.getBackground());
600 text
.addFocusListener(visibilityHandler
);
605 * Creates a tree widget as a part of the form.
611 * @return the tree widget
613 public Tree
createTree(Composite parent
, int style
) {
614 Tree tree
= new Tree(parent
, borderStyle
| style
| orientation
);
615 adapt(tree
, false, false);
616 // hookDeleteListener(tree);
621 * Creates a scrolled form widget in the provided parent. If you do not
622 * require scrolling because there is already a scrolled composite up the
623 * parent chain, use 'createForm' instead.
626 * the scrolled form parent
627 * @return the form that can scroll itself
630 public ScrolledComposite
createScrolledForm(Composite parent
) {
631 ScrolledComposite form
= new ScrolledComposite(parent
, SWT
.V_SCROLL
632 | SWT
.H_SCROLL
| orientation
);
633 form
.setExpandHorizontal(true);
634 form
.setExpandVertical(true);
635 form
.setBackground(colors
.getBackground());
636 form
.setForeground(colors
.getColor(IFormColors
.TITLE
));
637 form
.setFont(JFaceResources
.getHeaderFont());
642 * Creates a form widget in the provided parent. Note that this widget does
643 * not scroll its content, so make sure there is a scrolled composite up the
644 * parent chain. If you require scrolling, use 'createScrolledForm' instead.
648 * @return the form that does not scroll
649 * @see #createScrolledForm
651 // public Form createForm(Composite parent) {
652 // Form formContent = new Form(parent, orientation);
653 // formContent.setBackground(colors.getBackground());
654 // formContent.setForeground(colors.getColor(IFormColors.TITLE));
655 // formContent.setFont(JFaceResources.getHeaderFont());
656 // return formContent;
660 * Takes advantage of the gradients and other capabilities to decorate the
661 * form heading using colors computed based on the current skin and
665 * the form to decorate
668 // public void decorateFormHeading(Form form) {
669 // Color top = colors.getColor(IFormColors.H_GRADIENT_END);
670 // Color bot = colors.getColor(IFormColors.H_GRADIENT_START);
671 // form.setTextBackground(new Color[] { top, bot }, new int[] { 100 },
673 // form.setHeadColor(IFormColors.H_BOTTOM_KEYLINE1, colors
674 // .getColor(IFormColors.H_BOTTOM_KEYLINE1));
675 // form.setHeadColor(IFormColors.H_BOTTOM_KEYLINE2, colors
676 // .getColor(IFormColors.H_BOTTOM_KEYLINE2));
677 // form.setHeadColor(IFormColors.H_HOVER_LIGHT, colors
678 // .getColor(IFormColors.H_HOVER_LIGHT));
679 // form.setHeadColor(IFormColors.H_HOVER_FULL, colors
680 // .getColor(IFormColors.H_HOVER_FULL));
681 // form.setHeadColor(IFormColors.TB_TOGGLE, colors
682 // .getColor(IFormColors.TB_TOGGLE));
683 // form.setHeadColor(IFormColors.TB_TOGGLE_HOVER, colors
684 // .getColor(IFormColors.TB_TOGGLE_HOVER));
685 // form.setSeparatorVisible(true);
689 * Creates a scrolled page book widget as a part of the form.
692 * the page book parent
695 * @return the scrolled page book widget
697 // public ScrolledPageBook createPageBook(Composite parent, int style) {
698 // ScrolledPageBook book = new ScrolledPageBook(parent, style
700 // adapt(book, true, true);
701 // book.setMenu(parent.getMenu());
706 * Disposes the toolkit.
708 public void dispose() {
713 if (colors
.isShared() == false) {
717 boldFontHolder
.dispose();
721 * Returns the hyperlink group that manages hyperlinks for this toolkit.
723 * @return the hyperlink group
725 // public HyperlinkGroup getHyperlinkGroup() {
726 // return hyperlinkGroup;
730 * Sets the background color for the entire toolkit. The method delegates
731 * the call to the FormColors object and also updates the hyperlink group so
732 * that hyperlinks and other objects are in sync.
735 * the new background color
737 public void setBackground(Color bg
) {
738 // hyperlinkGroup.setBackground(bg);
739 colors
.setBackground(bg
);
743 * Refreshes the hyperlink colors by loading from JFace settings.
745 // public void refreshHyperlinkColors() {
746 // hyperlinkGroup.initializeDefaultForegrounds(colors.getDisplay());
749 // RAP [rh] paintBordersFor not useful as no GC to actually paint borders
751 // * Paints flat borders for widgets created by this toolkit within the
752 // * provided parent. Borders will not be painted if the global border style
753 // * is SWT.BORDER (i.e. if native borders are used). Call this method during
754 // * creation of a form composite to get the borders of its children painted.
755 // * Care should be taken when selection layout margins. At least one pixel
756 // * pargin width and height must be chosen to allow the toolkit to paint the
757 // * border on the parent around the widgets.
759 // * Borders are painted for some controls that are selected by the toolkit by
760 // * default. If a control needs a border but is not on its list, it is
761 // * possible to force border in the following way:
767 // * widget.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
771 // * widget.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
778 // * the parent that owns the children for which the border needs
781 // public void paintBordersFor(Composite parent) {
782 // // if (borderStyle == SWT.BORDER)
784 // if (borderPainter == null)
785 // borderPainter = new BorderPainter();
786 // parent.addPaintListener(borderPainter);
790 * Returns the colors used by this toolkit.
792 * @return the color object
794 public FormColors
getColors() {
799 * Returns the border style used for various widgets created by this
800 * toolkit. The intent of the toolkit is to create controls with styles that
801 * yield a 'flat' appearance. On systems where the native borders are
802 * already flat, we set the style to SWT.BORDER and don't paint the borders
803 * ourselves. Otherwise, the style is set to SWT.NULL, and borders are
804 * painted by the toolkit.
806 * @return the global border style
808 public int getBorderStyle() {
813 * Returns the margin required around the children whose border is being
814 * painted by the toolkit using {@link #paintBordersFor(Composite)}. Since
815 * the border is painted around the controls on the parent, a number of
816 * pixels needs to be reserved for this border. For windowing systems where
817 * the native border is used, this margin is 0.
819 * @return the margin in the parent when children have their border painted
821 public int getBorderMargin() {
822 return getBorderStyle() == SWT
.BORDER ?
0 : 2;
826 * Sets the border style to be used when creating widgets. The toolkit
827 * chooses the correct style based on the platform but this value can be
828 * changed using this method.
831 * <code>SWT.BORDER</code> or <code>SWT.NULL</code>
832 * @see #getBorderStyle
834 public void setBorderStyle(int style
) {
835 this.borderStyle
= style
;
839 * A utility method that ensures that the control is visible in the scrolled
840 * composite. The prerequisite for this method is that the control has a
841 * class that extends ScrolledComposite somewhere in the parent chain. If
842 * the control is partially or fully clipped, the composite is scrolled to
843 * set by setting the origin to the control origin.
846 * the control to make visible
847 * @param verticalOnly
848 * if <code>true</code>, the scrolled composite will be
849 * scrolled only vertically if needed. Otherwise, the scrolled
850 * composite origin will be set to the control origin.
852 public static void setControlVisible(Control c
, boolean verticalOnly
) {
853 ScrolledComposite scomp
= FormUtil
.getScrolledComposite(c
);
856 Point location
= FormUtil
.getControlLocation(scomp
, c
);
857 scomp
.setOrigin(location
);
860 private void initialize() {
861 initializeBorderStyle();
862 // hyperlinkGroup = new HyperlinkGroup(colors.getDisplay());
863 // hyperlinkGroup.setBackground(colors.getBackground());
864 visibilityHandler
= new VisibilityHandler();
865 keyboardHandler
= new KeyboardHandler();
866 boldFontHolder
= new BoldFontHolder();
869 // RAP [rh] revise detection of border style: can't ask OS here
870 private void initializeBorderStyle() {
871 // String osname = System.getProperty("os.name"); //$NON-NLS-1$
872 // String osversion = System.getProperty("os.version"); //$NON-NLS-1$
873 // if (osname.startsWith("Windows") && "5.1".compareTo(osversion) <= 0) { //$NON-NLS-1$ //$NON-NLS-2$
874 // // Skinned widgets used on newer Windows (e.g. XP (5.1), Vista
876 // // Check for Windows Classic. If not used, set the style to BORDER
877 // RGB rgb = colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
878 // if (rgb.red != 212 || rgb.green != 208 || rgb.blue != 200)
879 // borderStyle = SWT.BORDER;
880 // } else if (osname.startsWith("Mac")) //$NON-NLS-1$
881 // borderStyle = SWT.BORDER;
883 borderStyle
= SWT
.BORDER
;
887 * Returns the orientation that all the widgets created by this toolkit will
888 * inherit, if set. Can be <code>SWT.NULL</code>,
889 * <code>SWT.LEFT_TO_RIGHT</code> and <code>SWT.RIGHT_TO_LEFT</code>.
891 * @return orientation style for this toolkit, or <code>SWT.NULL</code> if
892 * not set. The default orientation is inherited from the Window
893 * default orientation.
894 * @see org.eclipse.jface.window.Window#getDefaultOrientation()
897 public int getOrientation() {
902 * Sets the orientation that all the widgets created by this toolkit will
903 * inherit. Can be <code>SWT.NULL</code>, <code>SWT.LEFT_TO_RIGHT</code>
904 * and <code>SWT.RIGHT_TO_LEFT</code>.
907 * style for this toolkit.
910 public void setOrientation(int orientation
) {
911 this.orientation
= orientation
;