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

Source for file big_example.php

Documentation is available at big_example.php

  1. <?php
  2. /**
  3. *   Bigger test application for Gtk_FileDrop class
  4. *   Uses different MIME Types and file extensions
  5. *   as well as callbacks with objects
  6. *
  7. *   @author Christian Weiske <cweiske@cweiske.de>
  8. */
  9. if (!extension_loaded('gtk')) {    
  10.     dl('php_gtk.' . PHP_SHLIB_SUFFIX);
  11. }
  12. require_once('Gtk/FileDrop.php');
  13.  
  14. class Test 
  15. {
  16.     var $te 'asd';
  17.     function Test({
  18.         $this->te time();
  19.     }
  20.     function tryout($widget$arFiles)
  21.     {
  22.         echo $this->te ' test';
  23.         var_dump(get_class($widget)$arFiles);
  24.     }
  25. }
  26.  
  27. $window &new GtkWindow();
  28. $window->set_default_size(300300);
  29. $window->connect_object('destroy'array('gtk''main_quit'));
  30. $window->show();
  31.  
  32. $table =new GtkTable();
  33. $window->add($table);
  34. $arTypes = array(
  35.     array('inode/directory'),
  36.     array('.txt''.htm''.html'),
  37.     array('image/*'),
  38.     array('image/png'),
  39.     array('.scott')
  40. );
  41.  
  42. $nCount = 0;
  43. foreach ($arTypes as $arTypeList{
  44.     $label =new GtkLabel(implode';'$arTypeList));
  45.     $table->attach($label01$nCount$nCount + 1GTK_FILLGTK_FILL);
  46.     
  47.     $entry =new GtkButton('drop on me');
  48.     $table->attach($entry12$nCount$nCount + 1GTK_EXPAND | GTK_FILLGTK_FILL);
  49.     
  50.     Gtk_FileDrop::attach($entry$arTypeList);
  51.     
  52.     $nCount++;
  53. }
  54.  
  55. $list =new GtkList();
  56. $table->attach($list03$nCount$nCount + 1GTK_EXPAND | GTK_FILLGTK_EXPAND | GTK_FILL);
  57. Gtk_FileDrop::attach($listarray'text/*'));
  58. $nCount++;
  59.  
  60. $fs =new GtkFileSelection('select a php file');
  61. Gtk_FileDrop::attach($fsarray'text/php''.php''inode/directory'));
  62. $fs->show();
  63.  
  64. $cmb =new GtkCombo();
  65. $table->attach($cmb03$nCount$nCount + 1GTK_FILLGTK_FILL);
  66. $test = new Test();
  67. Gtk_FileDrop::attach($cmbarray'text/plain')array&$test'tryout')false);
  68.  
  69. $test->te = 'asd';
  70. $window->show_all();
  71. gtk::main();
  72. ?>

Documentation generated on Mon, 11 Mar 2019 15:40:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.