php-library.com
 -Home
  
Documentation
-PHP Manual>
Table of contents
Copyright
Preface
Getting started
Language reference
Security
Features
Function reference
Zend API
PHP API:Interfaces for extension writers
FAQ
Appendixes

-Pear Manual>
Table of contents
Copyright
Preface
About this manual
Structure of manual
I) About PEAR
 1. Introduction
 2 Installation
 3 Support
 4 Coding standards
 5 Contributing
 6 FAQ
II) Developer Guide
 7 Introduction
 8 PEAR's meaning for developers
 9 Contributing your own code
 10 The package definition file package.xml
 11 Releasing a package
 12 Supporting PEAR development
III) Core components
 13 PEAR base classes
 14 PPM classes
IV) Packages
 15 Authentication
 16 Benchmarking
 17 Caching
 18 Configuration
 19 Console
 20 Database
 21 Date & time
 22 Encryption
 23 File formats
 24 File System
 25 HTML
 26 HTTP
 27 Images
 28 Logging
 29 Mail
 30 Math
 31 Networking
 32 Numbers
 33 Payment
 34 PEAR
 35 PHP
 36 Science
 37 System
 38 Text
 39 XML
V) PECL packages
 I. Advance PHP debugger
 II. PHP bytecode compiler
 III. Imagick
 IV. KADM5
 V. Radius
 VI. Paradox file access
 VII. Satellite CORBA client extention
 VIII. PostgreSQL session save handler
 IX. Soap
 X. SPPLUS payment system
 XI. Net_Gopher
 XII. oggvorbis

-PHP-GTK Manual>
Table of contents
Copyright
Preface
PHP-GTK userguide
I) Introduction to PHP-GTK
 1. What is PHP-GTK?
 2. What is PHP?
 3. What is GTK+?
 4. Acknowledgements
II) Getting started
 1. Getting the lastest version
 2. Installing PHP-GTK under Windows
 3. Installing PHP-GTK under Unix
 4. How to use PHP-GTK
III) Basic elements
 1. Widgets & containers
 2. Signals & callbacks
PHP-GTK tutorials
I) Hello world tutorial
PHP-GTK reference
I) GTK classes
II) GDK clasesse
III) GTK enums
IV) GDK enums
V) Glade classes
VI) Scintilla classes
Appendix
I) PHP-GTK credits
II) PHP-GTK documentation credits
III) GNU free documentation license
IV) Symbolic names for keys in PHP-GTK
 
More stuff here
 -Contact Us
 -Links
 -
Sitemap
 
 
 
 

GTK Signals, GDK Events.

Signals are not events, and events are not signals. A signal is a message emitted by an instance of a GtkObject in response to some predetermined element in its environment, e.g. an action by the end user, or an instruction from a function or method. Signals are always programmed into the code, either internally within GTK or externally by the PHP-GTK programmer.

Events, on the other hand, are a continual stream of impulses communicating messages concerning environmental changes in the underlying windowing system. The GTK main loop is made up of this stream of events, among other things.

It is not possible to connect a callback function to a GdkEvent directly.

Any widget having its own GdkWindow may capture events that are relevant to it. Widgets lacking a GdkWindow - those created with the GTK_NO_WINDOW flag - cannot do so, unless they are housed within a GtkEventBox - a widget created for this specific purpose. There are occasions when it is useful to be able to capture events; one obvious example would be the creation of an instance of GtkToolTips which is triggered when its subject widget captures the GDK_ENTER_NOTIFY event and destroyed when the same widget captures the GDK_LEAVE_NOTIFY event.

Although it is not possible to use an event to trigger a callback in the same way as a signal, there are a series of signals derived from GtkWidget collectively known as 'event' signals. These are effectively ways of describing an event in terms of a signal, allowing callbacks to be indirectly triggered through a captured occurrence of most of the GdkEventTypes. The GtkTooltips object itself uses the connect_object method and the generic "event" signal in order to monitor its subject widget.

The concept of events is not an easy one to grasp. Please copy, paste and run the following script in order to see the flow of events over a widget in action.

Example 2.8. Demonstration of the flow of events across a GtkButton

<?php

dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" : 
"so")) ||
die("Can't load php_gtk module!\n");

function show_event_type($button, $event, $text) 
{
    $event_type = $event->type;
    $insert = $text->get_length();
    $text->freeze();
    switch($event_type) {
      case 2:
        $text->insert_text("GDK_EXPOSE\n", $insert);
      break;
      case 3:
        $text->insert_text("GDK_MOTION_NOTIFY\n", $insert);
      break;
      case 4:
        $text->insert_text("GDK_BUTTON_PRESS\n", $insert);
      break;
      case 5:
        $text->insert_text("GDK_2BUTTON_PRESS\n", $insert);
        $button->hide();
      break;
      case 7:
        $text->insert_text("GDK_BUTTON_RELEASE\n", $insert);
      break;
      case 8:
        $text->insert_text("GDK_KEY_PRESS\n", $insert);
      break;
      case 9:
        $text->insert_text("GDK_KEY_RELEASE\n", $insert);
      break;
      case 10:
        $text->insert_text("GDK_ENTER_NOTIFY\n", $insert);
      break;
      case 11:
        $text->insert_text("GDK_LEAVE_NOTIFY\n", $insert);
      break;
      case 12:
        $text->insert_text("GDK_FOCUS_CHANGE\n", $insert); 
      break;
      case 14:
        $text->insert_text("GDK_MAP\n", $insert);
      break;
      case 15:
        $text->insert_text("GDK_UNMAP\n", $insert);
        $button->destroy();
        $text->insert_text(
"\n* GDK EVENTS AND GTK SIGNALS - background stream vs foreground 
messaging *
\n
* Most GdkEventTypes have counterpart GTK signals, known as 'event'
  signals, implemented in GtkWidget.  The types on your screen are there
  because the GtkButton was programmed to emit the generic 'event' signal
  each time it captured one of the stream of GDK events that makes up the
  GTK main loop.  In each case, the captured GdkEvent was passed as a
  callback parameter so that its enumerated type value could be determined
  within the signal handler function.  Scroll down to see the series of event
  values captured during your recent interaction with the GtkButton widget. *
\n
* Please note that the majority of GTK signals do NOT correspond to GDK
  events in this or any other way!  For example, the signal connection
                      \$button->connect('pressed', 'whatever');
  has no relationship to the GDK_BUTTON_PRESS event it generates, which
  refers to mouse-button activity and not to the GtkButton 'pressed' signal. *
\n", 0);
      break;
    }
    $text->thaw();
    return false;
}

$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->set_default_size((gdk::screen_width()/1.5), 
(gdk::screen_height()-20));
$window->connect_object("destroy", array("gtk", 
"main_quit"));
$window->realize();

$box = &new GtkVBox(false, 5);
$window->add($box);
$scrlwin = &new GtkScrolledWindow();
$box->pack_start($scrlwin, true, true, 0);
$text = &new GtkText();
$scrlwin->add($text);

$button = &new GtkButton("Double-click here for information..");
$button->add_events(GDK_ALL_EVENTS_MASK);
$button->connect("event", "show_event_type", $text);
$box->pack_end($button, false, false, 5);

$window->show_all();

gtk::main();

?>

 
Network Sites
Domain registration : Register domain name from $5.95
Domain name registration or transfer domain name from $5.95/yr. Includes comprehensive free services such as URL/Email forwarding.
Website hosting : cheap web hosting from $8.95
Website hosting service for single or multiple domain names for as low as $2 per domain.
Cheap domain name registration by cheap domain registrar
Domain name registration and transfer service by Cheap Domain Name Registrar.

 


www.PHP-library.com