[Mono-dev] Register my own stock items with Gtk#

David Arnaud-Goddet david.goddet at gmail.com
Wed Sep 19 09:47:31 EDT 2007


Hi all,

I would like to create my own StockItem with Gtk#.
In fact I develop a menu with ImageItemMenu and I would like to add my own
Stock Item in it.
I have already used those built-in to Gtk# without problem but when I try to
create StockItem, I just obtain the StockId string!
I do that :

        //Stock Item Print (built-in Gtk#) which works without problem
grup = new AccelGroup ();
        this.AddAccelGroup(grup);
        ImageMenuItem print_item = new ImageMenuItem(Stock.Print,
myAccelgroup);

        IconFactory iconFact = new IconFactory();
        IconSource iconSource = new IconSource();
        iconSource.Filename = "myIcone.ico";
        IconSet iconSet = new IconSet();
        iconSet.AddSource(iconSource);

        StockItem myStock = new StockItem("myStockId","FTP",1,
Gdk.ModifierType.ControlMask,"homecare");
        iconFact.Add(myStock.StockId,iconSet);

        Menu menu_send = new Menu();
        ImageMenuItem send_item = new ImageMenuItem(myStock.StockId,grup);
        menu_send.Append(send_item);





Mais lors de l'éxécution, j'obtiens dans mon menu : myStockId
Pourtant d'aprés la doc :
 Citation:
  Each stock ID can be associated with a StockItem, which contains the
user-visible label, keyboard accelerator, and translation domain of the menu
or toolbar item; and/or with an icon stored in a IconFactory.
Je dois surment mal m'y prendre pour la création du StockItem. Est-ce que
quelqu'un a déjà réalisé ce genre de chose?

Merci d'avance.

-- 
David ARNAUD-GODDET
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070919/ae85c17e/attachment.html 


More information about the Mono-devel-list mailing list