<refentry id="GnomeDbCanvas">
<refmeta>
<refentrytitle>GnomeDbCanvas</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGNOMEDB-4.0 Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GnomeDbCanvas</refname><refpurpose>Base class for all the <link linkend="GnomeCanvas"><type>GnomeCanvas</type></link> derived widgets in libgnomedb.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>

<synopsis>



struct      <link linkend="GnomeDbCanvas-struct">GnomeDbCanvas</link>;
struct      <link linkend="GnomeDbCanvasClass">GnomeDbCanvasClass</link>;
<link linkend="GnomeDbGraph">GnomeDbGraph</link>* <link linkend="gnome-db-canvas-get-graph">gnome_db_canvas_get_graph</link>     (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);
<link linkend="GtkWidget">GtkWidget</link>*  <link linkend="gnome-db-canvas-set-in-scrolled-window">gnome_db_canvas_set_in_scrolled_window</link>
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);
<link linkend="void">void</link>        <link linkend="gnome-db-canvas-declare-item">gnome_db_canvas_declare_item</link>    (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="GnomeDbCanvasItem">GnomeDbCanvasItem</link> *item);
<link linkend="void">void</link>        <link linkend="gnome-db-canvas-set-zoom-factor">gnome_db_canvas_set_zoom_factor</link> (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="gdouble">gdouble</link> n);
<link linkend="gdouble">gdouble</link>     <link linkend="gnome-db-canvas-get-zoom-factor">gnome_db_canvas_get_zoom_factor</link> (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);
<link linkend="gdouble">gdouble</link>     <link linkend="gnome-db-canvas-fit-zoom-factor">gnome_db_canvas_fit_zoom_factor</link> (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);
<link linkend="gboolean">gboolean</link>    <link linkend="gnome-db-canvas-auto-layout-enabled">gnome_db_canvas_auto_layout_enabled</link>
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);
<link linkend="void">void</link>        <link linkend="gnome-db-canvas-perform-auto-layout">gnome_db_canvas_perform_auto_layout</link>
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="gboolean">gboolean</link> animate,
                                             <link linkend="GnomeDbCanvasLayoutAlgorithm">GnomeDbCanvasLayoutAlgorithm</link> algorithm);
<link linkend="void">void</link>        <link linkend="gnome-db-canvas-center">gnome_db_canvas_center</link>          (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);

</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----<link linkend="GInitiallyUnowned">GInitiallyUnowned</link>
         +----<link linkend="GtkObject">GtkObject</link>
               +----<link linkend="GtkWidget">GtkWidget</link>
                     +----<link linkend="GtkContainer">GtkContainer</link>
                           +----<link linkend="GooCanvas">GooCanvas</link>
                                 +----GnomeDbCanvas
                                       +----<link linkend="GnomeDbCanvasDbRelations">GnomeDbCanvasDbRelations</link>
</synopsis>

</refsect1>



<refsect1>
<title>Implemented Interfaces</title>
<para>
GnomeDbCanvas implements
 <link linkend="AtkImplementorIface">AtkImplementorIface</link> and  <link linkend="GtkBuildable">GtkBuildable</link>.</para>

</refsect1>


<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GnomeDbCanvas--graph">graph</link>&quot;                <link linkend="GnomeDbGraph">GnomeDbGraph</link>         : Read / Write
</synopsis>
</refsect1>

<refsect1>
<title>Signal Prototypes</title>
<synopsis>

&quot;<link linkend="GnomeDbCanvas-drag-action">drag-action</link>&quot;
            <link linkend="void">void</link>        user_function      (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *dbcanvas,
                                            <link linkend="gpointer">gpointer</link> arg1,
                                            <link linkend="gpointer">gpointer</link> arg2,
                                            <link linkend="gpointer">gpointer</link> user_data);
</synopsis>
</refsect1>


<refsect1>
<title>Description</title>
<para>
This abstract class adds some basic functionnalities on top of the <link linkend="GnomeCanvas"><type>GnomeCanvas</type></link> canvas such as:
<itemizedlist>
<listitem><para>synchronisation with a <link linkend="GdaGraph"><type>GdaGraph</type></link> object (to be able to save the position of each canvas
item) and management of the list of items drawn on the canvas.</para></listitem>
<listitem><para>zoom settings</para></listitem>
</itemizedlist>
</para>
<para>
The <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget can be used with or without any associated <link linkend="GdaGraph"><type>GdaGraph</type></link> object.
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GnomeDbCanvas-struct"/>struct GnomeDbCanvas</title>
<indexterm><primary>GnomeDbCanvas</primary></indexterm><programlisting>struct GnomeDbCanvas;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GnomeDbCanvasClass"/>struct GnomeDbCanvasClass</title>
<indexterm><primary>GnomeDbCanvasClass</primary></indexterm><programlisting>struct GnomeDbCanvasClass {

	GooCanvasClass      parent_class;

	/* virtual functions */
	void           (*create_canvas_items) (GnomeDbCanvas *canvas); /* create individual GnomeDbCanvasItem objects */
	void           (*clean_canvas_items)  (GnomeDbCanvas *canvas); /* clean any extra structure, not the individual items */

	void           (*graph_item_added)    (GnomeDbCanvas *canvas, GnomeDbGraphItem *item);
	void           (*graph_item_dropped)  (GnomeDbCanvas *canvas, GnomeDbGraphItem *item);

	GtkWidget     *(*build_context_menu)  (GnomeDbCanvas *canvas);

	/* signals */
	void           (*drag_action)        (GnomeDbCanvas *canvas, GnomeDbCanvasItem *from_item, GnomeDbCanvasItem *to_item);
};
</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-get-graph"/>gnome_db_canvas_get_graph ()</title>
<indexterm><primary>gnome_db_canvas_get_graph</primary></indexterm><programlisting><link linkend="GnomeDbGraph">GnomeDbGraph</link>* gnome_db_canvas_get_graph     (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-set-in-scrolled-window"/>gnome_db_canvas_set_in_scrolled_window ()</title>
<indexterm><primary>gnome_db_canvas_set_in_scrolled_window</primary></indexterm><programlisting><link linkend="GtkWidget">GtkWidget</link>*  gnome_db_canvas_set_in_scrolled_window
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>
Creates a new <link linkend="GtkScrolledWindow"><type>GtkScrolledWindow</type></link> object and put <parameter>canvas</parameter>
in it. <parameter>canvas</parameter> can be retrieved using a "canvas" user property of
the new scrolled window.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the new scrolled window.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-declare-item"/>gnome_db_canvas_declare_item ()</title>
<indexterm><primary>gnome_db_canvas_declare_item</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_canvas_declare_item    (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="GnomeDbCanvasItem">GnomeDbCanvasItem</link> *item);</programlisting>
<para>
Declares <parameter>item</parameter> to be listed by <parameter>canvas</parameter> as one of its items.
This functions should be called after each <link linkend="GnomeDbCanvasItem"><type>GnomeDbCanvasItem</type></link> is added to
<parameter>canvas</parameter>.
</para>
<para>
If it was not called for one item, then that item won't be used
in <parameter>canvas</parameter>'s computations (no drag and drop, cleanup, etc).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>item</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvasItem"><type>GnomeDbCanvasItem</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-set-zoom-factor"/>gnome_db_canvas_set_zoom_factor ()</title>
<indexterm><primary>gnome_db_canvas_set_zoom_factor</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_canvas_set_zoom_factor (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="gdouble">gdouble</link> n);</programlisting>
<para>
Sets the zooming factor of a canvas by specifying the number of pixels that correspond 
to one canvas unit. A zoom factor of 1.0 is the default value; greater than 1.0 makes a zoom in
and lower than 1.0 makes a zoom out.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> the zoom factor
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-get-zoom-factor"/>gnome_db_canvas_get_zoom_factor ()</title>
<indexterm><primary>gnome_db_canvas_get_zoom_factor</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link>     gnome_db_canvas_get_zoom_factor (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>
Get the current zooming factor of a canvas.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the zooming factor.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-fit-zoom-factor"/>gnome_db_canvas_fit_zoom_factor ()</title>
<indexterm><primary>gnome_db_canvas_fit_zoom_factor</primary></indexterm><programlisting><link linkend="gdouble">gdouble</link>     gnome_db_canvas_fit_zoom_factor (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>
Compute and set the correct zoom factor so that all the items on <parameter>canvas</parameter> can be displayed
at once.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the new zooming factor.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-auto-layout-enabled"/>gnome_db_canvas_auto_layout_enabled ()</title>
<indexterm><primary>gnome_db_canvas_auto_layout_enabled</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>    gnome_db_canvas_auto_layout_enabled
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>
Tells if <parameter>canvas</parameter> has the possibility to automatically adjust its layout
using the GraphViz library.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE if <parameter>canvas</parameter> can automatically adjust its layout
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-perform-auto-layout"/>gnome_db_canvas_perform_auto_layout ()</title>
<indexterm><primary>gnome_db_canvas_perform_auto_layout</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_canvas_perform_auto_layout
                                            (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas,
                                             <link linkend="gboolean">gboolean</link> animate,
                                             <link linkend="GnomeDbCanvasLayoutAlgorithm">GnomeDbCanvasLayoutAlgorithm</link> algorithm);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>animate</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>algorithm</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-db-canvas-center"/>gnome_db_canvas_center ()</title>
<indexterm><primary>gnome_db_canvas_center</primary></indexterm><programlisting><link linkend="void">void</link>        gnome_db_canvas_center          (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *canvas);</programlisting>
<para>
Centers the display on the layout</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>canvas</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GnomeDbCanvas"><type>GnomeDbCanvas</type></link> widget
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GnomeDbCanvas--graph"/>&quot;<literal>graph</literal>&quot; (<link linkend="GnomeDbGraph">GnomeDbGraph</link> : Read / Write)</term>
<listitem>
<para></para>
</listitem></varlistentry>

</variablelist>
</refsect1>

<refsect1>
<title>Signals</title>
<refsect2><title><anchor id="GnomeDbCanvas-drag-action"/>The &quot;drag-action&quot; signal</title>
<programlisting><link linkend="void">void</link>        user_function                  (<link linkend="GnomeDbCanvas">GnomeDbCanvas</link> *dbcanvas,
                                            <link linkend="gpointer">gpointer</link> arg1,
                                            <link linkend="gpointer">gpointer</link> arg2,
                                            <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>dbcanvas</parameter>&nbsp;:</term>
<listitem><simpara>the object which received the signal.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>arg1</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>arg2</parameter>&nbsp;:</term>
<listitem><simpara>

</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>



</refentry>
