apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Gtk2_VarDump

Source Location: /Gtk2_VarDump-0.0.4/VarDump.php

Class Overview

GtkWindow
   |
   --Gtk2_VarDump

Simple class for viewing PHP variables a var_dump() way in PHP-Gtk - reloaded for PHP-Gtk2.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 43]
Simple class for viewing PHP variables a var_dump() way in PHP-Gtk - reloaded for PHP-Gtk2.

It displays arrays and objects in a tree with all their children and subchildren and subsubchildren and ...

The class is memory-saving as it loads only the children which are currently visible. If the user expands a row, the next children will be loaded.

The tree has a small convenience feature: Left-click a row, and it will be expanded. Right-click it, and it collapses. Double-click or middle-click it, and all rows below the current one will be expanded. They will be expanded "all" only if they have been expanded before, as loading them recursively is very dangerous (if there are loops).

Note that VarDump opens its own Gtk::main()-Loop, so your own program will stop executing until the VarDump window is closed.

Usage: require_once('Gtk2/VarDump.php'); $ar = new array(1, 2, 3, 4, 'key' => array('this','is','cool'); new Gtk2_VarDump($ar);

Layout: +--[Window title]------------------------------------------------+ |+--------------------------+/+---------------------------------+| || Node | Type ^\| Key | Type | Value ^| || |/| || || Left tree with objects |\| Right list with simple values || || and arrays |/| (int,float,string,...) || || v\| v| |+--------------------------+/+---------------------------------+| | [OK] | +----------------------------------------------------------------+



[ Top ]


Class Variables

$modTree =  null

[line 61]

Model (data store) for the tree on the left.
  • Access: protected

Type:   GtkTreeStore


[ Top ]

$modValues =  null

[line 67]

Model (data store) for the list on the right.
  • Access: protected

Type:   GtkListStore


[ Top ]

$trTree =  null

[line 49]

The tree on the left side of the window.
  • Access: protected

Type:   GtkTreeView


[ Top ]

$trValues =  null

[line 55]

List on the right side of the window.
  • Access: protected

Type:   GtkTreeView


[ Top ]



Method Detail

__construct (Constructor)   [line 79]

Gtk2_VarDump __construct( mixed $variable, [string $title = 'Gtk2_VarDump'])

Create a new Gtk2_VarDump window and keep it displayed in its own Gtk::main()-loop.

This main loop is stopped as soon the window is closed

  • Access: public

Parameters:

mixed   $variable   —  The variable to inspect
string   $title   —  The title for the window and the variable

[ Top ]

appendChildren   [line 225]

void appendChildren( mixed $variable, GtkTreeIter $node, [int $nStop = 1])

Appends all the children of the given variable to $node
  • Access: protected

Parameters:

mixed   $variable   —  The variable, whose children shall be appended
GtkTreeIter   $node   —  The parent node to which the new ones shall be appended
int   $nStop   —  After how many levels appending shall be stopped

[ Top ]

appendValue   [line 306]

void appendValue( mixed $key, mixed $value)

Appends one value to the list on the right.

Arrays and objects will not be displayed, as they already appear on the tree on the left side.

  • Access: protected

Parameters:

mixed   $key   —  The title for the node
mixed   $value   —  The value to display

[ Top ]

buildDialog   [line 96]

void buildDialog( string $title)

Creates the dialog content, loads the tree models and so
  • Access: protected

Parameters:

string   $title   —  The title for the window

[ Top ]

buildTree   [line 180]

void buildTree( mixed $variable, string $name, [GtkTreeIter $parent = null], [int $nStop = 1])

Appends the given $variable to the tree on the right.

$name is used as title for the node, $parent is the parent node to which the new node will be appended.

  • Access: protected

Parameters:

mixed   $variable   —  The variable to append
string   $name   —  The title for the variable (e.g. array key)
GtkTreeIter   $parent   —  The parent node to which the new node shall be appended
int   $nStop   —  After how many levels appending shall be stopped

[ Top ]

buildValues   [line 269]

void buildValues( mixed $variable)

Adds all the children of the given $variable to the list on the right side.

Arrays and objects are not added, as they appear on the tree on the left.

  • Access: protected

Parameters:

mixed   $variable   —  The variable whose children values shall be shown

[ Top ]

clickedTree   [line 399]

void clickedTree( GtkTreeView $tree, GdkEvent $event)

The tree has been clicked, and the currently selected row will be expanded or collapsed, depending which mouse button has been clicked.

The left mouse button will expand the node, the right mouse button will collapse it. Middle mouse button and a double-clicked left button will expand all children but *only* if they have been expanded before - it would be too dangerous to expand all children to any depth recursively if there are loops.

  • Access: public

Parameters:

GtkTreeView   $tree   —  The tree which has been clicked
GdkEvent   $event   —  The event data for the click event

[ Top ]

close   [line 427]

void close( )

Called when the user clicks "OK" or tries to close the window.

This function quits the main loop opened in the constructor.

  • Access: public

[ Top ]

createColumns   [line 157]

void createColumns( GtkTreeView $tree, array $arColumns)

Creates GtkTreeView columns out of an string array and appends them to the tree view.

The columns will be resizable and sortable.

  • Access: protected

Parameters:

GtkTreeView   $tree   —  The tree to which the columns shall be appended
array   $arColumns   —  Array of strings which are the titles for the columns

[ Top ]

expandTree   [line 344]

void expandTree( GtkTreeView $tree, GtkTreeIter $iterator)

Called whenever a tree row is expanded.

It is used to load the children of the node's children if they haven't been loaded yet.

  • Access: public

Parameters:

GtkTreeView   $tree   —  The tree on which the signal has been emitted
GtkTreeIter   $iterator   —  The node which has been expanded

[ Top ]

selectTreeRow   [line 373]

void selectTreeRow( array $selection)

Called whenever a row on the left tree has been selected.

It is used to show the children of the selected variable on the right list.

  • Access: public

Parameters:

array   $selection   —  Array consisting of the model and the currently selected node (GtkTreeIter)

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:32:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.