comparison dwt/internal/theme/DrawData.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 1a8b3cb347e0
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 module dwt.internal.theme;
12
13 import dwt.graphics.*;
14
15 public class DrawData {
16 public int style;
17 public int[] state;
18 public Rectangle clientArea;
19
20 /** Part states */
21 public static final int SELECTED = 1 << 1;
22 public static final int FOCUSED = 1 << 2;
23 public static final int PRESSED = 1 << 3;
24 public static final int ACTIVE = 1 << 4;
25 public static final int DISABLED = 1 << 5;
26 public static final int HOT = 1 << 6;
27 public static final int DEFAULTED = 1 << 7;
28 public static final int GRAYED = 1 << 8;
29
30 /** Text and Image drawing flags */
31 public static final int DRAW_LEFT = 1 << 4;
32 public static final int DRAW_TOP = 1 << 5;
33 public static final int DRAW_RIGHT = 1 << 6;
34 public static final int DRAW_BOTTOM = 1 << 7;
35 public static final int DRAW_HCENTER = 1 << 8;
36 public static final int DRAW_VCENTER = 1 << 9;
37
38 /** Widget parts */
39 public static final int WIDGET_NOWHERE = -1;
40 public static final int WIDGET_WHOLE = 0;
41
42 /** Scrollbar parts */
43 public static final int SCROLLBAR_UP_ARROW = 1;
44 public static final int SCROLLBAR_DOWN_ARROW = 2;
45 public static final int SCROLLBAR_LEFT_ARROW = SCROLLBAR_UP_ARROW;
46 public static final int SCROLLBAR_RIGHT_ARROW = SCROLLBAR_DOWN_ARROW;
47 public static final int SCROLLBAR_UP_TRACK = 3;
48 public static final int SCROLLBAR_DOWN_TRACK = 4;
49 public static final int SCROLLBAR_LEFT_TRACK = SCROLLBAR_UP_TRACK;
50 public static final int SCROLLBAR_RIGHT_TRACK = SCROLLBAR_DOWN_TRACK;
51 public static final int SCROLLBAR_THUMB = 5;
52
53 /** Scale parts */
54 public static final int SCALE_UP_TRACK = 1;
55 public static final int SCALE_LEFT_TRACK = SCALE_UP_TRACK;
56 public static final int SCALE_DOWN_TRACK = 2;
57 public static final int SCALE_RIGHT_TRACK = SCALE_DOWN_TRACK;
58 public static final int SCALE_THUMB = 3;
59
60 /** ToolItem parts */
61 public static final int TOOLITEM_ARROW = 1;
62
63 /** Combo parts */
64 public static final int COMBO_ARROW = 1;
65
66
67 public DrawData() {
68 state = new int[1];
69 }
70
71 Rectangle computeTrim(Theme theme, GC gc) {
72 return new Rectangle(clientArea.x, clientArea.y, clientArea.width, clientArea.height);
73 }
74
75 void draw(Theme theme, GC gc, Rectangle bounds) {
76 }
77
78 void drawImage(Theme theme, Image image, GC gc, Rectangle bounds) {
79 }
80
81 void drawText(Theme theme, String text, int flags, GC gc, Rectangle bounds) {
82 }
83
84 Rectangle getBounds(int part, Rectangle bounds) {
85 return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
86 }
87
88 int hit(Theme theme, Point position, Rectangle bounds) {
89 return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
90 }
91
92 Rectangle measureText(Theme theme, String text, int flags, GC gc, Rectangle bounds) {
93 return new Rectangle(0, 0, 0, 0);
94 }
95
96 }