Re: UIHandler's listener functions



On Sat, 15 Jul 2000, Michael Meeks wrote:

> > separated into a new interface, and pass an UIHandlerListener as the
> > first argument of menu_create, etc?
> 
> 	I'm afraid I didn't understand the question at all well; can you
> explain it very simply for a bear of little brain, preferably with sample
> code and module references.

As far as I could tell, the way a control creates a menu in it's container
is by first creating an UIHandler on its side, and then registering it in
the container, and adding menu items to the container's UIHandler, by
passing its own UIHandler as the first argument. Then, when the user
selects a menu item, the container calls `menu_activated' on the
control-side UIHandler associated with the menu item (likewise for
toolbars).
Some example code:

Control
-------
UIHandler container_uih = mycontainer.get_ui_handler;
UIHandler my_uih = create_uihandler;
container_uih.menu_create (my_uih, "/Foo/Bar" /*, ...*/);

Container
---------
Waits for a menu to be selected, then
UIHandler control_uih = look_up_uih_for_menu_path (selected_menupath);
control_uih.menu_activated (selected_menupath);

OK so it's a bit more complex with (un)register_containee and friends, but
this is the basic idea. My proposal is to make a distinction between the
container's UIHandler and the control's UIHandler, which is only used for
callbacks and menu item<->control mapping.

interface UIHandlerListener: Bonobo::Unknown {
       		void menu_activated  (in string path);
       		void menu_removed    (in string path);
       		void menu_overridden (in string path);
       		void menu_reinstated (in string path);

       		void toolbar_activated  (in string path);
       		void toolbar_removed    (in string path);
       		void toolbar_overridden (in string path);
       		void toolbar_reinstated (in string path);
}

and changing all `UIHandler containee' -s to `UIHandlerListener
containee'.

I'll gladly explain it even more if it still needs to be.

-- 
   .--= ULLA! =----------------------------.  finger cactus@cactus.rulez.org
   \      http://cactus.rulez.org           \   for PGP public key
    `----------= cactus@cactus.rulez.org =--'
To be sure of hitting the target, shoot first, and call whatever you hit the target.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]