01: /*******************************************************************************
02: * Copyright (c) 2004, 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: * Stefan Xenos, IBM; Chris Torrence, ITT Visual Information Solutions - bug 51580
11: *******************************************************************************/package org.eclipse.ui.internal.presentations.util;
12:
13: import org.eclipse.swt.graphics.Point;
14: import org.eclipse.ui.presentations.IStackPresentationSite;
15:
16: /**
17: * @since 3.1
18: */
19: public class TabFolderEvent {
20: public static final int EVENT_PANE_MENU = 1;
21: public static final int EVENT_HIDE_TOOLBAR = 2;
22: public static final int EVENT_SHOW_TOOLBAR = 3;
23: public static final int EVENT_RESTORE = 4;
24: public static final int EVENT_MINIMIZE = 5;
25: public static final int EVENT_CLOSE = 6;
26: public static final int EVENT_MAXIMIZE = 7;
27: public static final int EVENT_TAB_SELECTED = 8;
28: public static final int EVENT_GIVE_FOCUS_TO_PART = 9;
29: public static final int EVENT_DRAG_START = 10;
30: public static final int EVENT_SHOW_LIST = 11;
31: public static final int EVENT_SYSTEM_MENU = 12;
32: public static final int EVENT_PREFERRED_SIZE = 13;
33:
34: public static int eventIdToStackState(int eventId) {
35: switch (eventId) {
36: case EVENT_RESTORE:
37: return IStackPresentationSite.STATE_RESTORED;
38: case EVENT_MINIMIZE:
39: return IStackPresentationSite.STATE_MINIMIZED;
40: case EVENT_MAXIMIZE:
41: return IStackPresentationSite.STATE_MAXIMIZED;
42: }
43:
44: return 0;
45: }
46:
47: public static int stackStateToEventId(int stackState) {
48: switch (stackState) {
49: case IStackPresentationSite.STATE_RESTORED:
50: return EVENT_RESTORE;
51: case IStackPresentationSite.STATE_MINIMIZED:
52: return EVENT_MINIMIZE;
53: case IStackPresentationSite.STATE_MAXIMIZED:
54: return EVENT_MAXIMIZE;
55: }
56:
57: return 0;
58: }
59:
60: public AbstractTabItem tab;
61: public int type;
62: public int x;
63: public int y;
64:
65: public TabFolderEvent(int type) {
66: this .type = type;
67: }
68:
69: public TabFolderEvent(int type, AbstractTabItem w, int x, int y) {
70: this .type = type;
71: this .tab = w;
72: this .x = x;
73: this .y = y;
74: }
75:
76: public TabFolderEvent(int type, AbstractTabItem w, Point pos) {
77: this.type = type;
78: this.tab = w;
79: this.x = pos.x;
80: this.y = pos.y;
81: }
82: }
|