Re: GtkHandleBox - detaching menubar by other ways than dragging with the mouse?



"roland" wrote:

i have an application which seems to use GTK.
The menue of the app can be detached and I found this could be the
GTKHandleBox widget.

Are you talking about an application you wrote or about a foreign
application?

I want to run the application in a "restricted" manner and want to
automatically (non interactively) detach/undock/remove the menu bar
from the application (moving it out of the user`s sight or even
hide/disable it completely, if possible)

Can this be done in any way by NOT using the Mouse - e.g. by a
commandline param referencing that widget or sending signals to the
program ?

I'm not sure whether I understood you correct, but as far as I did you
just want to provide the application a way to run without menu bar?

There are three ways to conditionally hide the menu bar, which
immediately come into my mind. However, they all require modifications
of the source code of that application and don't consist of just
external influence.

First you should define your condition. This can be a command line
paraneter upon startup, a hotkey press during execution or existance /
non-existance of particular control files. Then, if that condition is
true, there are the following ways:

1. the simpliest: use gtk_widget_hide () to hide the entire (existing)
menu bar (after it has been created). If the menu bar is inside a
GtkHandleBox then hide that GtkHandleBox instead. See
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-hide

2. a bit more complicated: build the menu bar only if your no-menu
condition is not met. This involves encapsulating the code which builds
the menu into an if()-condition. However, this basically requires a more
custom way of building the menus at all. For instance, if you use
Glade-created code, don't change interface.c (where the menu would be
created the standard way) manually! You'd rather need to build and
(conditionally) add the menu (and possibly GtkHandleBox) in a separate
way, possibly by using
http://developer.gnome.org/doc/API/2.0/gtk/GtkItemFactory.html  or
http://developer.gnome.org/doc/API/2.0/gtk/GtkUIManager.html
I for instance use a self-written function to build all sorts of menus.

3. the trickiest and likely silliest way would be indeed to put the menu
bar inside a GtkhandleBox and, if the no-menu condition is met,
automatically detach and move the handle box out of sight upon
application startup.



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