Created
October 3, 2020 23:56
-
-
Save ZieIony/f1b27c0b3fe66b7a82ef881ab3c689a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Control { | |
void measure(); | |
void layout(float x, float y, float width, float height); | |
void draw(); | |
void dispatchMouseEvent(MouseEvent event); | |
} | |
class ControlGroup { | |
List<Control> children; | |
void measure() { | |
for(Control c : children) | |
c.measure(); | |
// measure with children | |
} | |
void layout(float x, float y, float width, float height) { | |
super.layout(x, y, width, height); | |
for(Control c : children) | |
c.layout(x2, y2, width2, height2); | |
} | |
void draw() { | |
super.draw(); | |
for(Control c : children) | |
c.draw(); | |
} | |
void dispatchMouseEvent(MouseEvent event) { | |
// fire listeners? | |
for(Control c : children) | |
c.dispatchMouseEvent(event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment