summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Decorations.java
blob: 48c6c630280b8c9cfe2235c3e450d84c65669af2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package org.eclipse.swt.widgets;

/*
 * Copyright (c) 2000, 2002 IBM Corp.  All rights reserved.
 * This file is made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 */

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;


public class Decorations extends Canvas {
	Image image;
	Control savedFocus;
	Button defaultButton, saveDefault;
	
Decorations () {
	/* Do nothing */
}

public Decorations (Composite parent, int style) {
	super (parent, checkStyle (style));
}

static int checkStyle (int style) {
	if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
		style |= SWT.TITLE;
	}
	return style;
}

protected void checkSubclass () {
	if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}

Control computeTabGroup () {
	return this;
}

Control computeTabRoot () {
	return this;
}

void createHandle (int index) {
	state |= HANDLE | CANVAS;
}

public Button getDefaultButton () {
	checkWidget();
	return defaultButton;
}

public Image getImage () {
	checkWidget();
	return image;
}

public boolean getMaximized () {
	checkWidget();
	return false;
}

public boolean getMinimized () {
	checkWidget();
	return false;
}

String getNameText () {
	return getText ();
}

public String getText () {
	checkWidget();
	return "";
}
boolean isTabGroup () {
	return true;
}
boolean isTabItem () {
	return false;
}

void releaseWidget () {
	super.releaseWidget ();
	defaultButton = saveDefault = null;
}

boolean restoreFocus () {
	if (savedFocus != null && savedFocus.isDisposed ()) savedFocus = null;
	if (savedFocus == null) return false;
	return savedFocus.forceFocus ();
}

void saveFocus () {
	Control control = getDisplay ().getFocusControl ();
	if (control != null) setSavedFocus (control);
}

public void setDefaultButton (Button button) {
	checkWidget();
	setDefaultButton (button, true);
}

void setDefaultButton (Button button, boolean save) {
}

public void setImage (Image image) {
	checkWidget();
	if (image != null) {
		if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
	}
	this.image = image;
}

public void setMaximized (boolean maximized) {
	checkWidget();
}

public void setMinimized (boolean minimized) {
	checkWidget();
}

void setSavedFocus (Control control) {
	if (this == control) return;
	savedFocus = control;
}

public void setText (String string) {
	checkWidget();
	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
}

public void setVisible (boolean visible) {
	super.setVisible (visible);
}
}