GUI architecture question

36 views
Skip to first unread message

ryan.c...@gmail.com

unread,
May 21, 2014, 7:13:51 PM5/21/14
to gwen-...@googlegroups.com
Hi there,

Nice work on this great GUI library, I'm really learning a lot studying it. I'm trying to educate myself on GUI frameworks at the moment, and it's a pleasure to explore this code base.

I have one question that's just bugging me, so I figured I'd ask the author(s):

The event processing for a control seems to have one extra step that I'm not sure why it exists, perhaps I'm missing something:

- To handle an event (ie. left mouse click), the Canvas calls internal methods on the hovered control - ie. InputMouseClickedLeft - which then simply calls a protected method on the control (in this case OnMouseClickedLeft). All the events are passed this way, through an internal method which does nothing but call a protected method. The only reason I can think of is that you want your On[event] methods to all be protected? Or is there another design factor I'm misunderstanding here? It just seems to be one extra level of indirection, when in fact the canvas could just call OnMouseClickedLeft on the control directly.

Any feedback on this would be greatly appreciated, I'm trying to get a deeper understanding so I apologise for the rather abstract/theoretical question.

Cheers,
Ryan.
Reply all
Reply to author
Forward
0 new messages