Re: [gtkmvc-users] Working with subviews
Brought to you by:
cavada
From: Roberto C. <rob...@gm...> - 2012-05-25 21:00:34
|
2012/5/25 Steve McGrath <smc...@gm...> > I'm having some trouble getting my head around a few things though. Is > there any published code out there using this pattern? I'm not > entirely certain how to break everything down, especially dealing with > the menu and toolbars. > Typically in large applications you have: - One view (possibly with a controller associated) for toolbars and menubars (BarsView and possible BarsCtrl) - M views to decompose the rest of the application presentation - N controllers (N <= M) to decompose the controllers of the M views Now you want some (not necessarily all) controls in the menu and toolbars to be handled in the N controllers, to keep locality. The way I always solve this problem is: 1. Each of the M views contains its own actions to be later associated to the UI manager allocated in BarsView 2. The signal handlers of the actions are located in the N controllers, attached automatically when views and controllers are connected each other. 3. BarsView creates and handles the UIManager. This Bars view has the visibility of all M views (throught the ApplicationView which stays at top-level and has to be passed down to BarsView's constructor. In this way the BarsView can access the actions allocated in the M views to associate them in the UIManager. Let me think what you think about this, and if it is not clear enough I will try to make an example. r. |