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

# BonoboView

## Name

BonoboView -- View object for exporting a view of a BonoboEmbeddable component

## Synopsis

    struct      BonoboView;
    typedef     BonoboViewClass;
    #define     BONOBO_VIEW_VERB_FUNC           (fn)
    void        (*BonoboViewVerbFunc)           (BonoboView *view,
                                                 const char *verb_name,
                                                 void *user_data);
    BonoboView* bonobo_view_construct           (BonoboView *view,
                                                 GtkWidget *widget);
    BonoboView* bonobo_view_new                 (GtkWidget *widget);
    void        bonobo_view_set_embeddable      (BonoboView *view,
                                                 BonoboEmbeddable *embeddable);
    BonoboEmbeddable* bonobo_view_get_embeddable
                                                (BonoboView *view);
    void        bonobo_view_set_view_frame      (BonoboView *view,
                                                 Bonobo_ViewFrame view_frame);
    Bonobo_ViewFrame bonobo_view_get_view_frame (BonoboView *view);
    Bonobo_UIContainer bonobo_view_get_remote_ui_container
                                                (BonoboView *view);
    BonoboUIComponent* bonobo_view_get_ui_component
                                                (BonoboView *view);
    void        bonobo_view_activate_notify     (BonoboView *view,
                                                 gboolean activated);

## Object Hierarchy

      GtkObject
       +----BonoboObject
             +----BonoboXObject
                   +----BonoboControl
                         +----BonoboView

## Signal Prototypes

    "set-zoom-factor"
                void        user_function      (BonoboView *bonoboview,
                                                gdouble arg1,
                                                gpointer user_data);

## Description

BonoboView objects are typically created on the view factory callback of a BonoboEmbeddable object. Bonobo components should be able to provide as many view objects as requested by the BonoboEmbeddable object on demand.

It is the programmer's responsibility to keep the contents of all the views displaying the same information (modulo per-view state, like the zoom factor). Since GtkWidgets do not support linear zooming, it is essential to understand that you cannot use GtkWidgets inside your view - you must write custom rendering code.

An embeddable view is not a Control - by this I mean that it does not control its own sizing, rendering or layout. It is entirely a slave to the parent with respect to this. A View should never render scroll bars into itself ( unless, exceptionaly if it is activated, and allows the user to pan around a larger area ). Essentialy a non-activated view should only show things that it will print, and should render WYSIWYG as much as possible. Embeddable's views scale linearly to obey the zoom level they are given.

If your component provides menus, then you use the bonobo_view_get_remote_ui_container() to retrieve a Bonobo_UIContainer handle to merge your menu / toolbar items into.

BonoboView objects get a chance to tell their containers their desired size by responding to the "size_query" signal. They will get their size assigned later. The size assignment happens on the GtkWidget using the normal Gtk+ size allocation procedure.

Your component must support zooming to be a true embeddable. There are two ways to support zoom.

- Zoom to fit - for simple items such as images this makes sense the item simply displays all of itself scaled to the available size allocated to the GtkWidget.

- Scaled - this obeys the zoom factor as set by the container, it also crops the display of the image to the GtkWindow. Connect to the "set_zoom_factor" signal. This signal gives a floating point value that indicates the desired zoom factor set by your container.

## Details

### struct BonoboView

    struct BonoboView;

### BonoboViewClass

    typedef struct {
    	BonoboControlClass       parent_class;

    	POA_Bonobo_View__epv     epv;

    	/* Signals */
    	void (*do_verb)         (BonoboView *view,
    				 const CORBA_char *verb_name);
    	void (*set_zoom_factor) (BonoboView *view, double zoom);

    } BonoboViewClass;

### BONOBO_VIEW_VERB_FUNC()

    #define BONOBO_VIEW_VERB_FUNC(fn) ((BonoboViewVerbFunc)(fn))

`fn` : |

### BonoboViewVerbFunc ()

    void        (*BonoboViewVerbFunc)           (BonoboView *view,
                                                 const char *verb_name,
                                                 void *user_data);

`view` : |
`verb_name` : |
`user_data` : |

### bonobo_view_construct ()

    BonoboView* bonobo_view_construct           (BonoboView *view,
                                                 GtkWidget *widget);

`item_creator` might be NULL for widget-based views.

`view` : | The BonoboView object to be initialized.
`widget` : | A GtkWidget contains the view and * will be passed to the container process's ViewFrame object.
Returns : | the intialized BonoboView object.

### bonobo_view_new ()

    BonoboView* bonobo_view_new                 (GtkWidget *widget);

This function creates a new BonoboView object for `widget`

`widget` : | a GTK widget that contains the view and will be passed to the container process.
Returns : | a BonoboView object that implements the Bonobo::View CORBA service that will transfer the `widget` to the container process.

### bonobo_view_set_embeddable ()

    void        bonobo_view_set_embeddable      (BonoboView *view,
                                                 BonoboEmbeddable *embeddable);

This function associates `view` with the specified GnomeEmbeddabe object, `embeddable`.

`view` : | A BonoboView object.
`embeddable` : | The BonoboEmbeddable object for which `view` is a view.

### bonobo_view_get_embeddable ()

    BonoboEmbeddable* bonobo_view_get_embeddable
                                                (BonoboView *view);

`view` : | A BonoboView object.
Returns : | The BonoboEmbeddable object for which `view` is a BonoboView.

### bonobo_view_set_view_frame ()

    void        bonobo_view_set_view_frame      (BonoboView *view,
                                                 Bonobo_ViewFrame view_frame);

Sets the ViewFrame for `view` to `view_frame`.

`view` : | A BonoboView object.
`view_frame` : | A CORBA interface for the ViewFrame which contains this View.

### bonobo_view_get_view_frame ()

    Bonobo_ViewFrame bonobo_view_get_view_frame (BonoboView *view);

`view` : | A BonoboView object whose Bonobo_ViewFrame CORBA interface is being retrieved.
Returns : | The Bonobo_ViewFrame CORBA object associated with `view`, this is a CORBA_object_duplicated object. You need to CORBA_free it when you are done with it.

### bonobo_view_get_remote_ui_container ()

    Bonobo_UIContainer bonobo_view_get_remote_ui_container
                                                (BonoboView *view);

`view` : | A BonoboView object which is bound to a remote BonoboViewFrame.
Returns : | The Bonobo_UIContainer CORBA server for the remote BonoboViewFrame.

### bonobo_view_get_ui_component ()

    BonoboUIComponent* bonobo_view_get_ui_component
                                                (BonoboView *view);

`view` : | A BonoboView object for which a BonoboUIComponent has been created and set.
Returns : | The BonoboUIComponent which was associated with `view` when it was created.

### bonobo_view_activate_notify ()

    void        bonobo_view_activate_notify     (BonoboView *view,
                                                 gboolean activated);

This function notifies `view`'s remote ViewFrame that the activation state of `view` has changed.

`view` : | A BonoboView object which is bound to a remote BonoboViewFrame..
`activated` : |

## Signals

### The "set-zoom-factor" signal

    void        user_function                  (BonoboView *bonoboview,
                                                gdouble arg1,
                                                gpointer user_data);

This signal is emitted when the container requests the view to set its zoom factor to `arg1`. The view should respond by setting its zoom factor to the specified value.

`bonoboview` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.

## See Also

BonoboViewFrame, BonoboEmbeddable, BonoboWidget, bonobo_widget_new()

<<< Previous Page | Home | Up | Next Page >>>
View interfaces | BonoboViewFrame