01: /*
02: * EffectContainer.java
03: *
04: * Created on March 19, 2007, 9:42 PM
05: *
06: * Copyright 2006-2007 Nigel Hughes
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
09: * in compliance with the License. You may obtain a copy of the License at http://www.apache.org/
10: * licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
13: * governing permissions and limitations under the License.
14: */
15:
16: package com.blogofbug.swing.components.effects;
17:
18: import java.awt.Graphics;
19: import java.awt.event.ActionEvent;
20:
21: /**
22: * The interface defines a component that can contain effects.
23: *
24: * @author nigel
25: */
26: public interface EffectContainer {
27:
28: /**
29: * Called when the timer fires. It updates any effects that need updating,
30: * removes any that have finished, and then if at leat one has updated
31: * stimulates a repaint.
32: *
33: * @return true if a repaint should occur
34: */
35: boolean update();
36:
37: /**
38: * Adds an effect to the container.
39: *
40: * @param effect The effect to add
41: */
42: void addEffect(Effect effect);
43:
44: /**
45: * Removes an effect from the container
46: *
47: * @param effect The effect to remove
48: */
49: void removeEffect(Effect effect);
50:
51: /**
52: * Wakes an inactive effect.
53: *
54: * @param effect The effect
55: */
56: void wakeEffect(Effect effect);
57:
58: /**
59: *
60: * Called when the effects need paintin'
61: *
62: * @param graphics The graphics context
63: */
64: void paintEffects(Graphics graphics);
65:
66: /**
67: * Determines the width of the container
68: *
69: * @return The width in pixels of the container
70: */
71: int getWidth();
72:
73: /**
74: * Determines the height of the container
75: *
76: * @return The height in pixels of the container
77: */
78: int getHeight();
79: }
|