BaobabTreeMap

BaobabTreeMap -- A graphical treemap widget

treemap

Synopsis

#include <baobab-tree-map.h>


BaobabTreeMap;
BaobabTreeMap* baobab_tree_map_new (void);
void baobab_tree_map_draw (BaobabTreeMap *tm,
GtkTreeModel *model,
GtkTreePath *path,
gint nNameCol,
gint nSizeCol,
gint required_depth);

void baobab_tree_map_clear (BaobabTreeMap *tm);

gint baobab_tree_map get_total_elements (BaobabTreeMap *tm);


void baobab_tree_map_set_zoom (BaobabTreeMap *tm,
gdouble new_zoom);

gdouble baobab_tree_map_get_zoom (BaobabTreeMap *tm);

GdkPixbuf* baobab_tree_map_get_pixbuf (BaobabTreeMap *tm);
 
void baobab_tree_map_refresh (BaobabTreeMap *tm,
gint new_depth);

const gchar* baobab_tree_map_get_selected_item_name (BaobabTreeMap *tm);



Object Hierarchy

  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkLayout
                           +----GnomeCanvas
+----BaobabTreeMap  

Signals


Description

The BaobabTreeMap is a widget for representing hierarchical data structure as a graphical treemap at any nesting level. The depth of nesting level can be set or it can be left as "unlimited". BaobabTreeMap inherits an anti-aliased GnomeCanvas in order to produce high level images that can be zoomed in/out as far as exported in an image file.

To create a new BaobabTreeMap widget call baobab_tree_map_new() . To draw the data-structure, just call baobab_tree_map_draw() with all required settings.

Each item in a BaobabTreeMap widget has a tooltip that shows the related data name, while the rectangular area represents data size element.


Details


BaobabTreeMap


typedef struct _BaobabTreeMap BaobabTreeMap;

This should not be accessed directly. Use the accessor functions as described below.



baobab_tree_map_new ()

BaobabTreeMap*  baobab_tree_map_new                (void);

Creates a new empty treemap.

Returns : A newly-created treemap.

baobab_tree_map_draw ()

void    baobab_tree_map_draw             (BaobabTreeMap *tm,
GtkTreeModel *model,
GkTreePath *path,
gint nNameCol,
gint nSizeCol,
gint required_depth);

Draws a treemap on related data structure.

tm : A BaobabTreeMap
model : The GtkTreeModel where data-source is stored.
path : The path of the first item to draw.
nNameCol : Column index of the name in the data model .
nSizeCol : Column index of the size in the data model.
required_depth : Required nesting level to draw (-1 = unlimited)

baobab_tree_map_clear()

void baobab_tree_map_clear         (BaobabTreeMap *tm);

Clears the treemap and destroys all allocated objects.

tm : A treemap.


baobab_tree_map_get_total_elements()


gint        baobab_tree_map_get_total_elements   (BaobabTreeMap *tm);

Returns the number of total elements drawn in the canvas.

tm : A treemap.
Returns : A gint containing the number of total elements drawn


baobab_tree_map_set_zoom()


void       	baobab_tree_map_set_zoom	  (BaobabTreeMap *tm,
gdouble new_zoom);

Sets the zooming factor of the image.

tm : A treemap.
new_zoom : The new zooming factor. 
(new_zoom = 1.0 => 100%)


baobab_tree_map_get_zoom()


gdouble        baobab_tree_map_get_zoom		(BaobabTreeMap *tm);

Return current zooming factor.

tm : A treemap.
Returns : The current zooming factor (returs 1.0 for 100% zoom


baobab_tree_map_get_pixbuf()


GdkPixbuf*      baobab_tree_map_get_pixbuf 	(BaobabTreeMap *tm);

Returns a GdkPixbuf* to the current drawing. Returns NULL if failed. The returned pointer must be then unreferenced with g_object_unref().

tm : A treemap.
Returns : A GdkPixbuf* to the current drawing.


baobab_tree_map_refresh()


void       baobab_tree_map_refresh 	(BaobabTreeMap *tm,
gint new_depth);
Redraws the treemap recursing until new_depth level. If new_depth == -1 the full treemap is drawn.

tm : A treemap.
new_depth : The requested depth level of recursion. If -1, all the treemap is drawn


baobab_tree_map_get_selected_item_name()


const gchar*    baobab_tree_map_get_selected_item_name  (BaobabTreeMap *tm);
Returns a constant pointer to the selected item name. The selected item is retrieved after a left or right mouse-click on the treemap. The name is the one displayed in the tooltip (corresponding to the nNameCol of the GtkTreeModel drawn. See baobab_tree_map_draw() ).

tm : A treemap.
Returns : The selected item name.