Re-using Gtk2_VarDump

Re-using Gtk2_VarDump -- Embedding it in own applications

Re-using Gtk2_VarDump

Gtk2_VarDump consists of two main parts: A tree on the left, displaying the structure of the variable-to-dump, and a list on the right side, showing the keys and their values. They are arranged on a pane, which itself is contained in the main window.

Now you might want to dump some variables yourself, but integrate this display directly into your own application - without opening a new window for that. Gtk2_VarDump is prepared for that; you can re-use the existing classes.

Gtk2_VarDump_Pane

Gtk2_VarDump_Pane is the container for both tree and list. You can use instantiate it, add it to your interface and call the setVariable() method to display the contents of the variable. The method takes the variable as first parameter, and a user-definable title as optional second parameter.

Gtk2_VarDump_Tree

Gtk2_VarDump_Tree is an descendant of GtkTreeView, and as usual without any scrollbars. Remember to add it to a GtkScrolledWindow. The class has, as Gtk2_VarDump_Pane does, a setVariable() method that takes the variable to be displayed and an optional title that is used for the root element.

The tree has another method: setList() is used to set the list widget that shall display the values. Be sure that the list widget also provides a setVariable() method. Whenever the selection in the tree changes, the list's setVariable() method is called.

Gtk2_VarDump_List

Gtk2_VarDump_List is a descendant of GtkTreeView and simply displays plain key-value pairs. It has, like the other two classes, a setVariable() method that takes the variable to display as first parameter, and an optional title as second parameter.

    Поддержать сайт на родительском проекте КГБ