Re: [gtk-list] Gtk_MenuFactory alignment?



Marsel Osipov <marsel@lex.infi.net> writes:
> I need to align the "Help" menu in the right hand corner of the
> menubar.  How do I do that?
> Here is the reply that I got.
> 
> menu_path = gtk_menu_factory_find(factory, "<MyApp>/Help");
> gtk_menu_item_right_justify(menu_path->widget);
> 
> Since I use gtk--, I have to modify it a little...I tried the following
> 
> Gtk_MenuPath menu_path;  // <-- this gives me an error

MenuFactory's factory_find returns pointer to MenuPath. Thus, use
Gtk_MenuPath * mp=factory->factory_find("<MyApp>/Help");
Gtk_MenuItem *mi=(Gtk_MenuItem*)mp->widget; // dangerous cast
mi->right_justify();

> What am I doing wrong?

MenuPath does not have default constructor => you cannot create objects
of that type cept from existing C object.

> Also, since right_justify(void) is a member function of Gtk_MenuItem
> class, how do I convert from Gtk_MenuPath to Gtk_MenuItem?

thats more difficult - and the conversion isnt the cleanest available...
I think I should change that widget member to be of type Gtk_MenuItem to
make it more useful without casts.

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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