Esempio n. 1
0
 function killwindow(&$window, &$class)
 {
     if ($class) {
         $class->quit();
     } else {
         $window->destroy();
     }
     gtk::main_quit();
 }
Esempio n. 2
0
function callback($data)
{
    static $i = 0;
    if ($i < 1000) {
        $i++;
        echo "callback called\n";
        return TRUE;
    } else {
        echo "callback finished, data was: {$data}\n";
        gtk::main_quit();
    }
}
Esempio n. 3
0
    return true;
}
function draw_brush($widget, $x, $y)
{
    global $pixmap;
    gdk::draw_arc($pixmap, $widget->style->black_gc, true, $x - 4, $y - 4, 8, 8, 0, 64 * 360);
    $widget->draw(new GdkRectangle($x - 4, $y - 4, 8, 8));
}
$window =& new GtkWindow();
$window->set_name('Test Input');
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$vbox =& new GtkVBox();
$window->add($vbox);
$vbox->show();
$drawing_area =& new GtkDrawingArea();
$drawing_area->size(300, 300);
$vbox->pack_start($drawing_area);
$drawing_area->show();
$drawing_area->connect('expose_event', 'expose_event');
$drawing_area->connect('configure_event', 'configure_event');
$drawing_area->connect('motion_notify_event', 'motion_notify_event');
$drawing_area->connect('button_press_event', 'button_press_event');
$drawing_area->set_events(GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
$button =& new GtkButton('Quit');
$vbox->pack_start($button, false, false);
$button->connect_object('clicked', array($window, 'destroy'));
$button->show();
$window->show();
gtk::main();
Esempio n. 4
0
function shutdown()
{
    print "Shutting down...\n";
    gtk::main_quit();
}
Esempio n. 5
0
 /**
  * Start the main gtk loop.
  *
  * main() first sets the default state of the showPassed
  * check box. Next all widgets that are part of the GUI
  * are shown. Finally the main gtk loop is started.
  *
  * @access public
  * @param  boolean $showPassed
  * @return void
  */
 function main($showPassed = true)
 {
     $this->showPassed->set_active($showPassed);
     $this->gui->show_all();
     gtk::main();
 }
 /**
  * Begin scrolling the text from the current character position.
  * Work horse for startScroll.  Usually connected to an event.
  *
  * unPause() does pretty much the same thing as startScroll 
  * except that it does not manipulate the current character
  * position.  When you unpause the scroll, the text continues
  * from where it left off when it was paused.
  *
  * This method is best used when conneted to an event.
  *
  * @access public
  * @param  none
  * @return boolean true if the scrolling has started.
  * @see    setUnPauseSignal
  */
 function unPause()
 {
     // Pretty much just like start but without resetting the postion.
     // First check to see if there is a timeout already started.
     if (isset($this->gtkTimeoutTag)) {
         // Throw error about scroll already started.
         $this->_error('Cannot unpause. Text not scrolling.', GTK_SCROLLINGLABEL_DEFAULT_ERROR, PEAR_ERROR_PRINT);
         return false;
     } elseif (!isset($this->speed)) {
         // Throw error about no value for speed.
         return $this->_error('Cannot unpause. No speed set.');
     } else {
         // Start the scrolling.
         $this->gtkTimeoutTag =& gtk::timeout_add($this->speed, array(&$this, '_scrollLabel'));
     }
     // Give back the timeout tag.
     return $this->gtkTimeoutTag;
 }
Esempio n. 7
0
function on_exit_clicked($button)
{
    /* exit the main loop */
    gtk::main_quit();
}
Esempio n. 8
0
function event_watcher_down($event_watcher_enter_id, $event_watcher_leave_id)
{
    if ($event_watcher_enter_id) {
        $signal_id = Gtk::signal_lookup('enter_notify_event', GtkWidget::get_type());
        gtk::signal_remove_emission_hook($signal_id, $event_watcher_enter_id);
        $event_watcher_enter_id = 0;
        $signal_id = Gtk::signal_lookup('leave_notify_event', GtkWidget::get_type());
        gtk::signal_remove_emission_hook($signal_id, $event_watcher_leave_id);
        $event_watcher_leave_id = 0;
    }
}
Esempio n. 9
0
 function display()
 {
     $this->window->show_all();
     gtk::main();
 }
Esempio n. 10
0
function XMLparseFinElement($parser, $name)
{
    global $Xlasthandler, $Xw, $Xpath, $Xoptions, $Xn, $Yn, $Xparent, $Xcontainer, $Yc;
    if ($name == 'SCRIPT') {
        $Xstring .= $Xlasthandler . '</script>';
    }
    if ($name == 'CODE') {
        if ($Xtemp[CODE]) {
        }
    }
    if ($name == 'HBOX') {
        $Yc--;
    }
    if ($name == 'VBOX') {
        $Yc--;
    }
    if ($name == 'FRAME') {
        $Yc--;
    }
    if ($name == 'TBOX') {
    }
    if ($name == 'TR') {
    }
    if ($name == 'TD') {
    }
    if ($name == 'LAYER') {
    }
    if ($name == 'NOTEBOOK') {
    }
    if ($name == 'PAGE') {
    }
    if ($name == 'LABEL') {
    }
    if ($name == 'ENTRY') {
    }
    if ($name == 'TEXT') {
    }
    if ($name == 'HIDDEN') {
    }
    if ($name == 'SPIN') {
    }
    if ($name == 'BUTTON') {
        $Xn[BUTTON]++;
        if (!$Xoptions[NAME]) {
            $Xoptions[NAME] = 'button' . $Xn[BUTTON];
        }
        $Xparent[$Yn] =& new GtkButton($Xlasthandler);
        $Yw[$Xoptions[NAME]] = $Yn;
        $Xoptions[ONCLICK] = str_replace("'", "\\'", $Xoptions[ONCLICK]);
        if ($Xoptions[ACTIVE] == '0') {
            $Xparent[$Yn]->set_sensitive(0);
        }
        $Xcontainer[$Yc]->pack_start($Xparent[$Yn], 0, 0);
        //$Xoptions[NAME],$Xlasthandler,$Xoptions[IMAGE],$Xoptions[ONCLICK],$Xoptions[VALUE],$Xoptions[ACTIVE], $Xoptions[WIDTH]).XmindBetweenBox($Xtemp,$Xbox);
    }
    if ($name == 'TOGGLE') {
    }
    if ($name == 'CHECKBOX') {
    }
    if ($name == 'RADIO') {
    }
    if ($name == 'PROGRESSBAR') {
    }
    if ($name == 'IMAGE') {
    }
    if ($name == 'DRAWINGAREA') {
    }
    if ($name == 'CLIST') {
    }
    if ($name == 'OPTION') {
    }
    if ($name == 'XMIND') {
        $Xparent[0]->show_all();
        gtk::main();
    }
}
Esempio n. 11
0
 /**
  * Checks to see if the file has been saved before destroying the
  * main window.
  * 
  * The user should save their file before the application closes.
  * If they have not, they will be prompted to save or close any
  * way.
  *
  * This method will also kill the main gtk loop if told to. If 
  * this class is imbedded in another class, you probably don't
  * want to do that. Pass false to the constructor to prevent 
  * this from happening.
  *
  * @param  boolean $killMainLoop
  * @return void
  * @access public
  */
 function checkBeforeQuit($killMainLoop)
 {
     // Check to see if the file was saved.
     if (!$this->saved) {
         // Prompt the user with a GtkDialog window.
         $dialog =& new GtkDialog();
         $vBox = $dialog->vbox;
         $vBox->pack_start(new GtkLabel('Your package file has not been saved.' . ' Would you like to save it now?'));
         $dialog->show_all();
         gtk::main();
     }
     // Kill the main loop if requested.
     if ($killMainLoop) {
         return gtk::main_quit();
     } else {
         return true;
     }
 }
Esempio n. 12
0
function destroy($window)
{
    gtk::main_quit();
}
Esempio n. 13
0
	/** Refreshes all the Gtk2-widgets if the thread is locked (by while, for, foreach or whatever). */
	function gtk2_refresh(){
		while(gtk::events_pending()){
			gtk::main_iteration();
		}
	}
Esempio n. 14
0
function DoIteration()
{
    while (gtk::events_pending()) {
        gtk::main_iteration();
    }
}