On Thu, 13 Sep 2001, Joaquin Cuenca Abela wrote:

> Jared wrote:
> > Hrmn.  I'm still pretty confused. Let me see if I can get some more
> info...
> >
> >   > The way to get a unused XAP_Menu_Id is to
> >   > ask EV_Menu_LayoutSet for a new one.
> >   >
> >   > Let's assume that you know:
> >   >
> >   > * The label that this item will carry (for instance: "Thesaurus") <- I
> >   > will call it "stLabel"
> >   > * A position to put your item <- I will call it "nPos"
> >   > * A function to callback (to simplify, let's assume that we only need
> a
> >   > string with the name of the method to call back). <- I will call it
> >   > "stCallback"
> >   > You start creating a new menu item doing:
> >   >
> >   > XAP_Menu_Id id = m_pLayout->addLayoutItem(nPos, EV_MLF_Normal);
> >
> > Ok, right here I need a time out.  What is m_pLayout?  How do I get to it?
> 
> Fair enough.
> 
> The m_pLayout name is a fictive one.  I was only trying to explain how to
> add a menu item *when* you have a pointer to the right EV_Menu_Layout, etc.
> 
> To your question about how can you get a
> EV_Menu_{Layout,ActionSet,LabelSet}, I replied saying that right now it's
> *not* possible (if you're outside XAP_UnixFrame)

Actually it is possible:

XAP_App * pApp = XAP_App::getApp();
XAP_Frame * pFrame = pApp->getLastFocussedFrame();
XAP_UnixFrame * pUFrame = static_cast<XAP_UnixFrame *>(pFrame);

This will work at any point in the code.

> 
> If you want to make it possible (and you want, belive me :) you should add
> accessors to XAP_Frame (you can name it getMainMenuLayout(), or whatever).
> If you're confused or you don't know how to do it, just drop me a note, I
> will take a break to do that for you.
> 
> A Frame carries information about the layout and about the labelset, but not
> about the actions (who are carried in the App object).
> 

The above code will give you the a XAP_App ppointer too :-)

> > Grep seems to show that there are a lot of different classes with
> m_pLayout
> > members (fl_BlockLayout.h, fl_DocListener.h, fl_SectionLayout.h,
> fp_Page.h,
> > fv_View.h, etc.).
> >
> > I'm think that where I'm not following you is when you refer to member
> > functions and member data but I don't know what class it's in or how to
> get
> > to any of it.
> >
> > In other words, m_pLayout->addLayoutItem(...) is fine if I'm defining that
> > class, but I'm inside a plugin and don't have access to class members.  Is
> 
> > there a sequence of functions I can call that will get me to it?
> 

Yes see above. With this code you can get anything you want in Abi from
anywhere in abi, including a plugin :-)


Cheers


> Nope.  Sorry if I was not clear enough.  Hope that you will be able to do
> these functions (as I said, if you don't know how to do it just drop me a
> note)
> 

Joaquin if you use this code will it help in the Perl bindings?

Cheers

Martin



Reply via email to