Re: menus in plugins

From: Dom Lachowicz (domlachowicz@yahoo.com)
Date: Tue Nov 04 2003 - 15:57:10 EST

  • Next message: Jordi Mas: "Problem when hacking xap_Win32FrameImpl.cpp"

    --- Raphael Finkel <raphael@cs.uky.edu> wrote:
    > I have looked through code both in AbiWord and in
    > the ImageMagick plugin
    > to figure out how to create a menu with a submenu.
    > I can build a menu
    > item for my plugin, placing it in the context menu,
    > but I just don't see
    > how I to establish the linkage so that activating
    > this menu item calls
    > up a dynamically computed submenu.

    Consider around line 172 (AddToMenus):

    http://www.abisource.com/lxr/source/abiword-plugins/tools/ots/xp/AbiOts.cpp

    What happens is that you create an "EditMethod". An
    EditMethod is basically a string name plus a function
    pointer. Whenever one invokes the EditMethod with that
    name, that function pointer gets called (line 177).

    Line 184: we add this edit method to the list of known
    edit methods. It is now available to all of AbiWord.

    Line 196: we say "Whenever the menu item associated
    with 'newId' is activated, call the EditMethod
    'AbiOts_invoke'".

    Line 210: add the action to our action mapper

    The ImageMagick hides all of this behind some macros
    and auxiliary structs since there is a lot of
    near-duplicated code going on.

    In this URL:

    http://www.abisource.com/lxr/source/abiword-plugins/wp/impexp/graphics/magick/xp/AbiMagick.cpp

    Everything from line 459-621 has some general
    applicability nonspecific to the ImageMagick plugin.

    Dom

    __________________________________
    Do you Yahoo!?
    Protect your identity with Yahoo! Mail AddressGuard
    http://antispam.yahoo.com/whatsnewfree



    This archive was generated by hypermail 2.1.4 : Tue Nov 04 2003 - 15:55:05 EST