01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.texteditor;
11:
12: import org.eclipse.swt.graphics.Region;
13: import org.eclipse.swt.layout.GridData;
14: import org.eclipse.swt.layout.GridLayout;
15: import org.eclipse.swt.widgets.Layout;
16:
17: /**
18: *
19: *
20: * @since 3.0
21: */
22: public class LinearLayouter {
23:
24: private static final int ANNOTATION_SIZE = 14;
25: private static final int BORDER_WIDTH = 2;
26:
27: public Layout getLayout(int itemCount) {
28: // simple layout: a row of items
29: GridLayout layout = new GridLayout(itemCount, true);
30: layout.horizontalSpacing = 1;
31: layout.verticalSpacing = 0;
32: layout.marginHeight = 1;
33: layout.marginWidth = 1;
34: return layout;
35: }
36:
37: public Object getLayoutData() {
38: GridData gridData = new GridData(ANNOTATION_SIZE + 2
39: * BORDER_WIDTH, ANNOTATION_SIZE + 2 * BORDER_WIDTH);
40: gridData.horizontalAlignment = GridData.CENTER;
41: gridData.verticalAlignment = GridData.CENTER;
42: return gridData;
43: }
44:
45: public int getAnnotationSize() {
46: return ANNOTATION_SIZE;
47: }
48:
49: public int getBorderWidth() {
50: return BORDER_WIDTH;
51: }
52:
53: public Region getShellRegion(int itemCount) {
54: // no special region - set to null for default shell size
55: return null;
56: }
57:
58: }
|