Bonobo API Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# BonoboWindow

## Name

BonoboWindow -- the toplevel application window implementation

## Synopsis

    GtkWidget*  bonobo_window_construct         (BonoboWindow *win,
                                                 const char *win_name,
                                                 const char *title);
    GtkWidget*  bonobo_window_new               (const char *win_name,
                                                 const char *title);
    void        bonobo_window_set_contents      (BonoboWindow *win,
                                                 GtkWidget *contents);
    GtkWidget*  bonobo_window_get_contents      (BonoboWindow *win);
    void        bonobo_window_set_name          (BonoboWindow *win,
                                                 const char *win_name);
    char*       bonobo_window_get_name          (BonoboWindow *win);
    GtkAccelGroup* bonobo_window_get_accel_group
                                                (BonoboWindow *win);
    void        bonobo_window_add_popup         (BonoboWindow *win,
                                                 GtkMenu *popup,
                                                 const char *path);
    void        bonobo_window_remove_popup      (BonoboWindow *win,
                                                 const char *path);
    BonoboUIEngine* bonobo_window_get_ui_engine (BonoboWindow *win);

## Description

The BonoboWindow class uses a BonoboUIEngine, in combination with several BonoboUISync classes to achieve a powerful new top-level window widget. It's API mandates the use of XML to specify your UI, it also strongly encourages the use of the BonoboUIComponent API to create even the top-level UI. This incurs almost no penalty since ORBit's CORBA implementation is extremely fast in-processes. This in turn encourages people to ensure that even their top-level components are capable of being used as controls with minimal effort.

Example 1. Creating a BonoboWindow

    	BonoboUIContainer *ui_container;
    	BonoboUIComponent *ui_component;
    	BonoboWindow      *win;

    	win = BONOBO_WINDOW (
    		bonobo_window_new ("Win", "My Test Application"));

    	ui_container = bonobo_ui_container_new();
    	bonobo_ui_container_set_win (ui_container, win);

    	bonobo_ui_engine_config_set_path (
    		bonobo_window_get_ui_engine (win),
    		"/my-application-name/UIConfig/kvps");

So, even for a toplevel window we also want to create a BonoboUIComponent to merge our toplevel UI elements in:

Example 2. Setting up the window UI

    	ui_component = bonobo_ui_component_new ("my-app");

    	/* Associate the BonoboUIComponent with the container */
    	bonobo_ui_component_set_container (
    		ui_component, BONOBO_OBJREF (ui_container);

    	bonobo_ui_util_set_ui (
    		ui_component, MY_COMPILE_TIME_PREFIX,
    		"GNOME_MyApp.ui", "my-app");

Where GNOME_MyApp.ui is the toplevel UI xml file.

## Details

### bonobo_window_construct ()

    GtkWidget*  bonobo_window_construct         (BonoboWindow *win,
                                                 const char *win_name,
                                                 const char *title);

Construct a new BonoboWindow

`win` : | the window to construct
`win_name` : | the window name
`title` : | the window's title for the title bar
Returns : | a constructed window

### bonobo_window_new ()

    GtkWidget*  bonobo_window_new               (const char *win_name,
                                                 const char *title);

`win_name` : | the window name
`title` : | the window's title for the title bar
Returns : | a new BonoboWindow

### bonobo_window_set_contents ()

    void        bonobo_window_set_contents      (BonoboWindow *win,
                                                 GtkWidget *contents);

Insert a widget into the main window contents.

`win` : | the bonobo window
`contents` : | the new widget for it to contain.

### bonobo_window_get_contents ()

    GtkWidget*  bonobo_window_get_contents      (BonoboWindow *win);

`win` : | the bonobo window
Returns : | the contained widget

### bonobo_window_set_name ()

    void        bonobo_window_set_name          (BonoboWindow *win,
                                                 const char *win_name);

Set the name of the window - used for configuration serialization.

`win` : | the bonobo window
`win_name` : | the window name

### bonobo_window_get_name ()

    char*       bonobo_window_get_name          (BonoboWindow *win);

Gets the name of a window.

`win` : | the bonobo window
Returns : | the name of the window

### bonobo_window_get_accel_group ()

    GtkAccelGroup* bonobo_window_get_accel_group
                                                (BonoboWindow *win);

`win` : | the bonobo window
Returns : | the associated accelerator group for this window

### bonobo_window_add_popup ()

    void        bonobo_window_add_popup         (BonoboWindow *win,
                                                 GtkMenu *popup,
                                                 const char *path);

Add a popup `menu` at `path`

`win` : | the window
`popup` : |
`path` : | the path

### bonobo_window_remove_popup ()

    void        bonobo_window_remove_popup      (BonoboWindow *win,
                                                 const char *path);

Remove the popup at `path`

`win` : | the window
`path` : | the path

### bonobo_window_get_ui_engine ()

    BonoboUIEngine* bonobo_window_get_ui_engine (BonoboWindow *win);

Gets the associated UIEngine.

`win` : | the bonobo window
Returns : | the BonoboUIEngine

## See Also

BonoboUIEngine, BonoboUISync, BonoboUIComponent

<<< Previous Page | Home | Up | Next Page >>>
BonoboWidget | BonoboUIComponent