Mercurial > projects > dwt-addons
comparison dwtx/draw2d/IFigure.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 | 2d6540440fe6 |
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.IFigure; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 import dwtx.dwtxhelper.Bean; | |
18 import dwtx.dwtxhelper.Collection; | |
19 | |
20 import dwt.graphics.Color; | |
21 import dwt.graphics.Cursor; | |
22 import dwt.graphics.Font; | |
23 import dwtx.draw2d.geometry.Dimension; | |
24 import dwtx.draw2d.geometry.Insets; | |
25 import dwtx.draw2d.geometry.Point; | |
26 import dwtx.draw2d.geometry.Rectangle; | |
27 import dwtx.draw2d.geometry.Translatable; | |
28 | |
29 import dwtx.draw2d.AncestorListener; | |
30 import dwtx.draw2d.CoordinateListener; | |
31 import dwtx.draw2d.FigureListener; | |
32 import dwtx.draw2d.FocusListener; | |
33 import dwtx.draw2d.KeyListener; | |
34 import dwtx.draw2d.KeyEvent; | |
35 import dwtx.draw2d.LayoutListener; | |
36 import dwtx.draw2d.MouseListener; | |
37 import dwtx.draw2d.MouseEvent; | |
38 import dwtx.draw2d.MouseMotionListener; | |
39 import dwtx.draw2d.TreeSearch; | |
40 import dwtx.draw2d.Border; | |
41 import dwtx.draw2d.LayoutManager; | |
42 import dwtx.draw2d.FocusEvent; | |
43 import dwtx.draw2d.UpdateManager; | |
44 import dwtx.draw2d.EventDispatcher; | |
45 import dwtx.draw2d.Graphics; | |
46 | |
47 /** | |
48 * Insets that are all 0. Always returns <code>true<code> for {@link #isEmpty()}. | |
49 */ | |
50 class NoInsets | |
51 : Insets | |
52 { | |
53 this() { | |
54 super(0, 0, 0, 0); | |
55 } | |
56 public bool isEmpty() { | |
57 return true; | |
58 } | |
59 } | |
60 | |
61 static this(){ | |
62 IFigure_MAX_DIMENSION = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); | |
63 IFigure_MIN_DIMENSION = new Dimension(5, 5); | |
64 IFigure_NO_INSETS = new NoInsets(); | |
65 } | |
66 /** | |
67 * The maximum allowable dimension. ({@link Integer#MAX_VALUE},{@link Integer#MAX_VALUE}) | |
68 */ | |
69 static const Dimension IFigure_MAX_DIMENSION; | |
70 | |
71 /** | |
72 * The minimum allowable dimension. (5,5) | |
73 */ | |
74 static const Dimension IFigure_MIN_DIMENSION; | |
75 | |
76 /** | |
77 * Empty Insets. | |
78 */ | |
79 static const Insets IFigure_NO_INSETS; | |
80 | |
81 | |
82 /** | |
83 * A lightweight graphical object. Figures are rendered to a {@link Graphics} object. | |
84 * Figures can be composed to create complex graphics. | |
85 * | |
86 * <P> | |
87 * WARNING: This interface is not intended to be implemented by clients. | |
88 */ | |
89 public interface IFigure { | |
90 | |
91 /** | |
92 * Adds the given IFigure as a child of this IFigure. The same as calling {@link | |
93 * #add(IFigure, Object, int) add(figure, null, -1)}. | |
94 * @param figure The IFigure to add | |
95 */ | |
96 void add(IFigure figure); | |
97 | |
98 /** | |
99 * Adds the given IFigure as a child of this IFigure at the given index. The same as | |
100 * calling {@link #add(IFigure, Object, int) add(figure, null, index)}. | |
101 * @param figure The IFigure to add | |
102 * @param index The index where the IFigure should be added | |
103 */ | |
104 void add(IFigure figure, int index); | |
105 | |
106 /** | |
107 * Adds the given IFigure as a child of this IFigure with the given constraint. The same | |
108 * as calling {@link #add(IFigure, Object, int) add(figure, constraint, -1)}. | |
109 * @param figure The IFigure to add | |
110 * @param constraint The newly added IFigure's constraint | |
111 */ | |
112 void add(IFigure figure, Object constraint); | |
113 | |
114 /** | |
115 * Adds the child with the specified index and constraint. The child's parent is currently | |
116 * not null, it is removed from that parent. If this figure has a LayoutManager, then | |
117 * {@link LayoutManager#setConstraint(IFigure, Object)} shall be called on the layout. | |
118 * @param figure The IFigure to add | |
119 * @param constraint The newly added IFigure's constraint | |
120 * @param index The index where the IFigure should be added | |
121 * @throws IndexOutOfBoundsException if the index is out of range | |
122 * @throws IllegalArgumentException if adding the child creates a cycle | |
123 */ | |
124 void add(IFigure figure, Object constraint, int index); | |
125 | |
126 /** | |
127 * Registers the given listener as an AncestorListener of this figure. | |
128 * @param listener The listener to add | |
129 */ | |
130 void addAncestorListener(AncestorListener listener); | |
131 | |
132 /** | |
133 * Registers the given listener as a CoordinateListener of this figure. | |
134 * @param listener the listener to add | |
135 * @since 3.1 | |
136 */ | |
137 void addCoordinateListener(CoordinateListener listener); | |
138 | |
139 /** | |
140 * Registers the given listener as a FigureListener of this figure. | |
141 * @param listener The listener to add | |
142 */ | |
143 void addFigureListener(FigureListener listener); | |
144 | |
145 /** | |
146 * Registers the given listener as a FocusListener of this figure. | |
147 * @param listener The listener to add | |
148 */ | |
149 void addFocusListener(FocusListener listener); | |
150 | |
151 /** | |
152 * Registers the given listener as a KeyListener of this figure. | |
153 * @param listener The listener to add | |
154 */ | |
155 void addKeyListener(KeyListener listener); | |
156 | |
157 /** | |
158 * Registers the given listener on this figure. | |
159 * @param listener The listener to add | |
160 * @since 3.1 | |
161 */ | |
162 void addLayoutListener(LayoutListener listener); | |
163 | |
164 /** | |
165 * Registers the given listener as a MouseListener of this IFigure. | |
166 * @param listener The listener to add | |
167 */ | |
168 void addMouseListener(MouseListener listener); | |
169 | |
170 /** | |
171 * Registers the given listener as a MouseMotionListener of this IFigure. | |
172 * @param listener The listener to add | |
173 */ | |
174 void addMouseMotionListener(MouseMotionListener listener); | |
175 | |
176 /** | |
177 * Called after this IFigure is added to its parent. | |
178 */ | |
179 void addNotify(); | |
180 | |
181 /** | |
182 * Registers the given listener as a PropertyChangeListener of this IFigure. | |
183 * @param listener The listener to add | |
184 */ | |
185 void addPropertyChangeListener(PropertyChangeListener listener); | |
186 | |
187 /** | |
188 * Registers the given listener as a PropertyChangeListener of this IFigure, interested | |
189 * only in the given property. | |
190 * @param property The property the listener is interested in | |
191 * @param listener The listener to add | |
192 */ | |
193 void addPropertyChangeListener(String property, PropertyChangeListener listener); | |
194 | |
195 /** | |
196 * Returns <code>true</code> if the point <code>(x, y)</code> is contained within this | |
197 * IFigure's bounds. | |
198 * @param x The X coordinate | |
199 * @param y The Y coordinate | |
200 * @return <code>true</code> if the point (x,y) is contained in this IFigure's bounds | |
201 */ | |
202 bool containsPoint(int x, int y); | |
203 | |
204 /** | |
205 * Returns <code>true</code> if the Point p is contained within this IFigure's bounds. | |
206 * @param p The point | |
207 * @return <code>true</code> if the Point p is contained within this IFigure's bounds | |
208 */ | |
209 bool containsPoint(Point p); | |
210 | |
211 /** | |
212 * Erases this IFigure. | |
213 */ | |
214 void erase(); | |
215 | |
216 /** | |
217 * Returns the IFigure at the specified location. May return <code>this</code> or | |
218 * <code>null</code>. | |
219 * @param x The X coordinate | |
220 * @param y The Y coordinate | |
221 * @return The IFigure at the specified location | |
222 */ | |
223 IFigure findFigureAt(int x, int y); | |
224 | |
225 /** | |
226 * Returns the IFigure at the specified location based on the conditional TreeSearch. May | |
227 * return <code>this</code> or <code>null</code> | |
228 * @param x the X coordinate | |
229 * @param y the Y coordinate | |
230 * @param search the conditional TreeSearch | |
231 * @return the IFigure at the specified location | |
232 */ | |
233 IFigure findFigureAt(int x, int y, TreeSearch search); | |
234 | |
235 /** | |
236 * Returns the IFigure at the specified location. May return <code>this</code> or | |
237 * <code>null</code>. | |
238 * @param p The point | |
239 * @return The IFigure at the specified location | |
240 */ | |
241 IFigure findFigureAt(Point p); | |
242 | |
243 /** | |
244 * Returns the IFigure at the specified location, excluding any IFigures in | |
245 * <code>collection</code>. May return <code>this</code> or <code>null</code>. | |
246 * @param x The X coordinate | |
247 * @param y The Y coordinate | |
248 * @param collection A collection of IFigures to be excluded | |
249 * @return The IFigure at the specified location, excluding any IFigures in collection | |
250 */ | |
251 IFigure findFigureAtExcluding(int x, int y, Collection collection); | |
252 | |
253 /** | |
254 * Returns the IFigure located at the given location which will accept mouse events. | |
255 * @param x The X coordinate | |
256 * @param y The Y coordinate | |
257 * @return The IFigure located at the given location which will accept mouse events | |
258 */ | |
259 IFigure findMouseEventTargetAt(int x, int y); | |
260 | |
261 /** | |
262 * Returns the background color. Background color can be inherited from the parent. | |
263 * @return The background color | |
264 */ | |
265 Color getBackgroundColor(); | |
266 | |
267 /** | |
268 * Returns the current border by reference. | |
269 * @return The current border | |
270 */ | |
271 Border getBorder(); | |
272 | |
273 /** | |
274 * Returns the smallest rectangle completely enclosing the IFigure. Implementation may | |
275 * return the Rectangle by reference. For this reason, callers of this method must not | |
276 * modify the returned Rectangle. The Rectangle's values may change in the future. | |
277 * @return This IFigure's bounds | |
278 */ | |
279 Rectangle getBounds(); | |
280 | |
281 /** | |
282 * Returns an unmodifiable list of children by reference. | |
283 * @return An unmodifiable list of children by reference | |
284 */ | |
285 List getChildren(); | |
286 | |
287 /** | |
288 * Returns the rectangular area within this Figure's bounds in which children will be | |
289 * placed (via {@link LayoutManager LayoutManagers}) and the painting of children will be | |
290 * clipped. | |
291 * @return The client area | |
292 */ | |
293 Rectangle getClientArea(); | |
294 | |
295 /** | |
296 * Copies the client area into the specificied Recangle, and returns that rectangle for | |
297 * convenience. | |
298 * @param rect The destination rectangle for the client area | |
299 * @return The same instance that was passed in, modified to contain the client area | |
300 */ | |
301 Rectangle getClientArea(Rectangle rect); | |
302 | |
303 /** | |
304 * Returns the Cursor used when the mouse is over this IFigure. | |
305 * @return The Cursor used when the mouse is over this IFigure | |
306 */ | |
307 Cursor getCursor(); | |
308 | |
309 /** | |
310 * Returns the current Font by reference. | |
311 * @return The current Font | |
312 */ | |
313 Font getFont(); | |
314 | |
315 /** | |
316 * Returns the foreground color. | |
317 * @return The foreground color | |
318 */ | |
319 Color getForegroundColor(); | |
320 | |
321 /** | |
322 * Returns the current Insets. May be returned by reference. The returned value should | |
323 * not be modified. | |
324 * @return The current Insets. | |
325 */ | |
326 Insets getInsets(); | |
327 | |
328 /** | |
329 * Returns the current LayoutManager by reference. | |
330 * @return The current LayoutManager by reference | |
331 */ | |
332 LayoutManager getLayoutManager(); | |
333 | |
334 /** | |
335 * Returns the background Color of this Figure. Does not inherit this Color from the | |
336 * parent, may return null. | |
337 * @return The local background Color | |
338 */ | |
339 Color getLocalBackgroundColor(); | |
340 | |
341 /** | |
342 * Returns the local foreground Color of this Figure. Does not inherit this Color from the | |
343 * parent, may return null. | |
344 * @return The local foreground Color | |
345 */ | |
346 Color getLocalForegroundColor(); | |
347 | |
348 /** | |
349 * Returns a hint indicating the largest desireable size for the IFigure. Returned | |
350 * Dimension is by value. | |
351 * @return The maximum size | |
352 */ | |
353 Dimension getMaximumSize(); | |
354 | |
355 /** | |
356 * Returns a hint indicating the smallest desireable size for the IFigure. | |
357 * The returned dimension may be by <i>reference</i>, and it must not be modified by the | |
358 * caller. | |
359 * @return The minimum size | |
360 */ | |
361 Dimension getMinimumSize(); | |
362 | |
363 /** | |
364 * Returns a hint indicating the smallest desireable size for the IFigure. | |
365 * The returned dimension may be by <i>reference</i>, and it must not be modified by the | |
366 * caller. | |
367 * @param wHint the width hint | |
368 * @param hHint the height hint | |
369 * @return The minimum size | |
370 */ | |
371 Dimension getMinimumSize(int wHint, int hHint); | |
372 | |
373 /** | |
374 * Returns the IFigure that is the current parent of this IFigure or <code>null</code> if | |
375 * there is no parent. | |
376 * @return <code>null</code> or the parent figure | |
377 */ | |
378 IFigure getParent(); | |
379 | |
380 /** | |
381 * Returns the preferred size for this IFigure. The returned value must not be modified | |
382 * by the caller. If the figure has no preference, it returns its current size. The same | |
383 * as calling {@link #getPreferredSize(int, int) getPreferredSize(-1, -1)}. | |
384 * @return The preferred size | |
385 */ | |
386 Dimension getPreferredSize(); | |
387 | |
388 /** | |
389 * Returns the preferred size for this IFigure using the provided width and height hints. | |
390 * The returned dimension may be by <i>reference</i>, and it must not be modified by the | |
391 * caller. A value of <code>-1</code> indicates that there is no constraint in that | |
392 * direction. | |
393 * | |
394 * @param wHint a width hint | |
395 * @param hHint a height hint | |
396 * @return The preferred size | |
397 */ | |
398 Dimension getPreferredSize(int wHint, int hHint); | |
399 | |
400 /** | |
401 * Returns the current size. Returned Dimension is by value. | |
402 * @return The current size | |
403 */ | |
404 Dimension getSize(); | |
405 | |
406 /** | |
407 * Returns a IFigure that is the tooltip for this IFigure. | |
408 * @return This IFigure's tooltip | |
409 */ | |
410 IFigure getToolTip(); | |
411 | |
412 /** | |
413 * Returns the UpdateManager for this IFigure by reference. | |
414 * @return The update manager | |
415 */ | |
416 UpdateManager getUpdateManager(); | |
417 | |
418 /** | |
419 * Called when this IFigure has gained focus. | |
420 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
421 * notification of this type of event, you should register a {@link FocusListener} with | |
422 * this IFigure. | |
423 * @param event The focus event | |
424 */ | |
425 void handleFocusGained(FocusEvent event); | |
426 | |
427 /** | |
428 * Called when this IFigure has lost focus. | |
429 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
430 * notification of this type of event, you should register a {@link FocusListener} with | |
431 * this IFigure. | |
432 * @param event The focus event | |
433 */ | |
434 void handleFocusLost(FocusEvent event); | |
435 | |
436 /** | |
437 * Called when a key is pressed while this IFigure has focus. | |
438 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
439 * notification of this type of event, you should register a {@link KeyListener} with | |
440 * this IFigure. | |
441 * @param event The key event | |
442 */ | |
443 void handleKeyPressed(KeyEvent event); | |
444 | |
445 /** | |
446 * Called when a key is released while this IFigure has focus. | |
447 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
448 * notification of this type of event, you should register a {@link KeyListener} with | |
449 * this IFigure. | |
450 * @param event The key event | |
451 */ | |
452 void handleKeyReleased(KeyEvent event); | |
453 | |
454 /** | |
455 * Called when a mouse button has been double-clicked while within this IFigure's bounds. | |
456 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
457 * notification of this type of event, you should register a {@link MouseListener} with | |
458 * this IFigure. | |
459 * @param event The mouse event | |
460 */ | |
461 void handleMouseDoubleClicked(MouseEvent event); | |
462 | |
463 /** | |
464 * Called when the mouse has been dragged within this IFigure's bounds. | |
465 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
466 * notification of this type of event, you should register a {@link MouseMotionListener} | |
467 * with this IFigure. | |
468 * @param event The mouse event | |
469 */ | |
470 void handleMouseDragged(MouseEvent event); | |
471 | |
472 /** | |
473 * Called when the mouse has entered this IFigure's bounds. | |
474 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
475 * notification of this type of event, you should register a {@link MouseMotionListener} | |
476 * with this IFigure. | |
477 * @param event The mouse event | |
478 */ | |
479 void handleMouseEntered(MouseEvent event); | |
480 | |
481 /** | |
482 * Called when the mouse has exited this IFigure's bounds. | |
483 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
484 * notification of this type of event, you should register a {@link MouseMotionListener} | |
485 * with this IFigure. | |
486 * @param event The mouse event | |
487 */ | |
488 void handleMouseExited(MouseEvent event); | |
489 | |
490 /** | |
491 * Called when the mouse has hovered over this IFigure. | |
492 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
493 * notification of this type of event, you should register a {@link MouseMotionListener} | |
494 * with this IFigure. | |
495 * @param event The mouse event | |
496 */ | |
497 void handleMouseHover(MouseEvent event); | |
498 | |
499 /** | |
500 * Called when the mouse has moved within this IFigure's bounds. | |
501 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
502 * notification of this type of event, you should register a {@link MouseMotionListener} | |
503 * with this IFigure. | |
504 * @param event The mouse event | |
505 */ | |
506 void handleMouseMoved(MouseEvent event); | |
507 | |
508 /** | |
509 * Called when a mouse button has been pressed while within this IFigure's bounds. | |
510 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
511 * notification of this type of event, you should register a {@link MouseListener} with | |
512 * this IFigure. | |
513 * @param event The mouse event | |
514 */ | |
515 void handleMousePressed(MouseEvent event); | |
516 | |
517 /** | |
518 * Called when a mouse button has been released while within this IFigure's bounds. | |
519 * <p><b>NOTE</b>: You should not override this method. If you are interested in receiving | |
520 * notification of this type of event, you should register a {@link MouseListener} with | |
521 * this IFigure. | |
522 * @param event The mouse event | |
523 */ | |
524 void handleMouseReleased(MouseEvent event); | |
525 | |
526 /** | |
527 * Returns <code>true</code> if this IFigure has focus. | |
528 * @return <code>true</code> if this IFigure has focus | |
529 */ | |
530 bool hasFocus(); | |
531 | |
532 /** | |
533 * This method is <b>for internal purposes only</b> and should not be called. | |
534 * @return The event dispatcher | |
535 */ | |
536 EventDispatcher internalGetEventDispatcher(); | |
537 | |
538 /** | |
539 * Returns <code>true</code> if this IFigure's bounds intersect with the given Rectangle. | |
540 * Figure is asked so that non-rectangular IFigures can reduce the frequency of paints. | |
541 * @param rect The rectangle to check for intersection | |
542 * @return <code>true</code> if this IFigure's bounds intersect with the given Rectangle | |
543 */ | |
544 bool intersects(Rectangle rect); | |
545 | |
546 /** | |
547 * Invalidates this IFigure. If this figure has a LayoutManager, then | |
548 * {@link LayoutManager#invalidate()} should be called on that layout. | |
549 */ | |
550 void invalidate(); | |
551 | |
552 /** | |
553 * Invalidates this figure as well as all contained within. | |
554 */ | |
555 void invalidateTree(); | |
556 | |
557 /** | |
558 * Returns <code>true</code> if this figure is capable of applying a local coordinate | |
559 * system which affects its children. | |
560 * @since 3.1 | |
561 * @return <code>true</code> if this figure provides local coordinates to children | |
562 */ | |
563 bool isCoordinateSystem(); | |
564 | |
565 /** | |
566 * Returns <code>true</code> if this IFigure is enabled. | |
567 * @return <code>true</code> if this IFigure is enabled | |
568 */ | |
569 bool isEnabled(); | |
570 | |
571 /** | |
572 * Returns <code>true</code> if this IFigure can gain focus on a | |
573 * {@link dwt.events.TraverseEvent}. | |
574 * @return <code>true</code> if this IFigure can gain focus on a TraverseEvent | |
575 */ | |
576 bool isFocusTraversable(); | |
577 | |
578 /** | |
579 * @return <code>true</code> if this figure is hosted in a Control that is mirrored | |
580 * @since 3.1 | |
581 */ | |
582 bool isMirrored(); | |
583 | |
584 /** | |
585 * Returns <code>true</code> if this IFigure is opaque. | |
586 * @return <code>true</code> if this IFigure is opaque | |
587 */ | |
588 bool isOpaque(); | |
589 | |
590 /** | |
591 * Returns <code>true</code> if this IFigure can receive focus on a call to | |
592 * {@link #requestFocus()}. | |
593 * @return <code>true</code> if this IFigure can receive focus on a call to requestFocus() | |
594 */ | |
595 bool isRequestFocusEnabled(); | |
596 | |
597 /** | |
598 * Returns <code>true</code> if this IFigure is showing. This figure is only showing if | |
599 * it is visible and its parent is showing, or it has no parent. | |
600 * @return <code>true</code> if this IFigure is showing | |
601 */ | |
602 bool isShowing(); | |
603 | |
604 /** | |
605 * returns <code>true</code> if this figure's visibility flag is set to true. Does not | |
606 * walk up the parent chain. | |
607 * @return <code>true</code> if the figure's visibility flag is set | |
608 */ | |
609 bool isVisible(); | |
610 | |
611 /** | |
612 * Paints this IFigure and its children. | |
613 * @param graphics The Graphics object used for painting | |
614 */ | |
615 void paint(Graphics graphics); | |
616 | |
617 /** | |
618 * Removes the given child from this figure's children. If this figure has a | |
619 * LayoutManager, then {@link LayoutManager#remove(IFigure)} shall be called on that | |
620 * layout with the child. | |
621 * @param figure The IFigure to remove | |
622 */ | |
623 void remove(IFigure figure); | |
624 | |
625 /** | |
626 * Unregisters the given listener, so that it will no longer receive notification of | |
627 * ancestor events. | |
628 * @param listener The listener to remove | |
629 */ | |
630 void removeAncestorListener(AncestorListener listener); | |
631 | |
632 /** | |
633 * Unregisters the given listener, so that it will no longer receive notification of | |
634 * coordinate changes. | |
635 * @param listener the listener to remove | |
636 * @since 3.1 | |
637 */ | |
638 void removeCoordinateListener(CoordinateListener listener); | |
639 | |
640 /** | |
641 * Unregisters the given listener, so that it will no longer receive notification of | |
642 * IFigure events. | |
643 * @param listener The listener to remove | |
644 */ | |
645 void removeFigureListener(FigureListener listener); | |
646 | |
647 /** | |
648 * Unregisters the given listener, so that it will no longer receive notification of focus | |
649 * events. | |
650 * @param listener The listener to remove | |
651 */ | |
652 void removeFocusListener(FocusListener listener); | |
653 | |
654 /** | |
655 * Removes the first occurence of the given listener. | |
656 * @param listener The listener to remove | |
657 */ | |
658 void removeKeyListener(KeyListener listener); | |
659 | |
660 /** | |
661 * Removes the most recent occurence of the given listener. | |
662 * @since 3.1 | |
663 * @param listener the listener to remove | |
664 */ | |
665 void removeLayoutListener(LayoutListener listener); | |
666 | |
667 /** | |
668 * Unregisters the given listener, so that it will no longer receive notification of mouse | |
669 * events. | |
670 * @param listener The listener to remove | |
671 */ | |
672 void removeMouseListener(MouseListener listener); | |
673 | |
674 /** | |
675 * Unregisters the given listener, so that it will no longer receive notification of mouse | |
676 * motion events. | |
677 * @param listener The listener to remove | |
678 */ | |
679 void removeMouseMotionListener(MouseMotionListener listener); | |
680 | |
681 /** | |
682 * Called before this IFigure is removed from its parent. | |
683 */ | |
684 void removeNotify(); | |
685 | |
686 /** | |
687 * Unregisters the given listener, so that it will no longer receive notification of any | |
688 * property changes. | |
689 * @param listener The listener to remove | |
690 */ | |
691 void removePropertyChangeListener(PropertyChangeListener listener); | |
692 | |
693 /** | |
694 * Unregisters the given listener, so that it will no longer receive notification of | |
695 * changes in the given property. This will only unregister the listener for the given | |
696 * property. If the listener is registered to listen to other properties, this will not | |
697 * affect the notification of the listener regarding those properties. | |
698 * @param property The property that the listener is no longer interested in | |
699 * @param listener The listener no longer interested in the property | |
700 */ | |
701 void removePropertyChangeListener(String property, PropertyChangeListener listener); | |
702 | |
703 /** | |
704 * Repaints this IFigure. | |
705 */ | |
706 void repaint(); | |
707 | |
708 /** | |
709 * Repaints the rectangular area within this IFigure whose upper-left corner is located at | |
710 * the point <code>(x,y)</code> and whose width and height are <code>w</code> and | |
711 * <code>h</code>, respectively. | |
712 * @param x The X coordinate of the area to repaint | |
713 * @param y The Y coordinate of the area to repaint | |
714 * @param w The width of the area to repaint | |
715 * @param h The height of the area to repaint | |
716 */ | |
717 void repaint(int x, int y, int w, int h); | |
718 | |
719 /** | |
720 * Repaints the rectangular area within this IFigure represented by <code>rect</code>. | |
721 * @param rect The rectangular area to be repainted | |
722 */ | |
723 void repaint(Rectangle rect); | |
724 | |
725 /** | |
726 * Requests focus from the {@link EventDispatcher}. | |
727 */ | |
728 void requestFocus(); | |
729 | |
730 /** | |
731 * Invalidates this figure and revalidates() its parent. If a figure does not have a | |
732 * parent, it will request a validation from it UpdateManager. Calling this method does | |
733 * not guarantee that a repaint will occur. | |
734 */ | |
735 void revalidate(); | |
736 | |
737 /** | |
738 * Sets the background color. | |
739 * @param c The new background color | |
740 */ | |
741 void setBackgroundColor(Color c); | |
742 | |
743 /** | |
744 * Sets the border. | |
745 * @param b The new border | |
746 */ | |
747 void setBorder(Border b); | |
748 | |
749 /** | |
750 * Sets the bounds to the bounds of the specified <code>Rectangle</code>. | |
751 * @param rect The new bounds | |
752 */ | |
753 void setBounds(Rectangle rect); | |
754 | |
755 /** | |
756 * Convenience method to set the constraint of the specified child in the current | |
757 * LayoutManager. | |
758 * @param child The figure whose constraint is being set | |
759 * @param constraint the constraint | |
760 * @throws IllegalArgumentException if the child is not contained by this Figure | |
761 */ | |
762 void setConstraint(IFigure child, Object constraint); | |
763 | |
764 /** | |
765 * Sets the cursor. | |
766 * @param cursor The new cursor | |
767 */ | |
768 void setCursor(Cursor cursor); | |
769 | |
770 /** | |
771 * Sets this IFigure to be enabled. | |
772 * @param value <code>true</code> if this IFigure should be enabled | |
773 */ | |
774 void setEnabled(bool value); | |
775 | |
776 /** | |
777 * Sets the ability for this IFigure to gain focus on a | |
778 * {@link dwt.events.TraverseEvent}. | |
779 * @param value <code>true</code> if this IFigure should gain focus on a TraverseEvent | |
780 */ | |
781 void setFocusTraversable(bool value); | |
782 | |
783 /** | |
784 * Sets the font. | |
785 * @param f The new font | |
786 */ | |
787 void setFont(Font f); | |
788 | |
789 /** | |
790 * Sets the foreground color. | |
791 * @param c The new foreground color | |
792 */ | |
793 void setForegroundColor(Color c); | |
794 | |
795 /** | |
796 * Sets the LayoutManager. | |
797 * @param lm The new layout manager | |
798 */ | |
799 void setLayoutManager(LayoutManager lm); | |
800 | |
801 /** | |
802 * Sets the location of this IFigure. | |
803 * @param p The new location | |
804 */ | |
805 void setLocation(Point p); | |
806 | |
807 /** | |
808 * Sets the maximum size this IFigure can be. | |
809 * @param size The new maximum size | |
810 */ | |
811 void setMaximumSize(Dimension size); | |
812 | |
813 /** | |
814 * Sets the minimum size this IFigure can be. | |
815 * @param size The new minimum size | |
816 */ | |
817 void setMinimumSize(Dimension size); | |
818 | |
819 /** | |
820 * Sets this IFigure to be opaque if <i>isOpaque</i> is <code>true</code> and transparent | |
821 * if <i>isOpaque</i> is <code>false</code>. | |
822 * @param isOpaque <code>true</code> is this IFigure should be opaque | |
823 */ | |
824 void setOpaque(bool isOpaque); | |
825 | |
826 /** | |
827 * Sets this IFigure's parent. | |
828 * @param parent The new parent IFigure | |
829 */ | |
830 void setParent(IFigure parent); | |
831 | |
832 /** | |
833 * Sets this IFigure's preferred size. | |
834 * @param size The new preferred size | |
835 */ | |
836 void setPreferredSize(Dimension size); | |
837 | |
838 /** | |
839 * Sets the ability for this Figure to gain focus on a call to {@link #requestFocus()}. | |
840 * @param requestFocusEnabled <code>true</code> if this IFigure should gain focus on a call | |
841 * to requestFocus() | |
842 */ | |
843 void setRequestFocusEnabled(bool requestFocusEnabled); | |
844 | |
845 /** | |
846 * Sets this IFigure's size. | |
847 * @param d The new size | |
848 */ | |
849 void setSize(Dimension d); | |
850 | |
851 /** | |
852 * Sets this IFigure's size. | |
853 * @param w The new width | |
854 * @param h The new height | |
855 */ | |
856 void setSize(int w, int h); | |
857 | |
858 /** | |
859 * Sets a tooltip that is displayed when the mouse hovers over this IFigure. | |
860 * @param figure The tooltip IFigure | |
861 */ | |
862 void setToolTip(IFigure figure); | |
863 | |
864 /** | |
865 * Sets this IFigure's visibility. | |
866 * @param visible <code>true</code> if this IFigure should be visible | |
867 */ | |
868 void setVisible(bool visible); | |
869 | |
870 /** | |
871 * Moves this IFigure <code>x</code> pixels horizontally and <code>y</code> pixels | |
872 * vertically. | |
873 * @param x The amount to move this IFigure horizontally | |
874 * @param y The amount to move this IFigure vertically | |
875 */ | |
876 void translate(int x, int y); | |
877 | |
878 /** | |
879 * Translates a Translatable from this IFigure's parent's coordinates to this IFigure's | |
880 * local coordinates. | |
881 * @param t The object to translate | |
882 */ | |
883 void translateFromParent(Translatable t); | |
884 | |
885 /** | |
886 * Translates a Translatable that is relative to this figure's bounds to absolute. | |
887 * @param t The object to translate | |
888 */ | |
889 void translateToAbsolute(Translatable t); | |
890 | |
891 /** | |
892 * Translates a Translatable from this IFigure's coordinates to its parent's coordinates. | |
893 * @param t The object to translate | |
894 */ | |
895 void translateToParent(Translatable t); | |
896 | |
897 /** | |
898 * Translates a Translatable in absolute coordinates to be relative to this figure's | |
899 * bounds. | |
900 * @param t The object to translate | |
901 */ | |
902 void translateToRelative(Translatable t); | |
903 | |
904 /** | |
905 * Indicates that this figure should make itself valid. Validation includes invoking | |
906 * layout on a LayoutManager if present, and then validating all children figures. | |
907 * Default validation uses pre-order, depth-first ordering. | |
908 */ | |
909 void validate(); | |
910 | |
911 } |