Customizing NSMenuItem

  • Hi all,

    I'm making a theme framework. This framework will be embedded in my
    app and will give me the ability to draw whatever UI widget I want,
    however I want.

    I'm confident I can do must of it all easily enough. There is only one
    problem I have run into, drawing a menu item. I can squelch the
    drawing easily enough but the method that does the drawing doesn't
    pass in things like item title and key-commands and that stuff. Here
    is the code:

    OSStatus Hacking_HIThemeDrawMenuItem(  const HIRect * inMenuRect,
    const HIRect * inItemRect, const HIThemeMenuItemDrawInfo *
    inItemDrawInfo, CGContextRef inContext, HIThemeOrientation
    inOrientation, HIRect * outContentRect  )

    int main(int argc, char *argv[])
        gOldMenuItem = APEPatchCreate(&HIThemeDrawMenuItem,

        return NSApplicationMain(argc,  (const char **) argv);

    inItemDrawInfo is limited and doesn't have the values I want.

    I wish to know, either, how do I draw a complete custom menu item, or
    has this been done already and if so can I have the code?
    I saw the Camaelon project, after lots of searching, but that doesn't
    work the way I want it to. It doesn't handle drawing of the items in
    the main menu for example because NSMenuView is deprecated. :-(

    I used Shark and found that the drawing of the text and ket code and
    stuff is done in another method, called after this one. It should draw
    text over anything I do in this method but it doesn't appear to,

    All help is appreciated, Alan

    PS. If anyone wants to join me in creating this framework please let
    me know. I'd love to have some help.

    PPS. Also note that I would prefer to get this to work as far back as 10.2.8.

    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
    "When the World realizes that religion really is unimportant, then it
    shall evolve."
previous month october 2006 next month
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today