|
@@ -13,10 +13,15 @@ class Glade_Window
|
|
* a top-level object if this is loaded
|
|
* a top-level object if this is loaded
|
|
* within another UI
|
|
* within another UI
|
|
*
|
|
*
|
|
- * @var unknown_type
|
|
|
|
|
|
+ * @var GtkWidget
|
|
*/
|
|
*/
|
|
public $top;
|
|
public $top;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @var GladeXML
|
|
|
|
+ */
|
|
|
|
+ protected $glade;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Load the fixed structure for the actual class invoking the constructor
|
|
* Load the fixed structure for the actual class invoking the constructor
|
|
*
|
|
*
|
|
@@ -28,9 +33,9 @@ class Glade_Window
|
|
$uiDescriptionFileName = get_class($this) . '.glade';
|
|
$uiDescriptionFileName = get_class($this) . '.glade';
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- $glade = new GladeXML($uiDescriptionFileName);
|
|
|
|
- $glade->signal_autoconnect_instance($this);
|
|
|
|
- $this->win = $glade->get_widget('winPgma');
|
|
|
|
|
|
+ $this->glade = new GladeXML($uiDescriptionFileName);
|
|
|
|
+ $this->glade->signal_autoconnect_instance($this);
|
|
|
|
+ $this->top = $this->glade->get_widget($topName);
|
|
}
|
|
}
|
|
catch (Exception $e)
|
|
catch (Exception $e)
|
|
{
|
|
{
|
|
@@ -46,5 +51,20 @@ class Glade_Window
|
|
{
|
|
{
|
|
Gtk::main_quit();
|
|
Gtk::main_quit();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * A utility callback for views inherited from this class: it
|
|
|
|
+ * enables automatic alternate row colors
|
|
|
|
+ *
|
|
|
|
+ * @param GtkCellLayout $cell_layout
|
|
|
|
+ * @param GtkCellRenderer $cell
|
|
|
|
+ * @param GtkTreeModel $tree_model
|
|
|
|
+ * @param GtkTreeIter $iter
|
|
|
|
+ * @return void
|
|
|
|
+ */
|
|
|
|
+ static public function zebraTreeViewCallback(GtkCellLayout $cell_layout, GtkCellRenderer $cell, GtkTreeModel $tree_model, GtkTreeIter $iter /* [, user_data] */)
|
|
|
|
+ {
|
|
|
|
+ $path = $tree_model->get_path($iter);
|
|
|
|
+ $cell->set_property('cell-background', ($path[0] % 2) ?'#d0d0d0' : '#ffffff');
|
|
|
|
+ }
|
|
}
|
|
}
|