Mercurial > projects > dwt-addons
comparison dwtx/draw2d/SubordinateUpdateManager.d @ 98:95307ad235d9
Added Draw2d code, still work in progress
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 00:52:14 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
96:b492ba44e44d | 98:95307ad235d9 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.draw2d.SubordinateUpdateManager; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 import dwtx.draw2d.geometry.Rectangle; | |
18 import dwtx.draw2d.UpdateManager; | |
19 import dwtx.draw2d.IFigure; | |
20 import dwtx.draw2d.GraphicsSource; | |
21 | |
22 /** | |
23 * @deprecated this class is not used | |
24 */ | |
25 public abstract class SubordinateUpdateManager | |
26 : UpdateManager | |
27 { | |
28 | |
29 /** | |
30 * A root figure. | |
31 */ | |
32 protected IFigure root; | |
33 | |
34 /** | |
35 * A graphics source | |
36 */ | |
37 protected GraphicsSource graphicsSource; | |
38 | |
39 /** | |
40 * @see UpdateManager#addDirtyRegion(IFigure, int, int, int, int) | |
41 */ | |
42 public void addDirtyRegion(IFigure f, int x, int y, int w, int h) { | |
43 if (getSuperior() is null) | |
44 return; | |
45 getSuperior().addDirtyRegion(f, x, y, w, h); | |
46 } | |
47 | |
48 /** | |
49 * @see UpdateManager#addInvalidFigure(IFigure) | |
50 */ | |
51 public void addInvalidFigure(IFigure f) { | |
52 UpdateManager um = getSuperior(); | |
53 if (um is null) | |
54 return; | |
55 um.addInvalidFigure(f); | |
56 } | |
57 | |
58 /** | |
59 * Returns the host figure. | |
60 * @return the host figure | |
61 */ | |
62 protected abstract IFigure getHost(); | |
63 | |
64 /** | |
65 * Returns the superior update manager. | |
66 * @return the superior | |
67 */ | |
68 protected UpdateManager getSuperior() { | |
69 if (getHost().getParent() is null) | |
70 return null; | |
71 return getHost().getParent().getUpdateManager(); | |
72 } | |
73 | |
74 /** | |
75 * @see UpdateManager#performUpdate() | |
76 */ | |
77 public void performUpdate() { | |
78 UpdateManager um = getSuperior(); | |
79 if (um is null) | |
80 return; | |
81 um.performUpdate(); | |
82 } | |
83 | |
84 /** | |
85 * @see UpdateManager#performUpdate(Rectangle) | |
86 */ | |
87 public void performUpdate(Rectangle rect) { | |
88 UpdateManager um = getSuperior(); | |
89 if (um is null) | |
90 return; | |
91 um.performUpdate(rect); | |
92 } | |
93 | |
94 /** | |
95 * @see UpdateManager#setRoot(IFigure) | |
96 */ | |
97 public void setRoot(IFigure f) { | |
98 root = f; | |
99 } | |
100 | |
101 /** | |
102 * @see UpdateManager#setGraphicsSource(GraphicsSource) | |
103 */ | |
104 public void setGraphicsSource(GraphicsSource gs) { | |
105 graphicsSource = gs; | |
106 } | |
107 } |