PHP-GTK
Thursday, September 18, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previoustext-pushed
GtkStatusIcon Constructornext

Last updated: Sun, 12 May 2013
view this page in English

GtkStatusIcon

GtkStatusIcon is used for displaying an icon in the system tray.

Object Hierarchy

Description

GtkStatusIcon is used for displaying an icon in the system tray. The system tray is generally used to indicate some special state that a user would be interested in.

A GtkStatusIcon object can be assigned a tooltip, handle "activate" and "popup-menu" signals, set to blink, and set invisible. All of these states and settings can help the user more easily identify the type of notification being displayed to them.

Example 116. Simple Tray Application

<?php
 
  class TrayApplication {
   /**
    * Application Tray Menu
    *
    * @var GtkMenu
    */
   protected $_menu;
   /**
    * Application Tray Icon
    *
    * @var GtkStatusIcon
    */
   protected $_tray;
   /**
    * Application Constructor
    *
    * @param string $tooltip Tooltip to display for GtkStatusIcon object
    * @return void
    */
    public function __construct($tooltip) {
      $this->_menu = new GtkMenu();
      $this->_tray = new GtkStatusIcon();
      $this->_tray->set_tooltip($tooltip);
      $this->_tray->set_from_stock(Gtk::STOCK_EXECUTE);
      $this->_tray->connect('popup-menu', array($this, 'onMenu'));
 
      $quit = new GtkMenuItem('Quit');
      $quit->connect('activate', array($this, 'onQuit'));
      $this->_menu->append($quit);
      $this->_menu->show_all();
 
      $this->_tray->set_visible(true);
      $this->_tray->set_blinking(false);
 
      GtkStatusIcon::position_menu($this->_menu, $this->_tray);
 
      Gtk::main();
    }
    /**
     * Application Destructor
     *
     * @return void
     */
    public function __destruct() {
      Gtk::main_quit();
    }
    /**
     * Event handler for onQuit
     *
     * @return void
     */
    public function onQuit() {
      $this->__destruct();
    }
    /**
     * Event handler for onMenu
     *
     * @return void
     */
    public function onMenu() {
      $this->_menu->popup();
    }
  }
 
  $app = new TrayApplication('GtkStatusIcon object');
 
?>

Constructors

-- Creates a new object.

-- Creates a new object using the supplied filepath.

-- Creates a new object using the supplied GdkPixbuf.

-- Creates a new object using the supplied stock_id.

Methods

is_embedded()
  Get embedded state of the object.
get_blinking()
  Get blinking state of the object.
get_pixbuf()
  Get GdkPixbuf icon image of the object.
get_size()
  Get image size of the object.
get_visible()
  Get visibility state of the object.
position_menu()
  Use to position a popup menu over the object.
set_blinking()
  Set blinking state of the object.
set_from_file()
  Set icon image of the object using the supplied filepath.
set_from_pixbuf()
  Set icon image of the object using the supplied GdkPixbuf.
set_from_stock()
  Set icon image of the object using the supplied stock_id.
set_tooltip()
  Set tooltip text of the object.
set_visible()
  Set visibility state of the object.

Signals

"activate"
  Signal emitted on a left mouse button click.
"popup-menu"
  Signal emitted on a right mouse button click.


User Contributed Notes
gtk.gtkstatusicon.php
add a note about notes
There are no user contributed notes for this page.


previoustext-pushed
GtkStatusIcon Constructornext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:00 2013 CEST