Using the treeview gadget (together with core hotlist/history/cookies/sslcert)

Providing front end specific bits

Most of the treeview logic is located in core code but there still are some functions that need implementing on the front end side. These include:

  • Functions marked as front end specific ones and listed at the end of


  • Functions in treeview_table located in tree.h

Additionally the option_tree_icons_dir option should be set. It should be pointing at the directory containing the frontend specific icon set for the treeview.

During GUI initialisation the following functions should be called:

  • cookies_initialise
  • history_global_initialise
  • hotlist_initialise
  • sslcert_init

On GUI closure:

  • cookies_cleanup
  • history_global_cleanup
  • hotlist_cleanup
  • no function for sslcert here!

The sslcert tree is created and deleted each time the dialog gets invoked. This is done with sslcert_create_tree and sslcert_cleanup. Make sure that closing the window with any other method will also perform the cleanup.

The remaining functions in the header files of hotlist/history/cookies/sslcert have to be connected to the front end specific buttons and menu or tool bars.

The front end is responsible for creating the windows and toolbars as well as empty core trees passed to the cookies/history/hotlist/sslcert initialisation functions. Use the *_get_tree_flags functions to obtain the flags with which the particular tree should be created.

Using the treeview

Creating and modifying the tree structure

  • Create an empty tree with tree_create.
  • Create the necessary folder/leave nodes.
  • Fill the leave nodes with tree_create_node_element and assign content to the elements with tree_update_node_element.
  • Use tree_link_node to connect the created nodes in the required structure.
  • With tree_set_redraw set the redraw flag on the tree to true, any further changes will result in tree redraws. The flag can be set/unset multiple times.
  • Call tree_draw to draw the tree for the first time.

Client -> Tree communication

To make the tree respond to mouse action, all such has to be passed to tree_mouse_action and tree_drag_end. The mouse coordinates have to be given with respect to the tree origin.

Tree -> Client communication

Use tree_set_node_user_callback to provide a callback for any node related events. At the moment it can be used for(default behavior for a not handled event in brackets):