<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
     "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
  <bookinfo>
    <title>GdaBrowser hacking manual</title>
    <authorgroup>
      <author>
        <firstname>Vivien</firstname>
        <surname>Malerba</surname>
        <affiliation>
          <address><email>malerba@gnome-db.org</email></address>
        </affiliation>
	<contrib>Current maintainer
        </contrib>
      </author>
    </authorgroup>
    <date>Feb. 2011</date>
    <copyright>
      <year>2009 - 2011</year>
      <holder>The GNOME Foundation</holder>
    </copyright>
    <abstract>
      <para>
	Documentation to help improve and extend the GdaBrowser tool. All the objects and
	widgets used by GdaBrowser are not included in this documentation, in order to
	make it easier to understand; if you need them, go and look in the code.
      </para>
    </abstract>
    <legalnotice id="legalnotice">
      <para>
        Permission is granted to copy, distribute and/or modify this document
        under the terms of the <link linkend="fdl"><citetitle>GNU
        Free Documentation License</citetitle></link>, Version 1.1 or any later
        version published by the Free Software Foundation with no Invariant
        Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the
        license can be found in <link linkend="fdl">the appendix</link>.
      </para>
      <para>
        Many of the names used by companies to distinguish their products and
        services are claimed as trademarks. Where those names appear in any
        GNOME documentation, and those trademarks are made aware to the members
        of the GNOME Documentation Project, the names have been printed in caps
        or initial caps.
      </para>
    </legalnotice>
  </bookinfo>

  <part id="part_begin">
    <title>Getting started</title>
    <chapter id="why">
      <title>Purpose</title>
      <para>
	The purpose of this documentation is to provide reference material to anyone
	wishing to add some features to the Gda browser graphical tool.
      </para>
    </chapter>

    <chapter id="prog_struct">
      <title>Program's structure</title>
      <para>
	The GdaBrowser's structure is organized around the following parts:
	<itemizedlist>
	  <listitem><para>one or more connections, represented by
	      <link linkend="BrowserConnection">BrowserConnection</link> objects</para></listitem>
	  <listitem><para>one or more windows, represented by
	      <link linkend="BrowserWindow">BrowserWindow</link> objects. Each window uses exactly
	      one connection, and several windows using the same connection can be created</para></listitem>
	  <listitem><para>a single instance of a <link linkend="BrowserCore">BrowserCore</link> object which
	      holds all the global information of the browser, and manages connections and windows</para></listitem>
	  <listitem><para>Window can be used for diverse activities graphically represented by "perspectives", thus
	      each window can switch its display between various perspectives, identified by widgets
	      implementing the <link linkend="BrowserPerspective">BrowserPerspective</link> interface.</para></listitem>
	</itemizedlist>
      </para>
    </chapter>

    <chapter id="code_orga">
      <title>Code organization</title>
      <para>
	GdaBrowser's code is organized as follows,
	assuming <filename class="directory">$(top_srcdir)</filename> is Libgda's
	top source directory:
	<itemizedlist>
	  <listitem><para>All the code is in
	      <filename class="directory">$(top_srcdir)/tools/browser</filename></para></listitem>
	  <listitem><para>Some objects and functions are shared with LibgdaUi's own code which
	      is located in <filename class="directory">$(top_srcdir)/libgda-ui/internal</filename></para></listitem>
	  <listitem><para>All the main objects' code is in <filename class="directory">$(top_srcdir)/tools/browser</filename></para></listitem>
	  <listitem><para>the <filename class="directory">$(top_srcdir)/tools/browser/common</filename> directory holds some objects and widgets which are used throught GdaBrowser's code</para></listitem>
	  <listitem><para>the <filename class="directory">$(top_srcdir)/tools/browser/data</filename> directory contains all the small icons used inside GdaBrowser (at various sizes), while some more application oriented icons are in <filename class="directory">$(top_srcdir)/tools/browser</filename> </para></listitem>
	  <listitem><para>the help files are stored in the <filename class="directory">$(top_srcdir)/tools/browser/help</filename> directory (each sub directory corresponds to a translation, except for the <filename class="directory">C</filename> which is the english and reference one)</para></listitem>
	  <listitem>Each perspective's code is in the <filename class="directory">$(top_srcdir)/tools/browser/&lt;perspective name&gt;</filename> directory, with the <filename class="directory">$(top_srcdir)/tools/browser/dummy-perspective</filename> an example to implement a new perspective<para></para></listitem>
	  <listitem><para>The <filename class="directory">$(top_srcdir)/tools/browser/canvas</filename> directory contains widgets to do some drawings, compiled only if the GooCanvas library has been detected at configure time.</para></listitem>
	</itemizedlist>
      </para>
    </chapter>
  </part>  

  <part id="part_api">
    <title>API reference</title>

    <chapter id="core">
      <title>Core objects</title>
      <para>
	This section is a reference to all the core objects of the Gda browser,
	which can be used in any extension.
      </para>
      <xi:include href="xml/browser-core.xml"/>
      <xi:include href="xml/browser-connection.xml"/>
      <xi:include href="xml/browser-favorites.xml"/>
      <xi:include href="xml/support.xml"/>
    </chapter>

    <chapter id="windows">
      <title>Browser windows</title>
      <para>
	This section is a reference to all the widgets used in a browser top level window.
	The following picture shows such a window and how the widgets listed here are packed: the
	top level window beign a #BrowserWindow in which some #BrowserPerspective widgets are packed
	(along with a menubar and a statusbar). Each #BrowserPerspective widget packs some specific
	widgets and optionally some #BrowserPage widgets. The #BrowserPerspective and
	#BrowserPage are interfaces so no limitation is imposed on the widgets implementing them.
	<mediaobject>
        <imageobject role="html">
          <imagedata fileref="UILayout.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Typical Gda browser's top level window</phrase>
        </textobject>
      </mediaobject>
      </para>
      <xi:include href="xml/browser-window.xml"/>
      <xi:include href="xml/browser-perspective.xml"/>
      <xi:include href="xml/browser-page.xml"/>
    </chapter>

    <chapter id="extrawidgets">
      <title>Extra widgets</title>
      <para>
	This section is a reference to all the extra widgets used in the Gda browser,
	which can be used in any extension.
      </para>
      <xi:include href="xml/ui-formgrid.xml"/>
      <xi:include href="xml/gdaui-bar.xml"/>
      <xi:include href="xml/popup-container.xml"/>
    </chapter>

    <chapter id="perspectives">
      <title>Perspectives' objects</title>
      <para>
	This section is a reference to some of the existing perspectives and the associated
	widgets.
      </para>
      <xi:include href="xml/mgr-favorites.xml"/>
      <xi:include href="xml/schema-browser-perspective.xml"/>
      <xi:include href="xml/data-manager-perspective.xml"/>
      <xi:include href="xml/query-exec-perspective.xml"/>
    </chapter>
  </part>

  <part id="part_index">
    <title>Appendix</title>
      <xi:include href="fdl-appendix.sgml"/>
  </part>
</book>

