├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── src ├── Atk.php ├── Builtin.php ├── DefineValue.php ├── FFI.php ├── GLib.php ├── GObject.php ├── Gdk.php ├── Gio.php ├── Gtk.php ├── GtkAbstract.php ├── GtkEnum.php ├── GtkWidget.php ├── PHPGtk.php ├── Pango.php ├── PangoCairo.php ├── Pixbuf.php └── include │ ├── atk.h │ ├── gdk.h │ ├── gio.h │ ├── glib.h │ ├── gobject.h │ ├── gtkfunc.h │ ├── gtype.h │ ├── pango.h │ ├── pango_cairo.h │ ├── pixbuf.h │ └── struct.h └── tests ├── basics.php ├── buildinterface.php ├── buildinterface.ui ├── devtest.php ├── helloword.php ├── load.php ├── mainloop.php ├── packing.php ├── version.php └── widget.php /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | /nbproject/private/ 3 | /nbproject 4 | /vendor 5 | composer.lock 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The php-epoll is free software. It is released under the terms of the following BSD License. 2 | 3 | Copyright © 2019 by Szopen Xiao (xiao@toknot.com) All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | Neither the name of Szopen Xiao nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## php-gtk 2 | PHP bindings to the [gtk+3](https://www.gtk.org/) C library. 3 | 4 | The project only expose GTK API by FFI 5 | 6 | **Requirements** 7 | * PHP >= 7.4 8 | * PHP FFI extension available 9 | * toknot/ffi-extend >=0.1 10 | 11 | **composer install** 12 | 13 | ``` 14 | composer require toknot/gtk 15 | 16 | ``` 17 | 18 | **Status** 19 | * support C function call of `GLib`, `GObject`, `Gio`, `Gtk`, `Atk`, `Gdk`, `Gdk-Pixbuf`, `Pango` 20 | * support C macro value and call of `GLib`,`GLib`, and a small part of `GTK` 21 | 22 | **Defined Constants** 23 | 24 | DLL file name and header file name map list: 25 | 26 | ```php 27 | class PHPGtk { 28 | public static $gtkDllMap = [ 29 | self::GLIB_ID => ['name' => 'libglib', 'header' => ['glib'], 'require_version' => '2.56'], 30 | self::GIO_ID => ['name' => 'libgio', 'header' => ['gio']], 31 | self::GOBJECT_ID => ['name' => 'libgobject', 'header' => ['gtype', 'gobject']], 32 | self::GTK_ID => ['name' => 'libgtk', 'header' => ['gtkfunc']], 33 | self::GDK_ID => ['name' => 'libgdk', 'header' => ['gdk'], 'require_version' => '3.20'], 34 | self::PIXBUF_ID => ['name' => 'libgdk_pixbuf', 'header' => ['pixbuf'], 'require_version' => '2.36'], 35 | self::PANGO_ID => ['name' => 'libpango', 'header' => ['pango'], 'require_version' => '1.42'], 36 | self::PANGO_CAIRO_ID => ['name' => 'libpangocairo', 'header' => ['pango_cairo']], 37 | self::ATK_ID => ['name' => 'libatk', 'header' => ['atk'], 'require_version' => '2.28'], 38 | ]; 39 | ...... 40 | } 41 | ``` 42 | 43 | `Gtk\PHPGtk::$gtkDllMap` determine load dynamic library name prefix and header file. 44 | 45 | **Load Dynamic Library** 46 | * In Linux, default find: 47 | * when `PHP_INT_SIZE` equal 4, OS is 32bit, find `/usr/lib` 48 | * when `PHP_INT_SIZE` equal 8, OS is 64bit, find `/usr/lib64` 49 | * specify lib path by self through `Gtk\PHPGtk::gtk($libpath)`, 50 | * if `$libpath` is string, value must be lib directory path 51 | * will find match $libpath/$name-*.so, and load the first dll 52 | * specify lib name through set `name` value of specify lib row of `Gtk\APP::$gtkDllMap` 53 | 54 | ### Usage 55 | 56 | * basic example 57 | 58 | ```php 59 | include dirname(__DIR__) . '/src/PHPGtk.php'; 60 | $gtk = \GTK\PHPGtk::gtk(); 61 | function activate() 62 | { 63 | global $gtk, $app; 64 | try { 65 | $window = $gtk->gtk_application_window_new($app); 66 | $gtk->gtk_window_set_title($gtk->GTK_WINDOW($window), "Window"); 67 | $gtk->gtk_window_set_default_size($gtk->GTK_WINDOW($window), 200, 200); 68 | $gtk->gtk_widget_show_all($window); 69 | } catch(\Error $e) { 70 | echo $e; 71 | } 72 | } 73 | 74 | 75 | function main($argc, $argv) : int 76 | { 77 | global $gtk, $app; 78 | 79 | $app = $gtk->gtk_application_new("org.gtk.example", 0); 80 | 81 | $gtk->g_signal_connect($app, "activate", 'activate'); 82 | 83 | $gapp = $gtk->G_APPLICATION($app); 84 | 85 | $status = $gtk->g_application_run($gapp, $argc, $argv); 86 | 87 | $gtk->g_object_unref($app); 88 | return $status; 89 | } 90 | return main($argc, $argv); 91 | ``` 92 | * C Lib API call 93 | * `PHPGtk` class can be call `Gtk`,`GLib`,`GObject`,`Gio`,`Gdk` function 94 | * `PHPGtk::atk()` return `Gtk\Atk`, can be call `GLib`,`GObject`,`ATK` function 95 | * `PHPGtk::gdk()` return `Gtk\Pixbuf`, can be call `GLib`, `GObject`, `GIO`, `GDK`,`gdk-pixbuf` function 96 | * `PHPGtk::pango()` return `Gtk\Pango`, can be call `GLib`,`GObject`,`Pango` function 97 | * macro value get by same name constant of class 98 | * macro function call by same name method of class 99 | * lib version value defined by macro get by global same name constant 100 | * About gettext of `glib`: 101 | * `Gtk\Glib::$GETTEXT_PACKAGE` name of `GETTEXT_PACKAGE` when compile `Glib`, default is null 102 | * `Gtk\Glib::$gettextDll` path of gettext shared library, default is empty, if php eanble gettext, will use php gettext() function instead and the property invaild 103 | * Gtk\GtkWidget class provided simple OO method of call C function that related `GtkWidget` 104 | 105 | ### Note: 106 | 107 | * Default, The number of callback function argument must less than 10, otherwise extra argument value always `NULL`, only when `Gtk\GtkAbstract::$gCallbackArgNum` be changed to other value 108 | * if C function for callback, use `GObject::G_CALLBACK($callable)` convert, the `$callable` is smailer `[$gtk, $c_func_name, true]`, it php callable array has 3 entries, 3rd is bool value 109 | * if new C variable be used occur segfault, try new unmanaged variable 110 | * most class is sub of `Gtk\GtkAbstract` 111 | 112 | ## For Windows 113 | 1. get libgtk3 binary DLL file, see https://www.gtk.org/docs/installations/windows/ 114 | 2. copy libgtk3 all DLL file and dependency to your path, if use MSYS install, pass `YOUP_PATH/mingw32/bin` or `YOUP_PATH/mingw64/bin` to `PHPGtk::gtk($libpath)`, if not installed other package,In the path DLL file is libgtk dependency package 115 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "toknot/gtk", 3 | "description": "PHP bindings to the GTK+3.", 4 | "keywords": [ 5 | "ui", 6 | "php", 7 | "ffi", 8 | "gtk", 9 | "gtk3" 10 | ], 11 | "homepage": "http://toknot.com", 12 | "license": "BSD-3-Clause", 13 | "version": "0.1.2", 14 | "authors": [ 15 | { 16 | "name": "Szopen Xiao", 17 | "email": "xiao@toknot.com", 18 | "homepage": "http://toknot.com", 19 | "role": "Founder" 20 | } 21 | ], 22 | "support": { 23 | "issues": "https://github.com/chopins/php-gtk/issues?state=open", 24 | "source": "https://github.com/chopins/php-gtk" 25 | }, 26 | "require": { 27 | "php": ">=7.4.0", 28 | "ext-ffi": "*", 29 | "toknot/ffi-extend" : ">=v0.1.4" 30 | }, 31 | "autoload": { 32 | "psr-4": { 33 | "Gtk\\": "src/" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Atk.php: -------------------------------------------------------------------------------- 1 | $major || 30 | (ATK_MAJOR_VERSION == $major && ATK_MINOR_VERSION > $minor) || 31 | (ATK_MAJOR_VERSION == $major && ATK_MINOR_VERSION == $minor && 32 | ATK_MICRO_VERSION >= $micro); 33 | } 34 | 35 | protected function dynCall($name, $arguments = [], &$ret = false) 36 | { 37 | if(isset($this->defineTypeFunc[$name])) { 38 | $ret = true; 39 | $func = $this->defineTypeFunc[$name]; 40 | return $func($name, ...$arguments); 41 | } 42 | parent::dynCall($name, $arguments, $ret); 43 | } 44 | 45 | protected static function compileVersion() 46 | { 47 | define('ATK_MAJOR_VERSION', self::$ffi->atk_get_major_version()); 48 | define('ATK_MINOR_VERSION', self::$ffi->atk_get_minor_version()); 49 | define('ATK_MICRO_VERSION', self::$ffi->atk_get_micro_version()); 50 | define('ATK_BINARY_AGE', self::$ffi->atk_get_binary_age()); 51 | define('ATK_INTERFACE_AGE', self::$ffi->atk_get_interface_age()); 52 | } 53 | 54 | protected function availableIn(&$code) 55 | { 56 | parent::availableIn($code); 57 | $ffi = $this->preLoad(self::ID, 'typedef unsigned int guint;guint atk_get_major_version(void);guint atk_get_minor_version(void);guint atk_get_micro_version(void);'); 58 | $v = "{$ffi->atk_get_major_version()}.{$ffi->atk_get_minor_version()}.{$ffi->atk_get_micro_version()}"; 59 | $this->requireMinVersion(self::ID, $v); 60 | $this->versionReplace($code, 'ATK_AVAILABLE_IN', '2.30', $v); 61 | } 62 | 63 | public function ATK_TYPE_RANGE() 64 | { 65 | return self::$ffi->atk_range_get_type(); 66 | } 67 | 68 | public function ATK_DEFINE_TYPE($TN, $tuN, $TP) 69 | { 70 | return $this->ATK_DEFINE_TYPE_EXTENDED($TN, $tuN, $TP, 0, ''); 71 | } 72 | 73 | public function ATK_DEFINE_TYPE_EXTENDED(string $TN, string $tuN, $__TPVar, $__fVar, string $U_CODE) 74 | { 75 | $code = $this->_ATK_DEFINE_TYPE_EXTENDED_BEGIN($TN, $tuN); 76 | $code .= $U_CODE; 77 | $code .= $this->_ATK_DEFINE_TYPE_EXTENDED_END(); 78 | eval($code); 79 | } 80 | 81 | public function ATK_DEFINE_TYPE_WITH_CODE(string $TN, string $tuN, $__TPVar, string $U_CODE) 82 | { 83 | $__fVal = 0; 84 | $code = $this->_ATK_DEFINE_TYPE_EXTENDED_BEGIN($TN, $tuN); 85 | $code .= $U_CODE; 86 | $code .= $this->_ATK_DEFINE_TYPE_EXTENDED_END(); 87 | eval($code); 88 | } 89 | 90 | public function ATK_DEFINE_ABSTRACT_TYPE(string $TN, string $tuN, $TPVar) 91 | { 92 | return $this->ATK_DEFINE_TYPE_EXTENDED($TN, $tuN, $TPVar, self::$ffi->G_TYPE_FLAG_ABSTRACT, ''); 93 | } 94 | 95 | public function ATK_DEFINE_ABSTRACT_TYPE_WITH_CODE(string $TN, string $tuN, $__TPVar, string $U_CODE) 96 | { 97 | $__fVal = self::$ffi->G_TYPE_FLAG_ABSTRACT; 98 | $code = $this->_ATK_DEFINE_TYPE_EXTENDED_BEGIN($TN, $tuN); 99 | $code .= $U_CODE; 100 | $code .= $this->_ATK_DEFINE_TYPE_EXTENDED_END(); 101 | eval($code); 102 | } 103 | 104 | private function _ATK_DEFINE_TYPE_EXTENDED_BEGIN(string $TN, string $typeName) 105 | { 106 | $tn_init = "{$typeName}_init"; 107 | $tn_class_init = "{$typeName}_class_init"; 108 | $tn_parent_class = "\${$typeName}_parent_class"; 109 | $tn_get_type = "{$typeName}_get_type"; 110 | $tn_class_intern_init = "{$typeName}_class_intern_init"; 111 | 112 | $code = <<$tn_parent_class = \$this->new('gpointer'); 114 | 115 | \$this->defineTypeFunc['$tn_class_intern_init'] = function (\$klass){ 116 | \$this->$tn_parent_class = \$this->g_type_class_peek_parent(\$klass); 117 | $tn_class_init(\$this->cast('{$TN}Class*', \$klass)); 118 | } 119 | 120 | \$this->defineTypeFunc['$tn_get_type'] = function () { 121 | \$g_define_type_id__volatile = \$this->new('gsize'); 122 | \$g_define_type_id__volatile->cdata = 0; 123 | 124 | if (\$this->g_once_init_enter(FFI::addr(\$this->g_define_type_id__volatile))) { 125 | \$derived_type = \$this->g_type_parent(\$__TPVar); 126 | \$factory = \$this->atk_registry_get_factory( 127 | \$this->atk_get_default_registry(), 128 | \$derived_type 129 | ); 130 | \$derived_atk_type = \$this->atk_object_factory_get_accessible_type(\$factory); 131 | \$query = \$this->new('GTypeQuery'); 132 | \$this->g_type_query(\$derived_atk_type, FFI::addr(\$query)); 133 | \$g_define_type_id = \$this->g_type_register_static_simple(\$derived_atk_type, 134 | \$this->g_intern_static_string($TN), 135 | \$query->class_size, 136 | $tn_class_intern_init, 137 | \$query->instance_size, 138 | $tn_init, 139 | \$this->cast('GTypeFlags', \$__fVar)); 140 | } 141 | CODE; 142 | return $code; 143 | } 144 | 145 | private function _ATK_DEFINE_TYPE_EXTENDED_END() 146 | { 147 | return <<<'CODE' 148 | $this->g_once_init_leave (FFI::addr($g_define_type_id__volatile), $g_define_type_id); 149 | return $this->g_define_type_id__volatile; 150 | } 151 | CODE; 152 | } 153 | 154 | } 155 | -------------------------------------------------------------------------------- /src/Builtin.php: -------------------------------------------------------------------------------- 1 | cdata; 21 | $r = $this->new('guint64'); 22 | $r->cdata = (($n & 0x000000ff) << 24) | 23 | (($n & 0x0000ff00) << 8) | 24 | (($n & 0x00ff0000) >> 8) | 25 | (($n & 0xff000000) >> 24); 26 | return $r; 27 | } 28 | 29 | public function __builtin_bswap64(CData $v) 30 | { 31 | $val = $v->cdata; 32 | $r = $this->new('guint64'); 33 | $r->cdata = (($val & 0x00000000000000ff) << 56) | 34 | (($val & 0x000000000000ff00) << 40) | 35 | (($val & 0x0000000000ff0000) << 24) | 36 | (($val & 0x00000000ff000000) << 8) | 37 | (($val & 0x000000ff00000000) << 8) | 38 | (($val & 0x0000ff0000000000) << 24) | 39 | (($val & 0x00ff000000000000) << 40) | 40 | (($val & 0xff00000000000000) << 56); 41 | 42 | return $r; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/DefineValue.php: -------------------------------------------------------------------------------- 1 | instance; 41 | } 42 | 43 | public function hasCFunc($fname) 44 | { 45 | return self::$ffiExt->hasCFunc($this->instance, $fname); 46 | } 47 | 48 | public function hasCType($type) 49 | { 50 | return self::$ffiExt->hasCType($this->instance, $type); 51 | } 52 | 53 | public function hasCVar($var) 54 | { 55 | return self::$ffiExt->hasCVariable($this->instance, $var); 56 | } 57 | 58 | public function getCTypeName(CType $type) 59 | { 60 | return self::$ffiExt->getCTypeName($type); 61 | } 62 | 63 | public function getCDataType(CData $data) 64 | { 65 | $type = \FFI::typeof($data); 66 | return $this->getCTypeName($type); 67 | } 68 | 69 | public function autoCast($enable = true) 70 | { 71 | $this->autoCast = $enable; 72 | } 73 | 74 | public function id($id = null) 75 | { 76 | if($id === null) { 77 | return $this->libId; 78 | } 79 | $this->libId = $id; 80 | } 81 | 82 | public function __get($name) 83 | { 84 | return $this->instance->$name; 85 | } 86 | 87 | public function __set($name, $v) 88 | { 89 | $this->instance->$name = $v; 90 | } 91 | 92 | public function __call($name, $args = []) 93 | { 94 | if($this->autoCast) { 95 | self::$ffiExt->castAllSameType($this->instance, $args); 96 | } 97 | return $this->instance->$name(...$args); 98 | } 99 | 100 | public static function __callStatic($name, $args = []) 101 | { 102 | $ret = \FFI::$name(...$args); 103 | if($ret instanceof \FFI) { 104 | $obj = new static; 105 | $obj->instance = $ret; 106 | return $obj; 107 | } 108 | return $ret; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/GLib.php: -------------------------------------------------------------------------------- 1 | glib_major_version); 76 | define('GLIB_MINOR_VERSION', self::$ffi->glib_minor_version); 77 | define('GLIB_MICRO_VERSION', self::$ffi->glib_micro_version); 78 | define('GLIB_BINARY_AGE', self::$ffi->glib_binary_age); 79 | } 80 | 81 | protected function availableIn(&$code) 82 | { 83 | parent::availableIn($code); 84 | $ffi = $this->preLoad(self::ID, 'typedef unsigned int guint;guint glib_major_version;guint glib_minor_version;guint glib_micro_version;'); 85 | $v = "{$ffi->glib_major_version}.{$ffi->glib_minor_version}.{$ffi->glib_micro_version}"; 86 | $this->requireMinVersion(self::ID, $v); 87 | $this->versionReplace($code, 'GLIB_AVAILABLE_IN', '2.60', $v); 88 | $this->versionReplace($code, 'GLIB_AVAILABLE_IN', '2.62', $v); 89 | $this->versionReplace($code, 'GLIB_AVAILABLE_IN', '2.58', $v); 90 | } 91 | 92 | public function gettext($string) 93 | { 94 | if(function_exists('gettext')) { 95 | return gettext($string); 96 | } else { 97 | if(self::$gettextFFI) { 98 | self::$gettextFFI = FFI::cdef('extern char *gettext (const char *__msgid);', self::$gettextDll); 99 | } 100 | return self::$gettextFFI->gettext($string); 101 | } 102 | } 103 | 104 | public function C_($Context, $String) 105 | { 106 | return self::$ffi->g_dpgettext(self::$GETTEXT_PACKAGE, "{$Context}\004{$String}", strlen($Context) + 1); 107 | } 108 | 109 | public function _($String) 110 | { 111 | if(self::$GETTEXT_PACKAGE) { 112 | return $this->cast('char *', self::$ffi->g_dgettext(self::$GETTEXT_PACKAGE, $String)); 113 | } 114 | return $this->gettext($String); 115 | } 116 | 117 | public function Q_($String) 118 | { 119 | 120 | return self::$ffi->g_dpgettext(self::$GETTEXT_PACKAGE, $String, 0); 121 | } 122 | 123 | public function N_($String) 124 | { 125 | return $String; 126 | } 127 | 128 | public function NC_($Context, $String) 129 | { 130 | return $String; 131 | } 132 | 133 | public function g_bit_nth_lsf($mask, $nth_bit) 134 | { 135 | return self::$ffi->g_bit_nth_lsf_impl($mask, $nth_bit); 136 | } 137 | 138 | public function g_bit_nth_msf($mask, $nth_bit) 139 | { 140 | return self::$ffi->g_bit_nth_msf_impl($mask, $nth_bit); 141 | } 142 | 143 | public function g_bit_storage($number) 144 | { 145 | return self::$ffi->g_bit_storage_impl($number); 146 | } 147 | 148 | public function g_array_append_val($a, $v) 149 | { 150 | return self::$ffi->g_array_append_vals($a, FFI::addr($v), 1); 151 | } 152 | 153 | public function g_array_prepend_val($a, $v) 154 | { 155 | return self::$ffi->g_array_prepend_vals($a, FFI::addr($v), 1); 156 | } 157 | 158 | public function g_array_insert_val($a, $i, $v) 159 | { 160 | return self::$ffi->g_array_insert_vals($a, $i, FFI::addr($v), 1); 161 | } 162 | 163 | public function g_array_index($a, $t, $i) 164 | { 165 | return $this->cast("$t*", $this->cast('void*', $a[0]->data))[$i]; 166 | } 167 | 168 | public function G_GINT64_CONSTANT($val) 169 | { 170 | return "$val##L"; 171 | } 172 | 173 | public function G_GUINT64_CONSTANT($val) 174 | { 175 | return "$val##UL"; 176 | } 177 | 178 | public function G_GOFFSET_CONSTANT($val) 179 | { 180 | return $this->G_GINT64_CONSTANT($val); 181 | } 182 | 183 | public function G_IS_DIR_SEPARATOR($c) 184 | { 185 | return $c === DIRECTORY_SEPARATOR || ($c) === '/'; 186 | } 187 | 188 | public function CLAMP($x, $low, $high) 189 | { 190 | return ($x > $high) ? $high : (($x < $low) ? $low : $x); 191 | } 192 | 193 | public function G_STRUCT_MEMBER_P(CData $structPtr, int $structOffset) 194 | { 195 | $p = $this->new('guint8'); 196 | $p->cdata = $this->cast('guint8*', $structPtr) + $structOffset; 197 | return $this->cast('gpointer', $p); 198 | } 199 | 200 | public function G_BOOKMARK_FILE_ERROR() 201 | { 202 | return self::$ffi->g_bookmark_file_error_quark(); 203 | } 204 | 205 | public function G_STRUCT_MEMBER(string $type, CData $structPtr, int $structOffset) 206 | { 207 | return $this->cast("$type*", $this->G_STRUCT_MEMBER_P($structPtr, $structOffset))[0]; 208 | } 209 | 210 | public function G_STRUCT_OFFSET(string $type, $member) 211 | { 212 | return $this->cast('glong', $this->cast('guint8*', FFI::addr($this->new($type)->$member))); 213 | } 214 | 215 | public function G_N_ELEMENTS(CData $arr) 216 | { 217 | return FFI::sizeof($arr) / FFI::sizeof($arr[0]); 218 | } 219 | 220 | public function GINT_TO_POINTER(CData $i) 221 | { 222 | return $this->trunCast($i, ['glong', 'gpointer']); 223 | } 224 | 225 | public function GPOINTER_TO_INT(CData $p) 226 | { 227 | return $this->trunCast($p, ['glong', 'gint']); 228 | } 229 | 230 | public function GUINT_TO_POINTER(CData $p) 231 | { 232 | return $this->trunCast($p, ['gulong', 'gpointer']); 233 | } 234 | 235 | public function GPOINTER_TO_UINT(CData $p) 236 | { 237 | return $this->trunCast($p, ['guint', 'gulong']); 238 | } 239 | 240 | public function GSIZE_TO_POINTER(CData $p) 241 | { 242 | return $this->trunCast($p, ['gsize', 'gpointer']); 243 | } 244 | 245 | public function GPOINTER_TO_SIZE(CData $p) 246 | { 247 | return $this->cast('gsize', $p); 248 | } 249 | 250 | public function g_htonl($val) 251 | { 252 | return $this->GUINT32_TO_BE($val); 253 | } 254 | 255 | public function g_htons($val) 256 | { 257 | return $this->GUINT16_TO_BE($val); 258 | } 259 | 260 | public function g_ntohl($val) 261 | { 262 | return $this->GUINT32_FROM_BE($val); 263 | } 264 | 265 | public function g_ntohs($val) 266 | { 267 | return $this->GUINT16_FROM_BE($val); 268 | } 269 | 270 | public function GINT_FROM_BE($val) 271 | { 272 | return $this->GINT_TO_BE($val); 273 | } 274 | 275 | public function GINT_FROM_LE($val) 276 | { 277 | return $this->GINT_TO_LE($val); 278 | } 279 | 280 | public function GINT_TO_BE($val) 281 | { 282 | return $this->cast('gint', $this->GINT32_TO_BE($val)); 283 | } 284 | 285 | public function GINT_TO_LE($val) 286 | { 287 | return $this->cast('gint', $this->GINT32_TO_LE($val)); 288 | } 289 | 290 | public function GUINT_FROM_BE($val) 291 | { 292 | return $this->GUINT_TO_BE($val); 293 | } 294 | 295 | public function GUINT_FROM_LE($val) 296 | { 297 | return $this->GUINT_TO_LE($val); 298 | } 299 | 300 | public function GUINT_TO_BE($val) 301 | { 302 | return $this->cast('guint', $this->GUINT32_TO_BE($val)); 303 | } 304 | 305 | public function GUINT_TO_LE($val) 306 | { 307 | return $this->cast('guint', $this->GUINT32_TO_LE($val)); 308 | } 309 | 310 | public function GLONG_FROM_BE($val) 311 | { 312 | return $this->GLONG_TO_BE($val); 313 | } 314 | 315 | public function GLONG_FROM_LE($val) 316 | { 317 | return $this->GLONG_TO_LE($val); 318 | } 319 | 320 | public function GLONG_TO_BE($val) 321 | { 322 | return $this->cast('glong', $this->GINT64_TO_BE($val)); 323 | } 324 | 325 | public function GLONG_TO_LE($val) 326 | { 327 | return $this->cast('glong', $this->GINT64_TO_LE($val)); 328 | } 329 | 330 | public function GULONG_FROM_BE($val) 331 | { 332 | return $this->GULONG_TO_BE($val); 333 | } 334 | 335 | public function GULONG_FROM_LE($val) 336 | { 337 | return $this->GULONG_TO_LE($val); 338 | } 339 | 340 | public function GULONG_TO_BE($val) 341 | { 342 | return $this->cast('gulong', $this->GUINT64_TO_BE($val)); 343 | } 344 | 345 | public function GULONG_TO_LE($val) 346 | { 347 | return $this->cast('gulong', $this->GUINT64_TO_LE($val)); 348 | } 349 | 350 | public function GSIZE_FROM_BE($val) 351 | { 352 | return $this->GSIZE_TO_BE($val); 353 | } 354 | 355 | public function GSIZE_FROM_LE($val) 356 | { 357 | return $this->GSIZE_TO_LE($val); 358 | } 359 | 360 | public function GSIZE_TO_BE($val) 361 | { 362 | return $this->cast('gsize', $this->GUINT64_TO_BE($val)); 363 | } 364 | 365 | public function GSIZE_TO_LE($val) 366 | { 367 | return $this->cast('gsize', $this->GUINT64_TO_LE($val)); 368 | } 369 | 370 | public function GSSIZE_FROM_BE($val) 371 | { 372 | return $this->GSSIZE_TO_BE($val); 373 | } 374 | 375 | public function GSSIZE_FROM_LE($val) 376 | { 377 | return $this->GSSIZE_TO_LE($val); 378 | } 379 | 380 | public function GSSIZE_TO_BE($val) 381 | { 382 | return $this->cast('gssize', $this->GINT64_TO_BE($val)); 383 | } 384 | 385 | public function GSSIZE_TO_LE($val) 386 | { 387 | return $this->cast('gssize', $this->GINT64_TO_LE($val)); 388 | } 389 | 390 | public function GINT16_FROM_BE($val) 391 | { 392 | return $this->GINT16_TO_BE($val); 393 | } 394 | 395 | public function GINT16_FROM_LE($val) 396 | { 397 | return $this->GINT16_TO_LE($val); 398 | } 399 | 400 | public function GINT16_TO_BE($val) 401 | { 402 | return $this->cast('gint16', $this->GUINT16_SWAP_LE_BE($val)); 403 | } 404 | 405 | public function GINT16_TO_LE($val) 406 | { 407 | return $this->cast('gint16', $val); 408 | } 409 | 410 | public function GUINT16_FROM_BE($val) 411 | { 412 | return $this->GUINT16_TO_BE($val); 413 | } 414 | 415 | public function GUINT16_FROM_LE($val) 416 | { 417 | return $this->GUINT16_TO_LE($val); 418 | } 419 | 420 | public function GUINT16_TO_BE($val) 421 | { 422 | return $this->GUINT16_SWAP_LE_BE($val); 423 | } 424 | 425 | public function GUINT16_TO_LE($val) 426 | { 427 | return $this->cast('guint16', $val); 428 | } 429 | 430 | public function GINT32_FROM_BE($val) 431 | { 432 | return $this->GINT32_TO_BE($val); 433 | } 434 | 435 | public function GINT32_FROM_LE($val) 436 | { 437 | return $this->GINT32_TO_LE($val); 438 | } 439 | 440 | public function GINT32_TO_BE($val) 441 | { 442 | return $this->cast('gint32', $this->GUINT32_SWAP_LE_BE($val)); 443 | } 444 | 445 | public function GINT32_TO_LE($val) 446 | { 447 | return $this->cast('gint32', $val); 448 | } 449 | 450 | public function GUINT32_FROM_BE($val) 451 | { 452 | return $this->GUINT32_TO_BE($val); 453 | } 454 | 455 | public function GUINT32_FROM_LE($val) 456 | { 457 | return $this->GUINT32_TO_LE($val); 458 | } 459 | 460 | public function GUINT32_TO_BE($val) 461 | { 462 | return $this->GUINT32_SWAP_LE_BE($val); 463 | } 464 | 465 | public function GUINT32_TO_LE($val) 466 | { 467 | return $this->cast('guint32', $val); 468 | } 469 | 470 | public function GINT64_FROM_BE($val) 471 | { 472 | return $this->GINT64_TO_BE($val); 473 | } 474 | 475 | public function GINT64_FROM_LE($val) 476 | { 477 | return $this->GINT64_TO_LE($val); 478 | } 479 | 480 | public function GINT64_TO_BE($val) 481 | { 482 | return $this->cast('gint64', $this->GUINT64_SWAP_LE_BE($val)); 483 | } 484 | 485 | public function GINT64_TO_LE($val) 486 | { 487 | return $this->cast('gint64', $val); 488 | } 489 | 490 | public function GUINT64_FROM_BE($val) 491 | { 492 | return $this->GUINT64_TO_BE($val); 493 | } 494 | 495 | public function GUINT64_FROM_LE($val) 496 | { 497 | return $this->GUINT64_TO_LE($val); 498 | } 499 | 500 | public function GUINT64_TO_BE($val) 501 | { 502 | return $this->GUINT64_SWAP_LE_BE($val); 503 | } 504 | 505 | public function GUINT64_TO_LE($val) 506 | { 507 | return $this->cast('guint64', $val); 508 | } 509 | 510 | public function GUINT16_SWAP_BE_PDP($val) 511 | { 512 | return $this->GUINT16_SWAP_LE_BE($val); 513 | } 514 | 515 | public function GUINT16_SWAP_LE_BE($val) 516 | { 517 | return $this->GUINT16_SWAP_LE_BE_IA32($val); 518 | } 519 | 520 | public function GUINT16_SWAP_LE_BE_IA32($val) 521 | { 522 | $r = $this->new('guint16'); 523 | $v = $val->cdata; 524 | $r->cdata = $v >> 8 | $v << 8; 525 | return $r; 526 | } 527 | 528 | public function GUINT16_SWAP_LE_PDP($val) 529 | { 530 | return $this->cast('guint16', $val); 531 | } 532 | 533 | public function GUINT32_SWAP_BE_PDP($val) 534 | { 535 | if($val instanceof FFI) { 536 | $v = $val->cdata; 537 | } 538 | $r = $this->new('guint32'); 539 | $r->cdata = ((($v & 0x00ff00ff) << 8) | (($v & 0xff00ff00) >> 8)); 540 | return $r; 541 | } 542 | 543 | public function GUINT32_SWAP_LE_BE($val) 544 | { 545 | return $this->cast('guint32', $this->__builtin_bswap32($this->cast('guint32', $val))); 546 | } 547 | 548 | public function GUINT32_SWAP_LE_PDP($val) 549 | { 550 | if($val instanceof FFI) { 551 | $v = $val->cdata; 552 | } 553 | $r = $this->new('guint32'); 554 | $r->cdata = ((($v & 0x0000ffff) << 16) | (($v & 0xffff0000) >> 16)); 555 | return $r; 556 | } 557 | 558 | public function GUINT64_SWAP_LE_BE($val) 559 | { 560 | return $this->cast('guint64', $this->__builtin_bswap64($this->cast('guint64', $val))); 561 | } 562 | 563 | public function g_uint_checked_add(CData $d, CData $a, CData $b) 564 | { 565 | $d[0]->cdata = $a->cdata + $b->cdata; 566 | return $d[0]->cdata >= $a->cdata; 567 | } 568 | 569 | public function g_uint_checked_mul(CData $dest, CData $a, CData $b) 570 | { 571 | $dest[0]->cdata = $a->cdata * $b->cdata; 572 | return !$a->cdata || $dest[0]->cdaa / $a->cdata == $b->cdata; 573 | } 574 | 575 | public function g_uint64_checked_add(CData $dest, CData $a, CData $b) 576 | { 577 | $dest[0]->cdata = $a->cdata + $b->cdata; 578 | return $dest[0]->cdata >= $a->cdata; 579 | } 580 | 581 | public function g_uint64_checked_mul(CData $dest, CData $a, CData $b) 582 | { 583 | $dest[0]->cdata = $a->cdata * $b->cdata; 584 | return !$a->cdata || $dest->cdata / $a->cdata == $b->cdata; 585 | } 586 | 587 | public function g_size_checked_add(CData $dest, CData $a, CData $b) 588 | { 589 | return $this->g_uint_checked_add($dest, $a, $b); 590 | } 591 | 592 | public function g_size_checked_mul(CData $dest, CData $a, CData $b) 593 | { 594 | return $this->g_uint_checked_mul($dest, $a, $b); 595 | } 596 | 597 | public function g_auto($type) 598 | { 599 | return $type; 600 | } 601 | 602 | public function g_autoptr($type) 603 | { 604 | return "{$type}_autoptr"; 605 | } 606 | 607 | public function g_autolist($type) 608 | { 609 | return "{$type}_listautoptr"; 610 | } 611 | 612 | public function g_autoslist($type) 613 | { 614 | return "{$type}_slistautoptr"; 615 | } 616 | 617 | public function G_VA_COPY($a, $b) 618 | { 619 | try { 620 | count($a); 621 | } catch(\FFI\Exception $e) { 622 | throw new RuntimeException("C macro G_DEFINE_AUTO_CLEANUP_FREE_FUNC() copy array not implement"); 623 | } 624 | if(isset($a[0])) { 625 | return $a[0] = $b[0]; 626 | } else { 627 | return $a->cdata = $b->cdata; 628 | } 629 | } 630 | 631 | public function G_STRINGIFY_ARG($str) 632 | { 633 | return $str; 634 | } 635 | 636 | public function G_STRINGIFY($str) 637 | { 638 | return $this->G_STRINGIFY_ARG($str); 639 | } 640 | 641 | public function G_PASTE_ARGS($identifier1, $identifier2) 642 | { 643 | return "{$identifier1}{$identifier2}"; 644 | } 645 | 646 | public function G_PASTE($identifier1, $identifier2) 647 | { 648 | return $this->G_PASTE_ARGS($identifier1, $identifier2); 649 | } 650 | 651 | public function G_STATIC_ASSERT_EXPR($expr) 652 | { 653 | return $this->cast('void', $this->gtk->sizeof(FFI::type('char[' . ($expr ? 1 : -1) . ']'))); 654 | } 655 | 656 | public function G_LOCK_NAME($name) 657 | { 658 | return "g__${$name}_lock"; 659 | } 660 | 661 | public function G_LOCK($name) 662 | { 663 | $f = $this->new($this->G_LOCK_NAME($name)); 664 | return $this->g_mutex_lock($f); 665 | } 666 | 667 | public function G_TRYLOCK($name) 668 | { 669 | $f = $this->new($this->G_LOCK_NAME($name)); 670 | return $this->g_mutex_trylock($f); 671 | } 672 | 673 | public function G_UNLOCK($name) 674 | { 675 | $f = $this->new($this->G_LOCK_NAME($name)); 676 | return $this->g_mutex_lock($f); 677 | } 678 | 679 | } 680 | -------------------------------------------------------------------------------- /src/GObject.php: -------------------------------------------------------------------------------- 1 | g_signal_connect_data($instance, $detailed_signal, $c_handler, $data, null, null); 37 | } 38 | 39 | /** 40 | * 41 | * @param callable $fn if is array, 3rd element is C function flag 42 | * @return callable 43 | */ 44 | public function G_CALLBACK($fn) 45 | { 46 | if(is_array($fn) && isset($fn[2])) { 47 | $ffi = $fn[0]->getFFIOfFunc($fn[1]); 48 | if(!$ffi) { 49 | return $fn; 50 | } 51 | $ref = new ReflectionCFunction($ffi->getFFI(), $fn[1]); 52 | return $ref->getClosure(); 53 | } 54 | return $fn; 55 | } 56 | 57 | public function g_signal_connect_swapped($instance, $detailedSignal, $chandler, $data) 58 | { 59 | return $this->g_signal_connect_data($instance, $detailedSignal, $chandler, $data, NULL, self::$ffi->G_CONNECT_SWAPPED); 60 | } 61 | 62 | public function g_signal_connect_after($instance, $detailedSignal, $chandler, $data) 63 | { 64 | return $this->g_signal_connect_data($instance, $detailedSignal, $chandler, $data, NULL, self::$ffi->G_CONNECT_AFTER); 65 | } 66 | 67 | public function g_signal_handlers_disconnect_by_data($instance, $data) 68 | { 69 | return $this->g_signal_handlers_disconnect_matched($instance, self::$ffi->G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, $data); 70 | } 71 | 72 | public function g_signal_handlers_block_by_func($instance, $func, $data) 73 | { 74 | $sig = $this->new('GSignalMatchType'); 75 | $sig->cdata = (self::$ffi->G_SIGNAL_MATCH_FUNC | self::$ffi->G_SIGNAL_MATCH_DATA); 76 | return $this->g_signal_handlers_block_matched($instance, $sig, 0, 0, NULL, $func, $data); 77 | } 78 | 79 | public function g_signal_handlers_unblock_by_func($instance, $func, $data) 80 | { 81 | $sig = $this->new('GSignalMatchType'); 82 | $sig->cdata = (self::$ffi->G_SIGNAL_MATCH_FUNC | self::$ffi->G_SIGNAL_MATCH_DATA); 83 | return $this->g_signal_handlers_unblock_matched($instance, $sig, 0, 0, NULL, $func, $data); 84 | } 85 | 86 | public function g_signal_handlers_disconnect_by_func($instance, $func, $data) 87 | { 88 | $sig = $this->new('GSignalMatchType'); 89 | $sig->cdata = (self::$ffi->G_SIGNAL_MATCH_FUNC | self::$ffi->G_SIGNAL_MATCH_DATA); 90 | return $this->g_signal_handlers_disconnect_matched($instance, $sig, 0, 0, NULL, $func, $data); 91 | } 92 | 93 | public function _MACRO_G_TYPE_CHECK_INSTANCE_CAST($ins, $gtype, $ctype) 94 | { 95 | $p = self::$ffi->cast('GTypeInstance*', $ins); 96 | return $this->cast("$ctype*", $this->g_type_check_instance_cast($p, $gtype)); 97 | } 98 | 99 | public function _MACRO_G_TYPE_CHECK_CLASS_CAST($cp, $gt, $ct) 100 | { 101 | $p = $this->cast('GTypeClass*', $cp); 102 | return $this->cast("$ct*", $this->g_type_check_class_cast($p, $gt)); 103 | } 104 | 105 | public function G_TYPE_CHECK_INSTANCE_TYPE($cp, $gt) 106 | { 107 | $p = $this->cast('GTypeInstance*', $cp); 108 | return $this->g_type_check_class_is_a($p, $gt); 109 | } 110 | 111 | public function G_TYPE_CHECK_CLASS_TYPE($cp, $gt) 112 | { 113 | $p = $this->cast('GTypeClass*', $cp); 114 | return $this->g_type_check_class_is_a($p, $gt); 115 | } 116 | 117 | public function _MACRO_G_TYPE_CHECK_VALUE($value) 118 | { 119 | $p = $this->cast('GValue*', $value); 120 | return $this->g_type_check_value($p); 121 | } 122 | 123 | public function G_TYPE_INSTANCE_GET_CLASS($cp, $gt, $ct) 124 | { 125 | $p = $this->cast('GTypeInstance*', $cp); 126 | return $this->cast("$ct*", $p[0]->g_class); 127 | } 128 | 129 | public function G_TYPE_INSTANCE_GET_INTERFACE($cp, $gt, $ct) 130 | { 131 | $p = $this->cast('GTypeInstance*', $cp); 132 | return $this->cast("$ct*", $this->g_type_interface_peek($p, $gt)); 133 | } 134 | 135 | public function G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE($cp, $gt) 136 | { 137 | $p = $this->cast('GTypeInstance*', $cp); 138 | return $this->g_type_check_instance_is_fundamentally_a($p, $gt); 139 | } 140 | 141 | public function G_TYPE_MAKE_FUNDAMENTAL($x) 142 | { 143 | return $x << self::G_TYPE_FUNDAMENTAL_SHIFT; 144 | } 145 | 146 | public function G_TYPE_OBJECT() 147 | { 148 | return $this->G_TYPE_MAKE_FUNDAMENTAL(20); 149 | } 150 | 151 | public function G_TYPE_GTYPE() 152 | { 153 | return $this->g_gtype_get_type(); 154 | } 155 | 156 | public function G_IS_OBJECT($obj) 157 | { 158 | return $this->G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE($obj, $this->G_TYPE_OBJECT()); 159 | } 160 | 161 | public function G_IS_OBJECT_CLASS($class) 162 | { 163 | return $this->G_TYPE_CHECK_CLASS_TYPE($class, $this->G_TYPE_OBJECT()); 164 | } 165 | 166 | public function G_TYPE_CHECK_VALUE_TYPE($v, $gt) 167 | { 168 | $p = $this->cast('GValue*', $v); 169 | return $this->g_type_check_value_holds($p, $gt); 170 | } 171 | 172 | public function G_TYPE_FROM_INSTANCE($cp) 173 | { 174 | $p = $this->cast('GTypeInstance*', $cp); 175 | return $p[0]->g_class; 176 | } 177 | 178 | public function G_TYPE_FROM_CLASS($cp) 179 | { 180 | return $this->cast('GTypeClass*', $cp)[0]->g_type; 181 | } 182 | 183 | public function G_OBJECT_CLASS_TYPE($class) 184 | { 185 | return $this->G_TYPE_FROM_CLASS($class); 186 | } 187 | 188 | public function G_OBJECT_TYPE($o) 189 | { 190 | return $this->G_TYPE_FROM_INSTANCE($o); 191 | } 192 | 193 | public function G_OBJECT_TYPE_NAME($obj) 194 | { 195 | $id = $this->G_OBJECT_TYPE($obj); 196 | return $this->g_type_name($id[0]->g_type); 197 | } 198 | 199 | public function G_OBJECT_CLASS_NAME($obj) 200 | { 201 | $id = $this->G_OBJECT_CLASS_TYPE($obj); 202 | return $this->g_type_name($id); 203 | } 204 | 205 | public function G_TYPE_FROM_INTERFACE($gi) 206 | { 207 | return $this->cast('GTypeInterface*', $gi)[0]->g_type; 208 | } 209 | 210 | public function G_TYPE_INSTANCE_GET_PRIVATE($v, $gt, $ct) 211 | { 212 | trigger_error('G_TYPE_INSTANCE_GET_PRIVATE() macro is deprecated since 2.58 of gobject', E_DEPRECATED); 213 | $p = $this->cast('GTypeInstance*', $v); 214 | $gp = self::$ffi->g_type_instance_get_private($p, $gt); 215 | return $this->cast("$ct*", $gp); 216 | } 217 | 218 | public function G_TYPE_CLASS_GET_PRIVATE($v, $gt, $ct) 219 | { 220 | $p = $this->cast('GTypeClass*', $v); 221 | return $this->cast("$ct*", self::$ffi->g_type_class_get_private($p, $gt)); 222 | } 223 | 224 | } 225 | -------------------------------------------------------------------------------- /src/Gdk.php: -------------------------------------------------------------------------------- 1 | requireMinVersion(self::ID, PHP_GDK_VERSION); 40 | $this->versionReplace($code, 'GDK_AVAILABLE_IN', '3.24', PHP_GDK_VERSION); 41 | $this->versionReplace($code, 'GDK_AVAILABLE_IN', '3.22', PHP_GDK_VERSION); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/Gio.php: -------------------------------------------------------------------------------- 1 | ffiExt()->argsPtr($argc, $argv); 34 | return self::$ffi->g_application_run($gapp, $argc, $argvPtr); 35 | } 36 | 37 | public function G_APPLICATION($app) 38 | { 39 | return $this->G_TYPE_CHECK_INSTANCE_CAST($app, $this->g_application_get_type(), 'GApplication'); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Gtk.php: -------------------------------------------------------------------------------- 1 | gtk_native_dialog_get_type(); 177 | } 178 | 179 | protected function dynCall($name, $args = [], &$hasRet = false) 180 | { 181 | if(strpos($name, 'GTK_') !== 0 || !preg_match('/^[A-Z0-9_]+$/', $name)) { 182 | $hasRet = false; 183 | return; 184 | } 185 | $hasRet = true; 186 | $type = strtolower($name); 187 | $typeFunc = "{$type}_get_type"; 188 | if(strpos($name, 'GTK_TYPE_') === 0) { 189 | return $this->$typeFunc(); 190 | } 191 | 192 | $typeStruct = isset($args[1]) ? $args[1] : str_replace('_', '', ucwords($type, '_')); 193 | $castFunc = (strrpos($name, '_CLASS') === (strlen($name) - 6)) ? 194 | 'G_TYPE_CHECK_CLASS_CAST' : 195 | 'G_TYPE_CHECK_INSTANCE_CAST'; 196 | if(self::$ffi->hasCType($typeStruct)) { 197 | return $this->$castFunc($args[0], $this->$typeFunc(), $typeStruct); 198 | } 199 | $hasRet = false; 200 | return parent::dynCall($name, $args, $hasRet); 201 | } 202 | 203 | public function GTK_RECENT_MANAGER_ERROR() 204 | { 205 | self::$ffi->gtk_recent_manager_error_quark(); 206 | } 207 | 208 | public function GTK_RECENT_CHOOSER_ERROR() 209 | { 210 | return self::$ffi->gtk_recent_chooser_error_quark(); 211 | } 212 | 213 | public function gtk_init(int $argc = 0, array $argv = []) 214 | { 215 | $argcPtr = $this->new("int32_t", true, false); 216 | $argcPtr->cdata = $argc; 217 | $ptr3 = self::$ffi->ffiExt()->argsPtr($argc, $argv); 218 | $ptr4 = FFI::addr($ptr3); 219 | return self::$ffi->gtk_init(FFI::addr($argcPtr), $ptr4); 220 | } 221 | 222 | protected static function compileVersion() 223 | { 224 | define('GTK_MAJOR_VERSION', self::$ffi->gtk_get_major_version()); 225 | define('GTK_MINOR_VERSION', self::$ffi->gtk_get_minor_version()); 226 | define('GTK_MICRO_VERSION', self::$ffi->gtk_get_micro_version()); 227 | define('GTK_BINARY_AGE', self::$ffi->gtk_get_binary_age()); 228 | define('GTK_INTERFACE_AGE', self::$ffi->gtk_get_interface_age()); 229 | } 230 | 231 | public function GTK_TYPE_STYLE_CONTEXT() 232 | { 233 | return self::$ffi->gtk_style_context_get_type(); 234 | } 235 | 236 | public function GTK_STYLE_CONTEXT($o) 237 | { 238 | return $this->G_TYPE_CHECK_INSTANCE_CAST($o, $this->GTK_TYPE_STYLE_CONTEXT, $this->type('GtkStyleContext')); 239 | } 240 | 241 | public function GTK_STYLE_CONTEXT_CLASS($c) 242 | { 243 | return $this->G_TYPE_CHECK_CLASS_CAST($c, $this->GTK_TYPE_STYLE_CONTEXT, $this->type('GtkStyleContextClass')); 244 | } 245 | 246 | public function GTK_IS_STYLE_CONTEXT($o) 247 | { 248 | return $this->G_TYPE_CHECK_INSTANCE_TYPE($o, $this->GTK_TYPE_STYLE_CONTEXT); 249 | } 250 | 251 | public function GTK_IS_STYLE_CONTEXT_CLASS($c) 252 | { 253 | return $this->G_TYPE_CHECK_CLASS_TYPE($c, $this->GTK_TYPE_STYLE_CONTEXT); 254 | } 255 | 256 | public function GTK_STYLE_CONTEXT_GET_CLASS($o) 257 | { 258 | return $this->G_TYPE_INSTANCE_GET_CLASS($o, $this->GTK_TYPE_STYLE_CONTEXT, $this->type('GtkStyleContextClass')); 259 | } 260 | 261 | public function GTK_CHECK_VERSION($major, $minor, $micro) 262 | { 263 | return (GTK_MAJOR_VERSION > ($major) || 264 | (GTK_MAJOR_VERSION == ($major) && GTK_MINOR_VERSION > ($minor)) || 265 | (GTK_MAJOR_VERSION == ($major) && GTK_MINOR_VERSION == ($minor) && 266 | GTK_MICRO_VERSION >= ($micro))); 267 | } 268 | 269 | public function gtk_major_version() 270 | { 271 | return self::$ffi->gtk_get_major_version(); 272 | } 273 | 274 | public function gtk_minor_version() 275 | { 276 | return self::$ffi->gtk_get_minor_version(); 277 | } 278 | 279 | public function gtk_micro_version() 280 | { 281 | return self::$ffi->gtk_get_micro_version(); 282 | } 283 | 284 | public function gtk_binary_age() 285 | { 286 | return self::$ffi->gtk_get_binary_age(); 287 | } 288 | 289 | public function gtk_interface_age() 290 | { 291 | return self::$ffi->gtk_get_interface_age(); 292 | } 293 | 294 | public function gtk_widget_class_bind_template_callback($widget_class, $callback) 295 | { 296 | return self::$ffi->gtk_widget_class_bind_template_callback_full( 297 | $this->GTK_WIDGET_CLASS($widget_class), 298 | $callback, 299 | $this->G_CALLBACK($callback) 300 | ); 301 | } 302 | 303 | public function gtk_widget_class_bind_template_child($widget_class, $TypeName, $member_name) 304 | { 305 | return self::$ffi->gtk_widget_class_bind_template_child_full( 306 | $widget_class, 307 | $member_name, 308 | FALSE, 309 | $this->G_STRUCT_OFFSET($TypeName, $member_name) 310 | ); 311 | } 312 | 313 | public function gtk_widget_class_bind_template_child_internal($widget_class, $TypeName, $member_name) 314 | { 315 | return self::$ffi->gtk_widget_class_bind_template_child_full( 316 | $widget_class, 317 | $member_name, 318 | TRUE, 319 | $this->G_STRUCT_OFFSET($TypeName, $member_name) 320 | ); 321 | } 322 | 323 | public function gtk_widget_class_bind_template_child_private($widget_class, $TypeName, $member_name) 324 | { 325 | return self::$ffi->gtk_widget_class_bind_template_child_full( 326 | $widget_class, 327 | $member_name, 328 | FALSE, 329 | $this->G_PRIVATE_OFFSET($TypeName, $member_name) 330 | ); 331 | } 332 | 333 | public function gtk_widget_class_bind_template_child_internal_private($widget_class, $TypeName, $member_name) 334 | { 335 | return self::$ffi->gtk_widget_class_bind_template_child_full( 336 | $widget_class, 337 | $member_name, 338 | TRUE, 339 | $this->G_PRIVATE_OFFSET($TypeName, $member_name) 340 | ); 341 | } 342 | 343 | public function GTK_BUILDER_ERROR() 344 | { 345 | return self::$ffi->gtk_builder_error_quark(); 346 | } 347 | 348 | public function GTK_CONTAINER($obj) 349 | { 350 | return $this->G_TYPE_CHECK_INSTANCE_CAST($obj, $this->GTK_TYPE_CONTAINER(), 'GtkContainer'); 351 | } 352 | 353 | public function GTK_TYPE_CONTAINER() 354 | { 355 | return self::$ffi->gtk_container_get_type(); 356 | } 357 | 358 | public function GTK_BUILDER_WARN_INVALID_CHILD_TYPE($object, $type) 359 | { 360 | return $this->g_warning("'%s' is not a valid child type of '%s'", $type, $this->g_type_name($this->G_OBJECT_TYPE($object))); 361 | } 362 | 363 | public function GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID($object, $property_id, $pspec) 364 | { 365 | return $this->G_OBJECT_WARN_INVALID_PSPEC($object, "cell property id", $property_id, $pspec); 366 | } 367 | 368 | public function GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID($object, $property_id, $pspec) 369 | { 370 | return $this->G_OBJECT_WARN_INVALID_PSPEC($object, "child property", $property_id, $pspec); 371 | } 372 | 373 | public function GTK_CSS_PROVIDER_ERROR() 374 | { 375 | return self::$ffi->gtk_css_provider_error_quark(); 376 | } 377 | 378 | public function GTK_FILE_CHOOSER_ERROR() 379 | { 380 | return self::$ffi->gtk_file_chooser_error_quark(); 381 | } 382 | 383 | public function GTK_ICON_THEME_ERROR() 384 | { 385 | return self::$ffi->gtk_icon_theme_error_quark(); 386 | } 387 | 388 | public function GTK_IS_RESIZE_CONTAINER($widget) 389 | { 390 | return $this->GTK_IS_CONTAINER($widget) && 391 | (self::$ffi->gtk_container_get_resize_mode($this->GTK_CONTAINER($widget)) != $this->GTK_RESIZE_PARENT); 392 | } 393 | 394 | public function GTK_PRINT_ERROR() 395 | { 396 | return self::$ffi->gtk_print_error_quark(); 397 | } 398 | 399 | public function GTK_GRID_CLASS($klass) 400 | { 401 | return $this->G_TYPE_CHECK_CLASS_CAST($klass, $this->GTK_TYPE_GRID(), 'GtkGridClass'); 402 | } 403 | 404 | public function GTK_IS_GRID($obj) 405 | { 406 | return $this->G_TYPE_CHECK_INSTANCE_TYPE($obj, $this->GTK_TYPE_GRID()); 407 | } 408 | 409 | public function GTK_IS_GRID_CLASS($klass) 410 | { 411 | return $this->G_TYPE_CHECK_CLASS_TYPE($klass, $this->GTK_TYPE_GRID()); 412 | } 413 | 414 | public function GTK_GRID_GET_CLASS($obj) 415 | { 416 | return $this->G_TYPE_INSTANCE_GET_CLASS($obj, $this->GTK_TYPE_GRID(), 'GtkGridClass'); 417 | } 418 | 419 | } 420 | -------------------------------------------------------------------------------- /src/GtkAbstract.php: -------------------------------------------------------------------------------- 1 | initDebugStatus(); 45 | $this->main = $main; 46 | $this->headerDir = __DIR__ . '/include'; 47 | $this->struct(); 48 | $this->libdir = $libdir ?? (PHP_INT_SIZE === 4 ? '/usr/lib' : '/usr/lib64'); 49 | putenv("PATH={$this->libdir};" . getenv('PATH')); 50 | $this->recursiveCDef(); 51 | } 52 | 53 | final public function initDebugStatus() 54 | { 55 | self::$isDebug = (defined('PHP_GTK_DEV_DEBUG') && constant('PHP_GTK_DEV_DEBUG')); 56 | } 57 | 58 | final public function requireMinVersion($id, $currentVersion) 59 | { 60 | $requireVersion = $this->main::$gtkDllMap[$id]['require_version']; 61 | if(version_compare($requireVersion, $currentVersion) > 0) { 62 | $libname = $this->main::$gtkDllMap[$id]['name']; 63 | throw new RuntimeException("GTK lib '$libname' require version >= $requireVersion, current $currentVersion"); 64 | } 65 | } 66 | 67 | final protected function preLoad($id, $code) 68 | { 69 | $config = $this->main::$gtkDllMap[$id]; 70 | $libpath = $this->findDll($config['name']); 71 | return FFI::cdef($code, $libpath); 72 | } 73 | 74 | private function struct() 75 | { 76 | $this->struct = file_get_contents($this->headerDir . '/struct.h'); 77 | $args = trim(str_repeat('void*,', self::$gCallbackArgNum), ','); 78 | $this->struct = str_replace('##GCallbackArgListString##', $args, $this->struct); 79 | } 80 | 81 | protected function availableIn(&$code) 82 | { 83 | if(PHP_OS_WIN) { 84 | $code = str_replace("LIBGTK_FUNC_AVAILABLE_IN_UINX", '// ', $code); 85 | $code = str_replace("LIBGTK_FUNC_AVAILABLE_IN_WIN", 'extern ', $code); 86 | } else { 87 | $code = str_replace("LIBGTK_FUNC_AVAILABLE_IN_UINX ", 'extern ', $code); 88 | $code = str_replace("LIBGTK_FUNC_AVAILABLE_IN_WIN", '// ', $code); 89 | } 90 | } 91 | 92 | private function recursiveCDef() 93 | { 94 | $class = get_class($this); 95 | $this->initCDef($class); 96 | while($class = get_parent_class($class)) { 97 | $this->initCDef($class); 98 | } 99 | } 100 | 101 | protected static function compileVersion() 102 | { 103 | 104 | } 105 | 106 | private function declareException($class, $msg) 107 | { 108 | throw new RuntimeException("$class must declare '$msg'"); 109 | } 110 | 111 | private function checkDeclare($class) 112 | { 113 | $classRef = new ReflectionClass($class); 114 | try { 115 | $msg = 'protected static \$ffi'; 116 | $ffiRef = $classRef->getProperty('ffi'); 117 | if( 118 | $ffiRef->getDeclaringClass()->name !== $class || 119 | !$ffiRef->isStatic() || 120 | !$ffiRef->isProtected() 121 | ) { 122 | $this->declareException($class, $msg); 123 | } 124 | 125 | foreach(['ID', 'UNIMPLEMENT'] as $c) { 126 | $msg = "protected const $c"; 127 | $cr = $classRef->getReflectionConstant($c); 128 | if(($cr->getDeclaringClass()->name !== $class || !$cr->isProtected())) { 129 | $this->declareException($class, $msg); 130 | } 131 | } 132 | 133 | $msg = 'protected static compileVersion()'; 134 | $m = $classRef->getMethod('compileVersion'); 135 | 136 | if($m->getDeclaringClass()->name !== $class || !$m->isStatic() || !$m->isProtected()) { 137 | $this->declareException($class, $msg); 138 | } 139 | } catch(ReflectionException $e) { 140 | $this->declareException($class, $msg); 141 | } 142 | } 143 | 144 | private function initCDef($class) 145 | { 146 | if(self::$isDebug) { 147 | $this->checkDeclare($class); 148 | } 149 | if($class::$ffi === null && $class::ID) { 150 | $class::$ffi = $this->cdef($class::ID); 151 | $class::compileVersion(); 152 | $this->callMap[$class::ID] = $class::$ffi; 153 | self::$unimplement = array_merge(self::$unimplement, $class::UNIMPLEMENT); 154 | } 155 | } 156 | 157 | protected function findDll($name) 158 | { 159 | $r = glob($this->libdir . "/{$name}*." . PHP_SHLIB_SUFFIX, GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR); 160 | if($r) { 161 | return $r[0]; 162 | } 163 | throw new RuntimeException($this->libdir . "/{$name}*." . PHP_SHLIB_SUFFIX . ' not found'); 164 | } 165 | 166 | protected function versionReplace(&$code, $macro, $version, $currentVersion) 167 | { 168 | $v = str_replace('.', '_', $version); 169 | if(version_compare($currentVersion, $version) >= 0) { 170 | $code = str_replace("{$macro}_{$v} ", 'extern ', $code); 171 | } else { 172 | $code = str_replace("{$macro}_{$v} ", '// ', $code); 173 | } 174 | } 175 | 176 | private function cdef($libId) 177 | { 178 | $config = $this->main::$gtkDllMap[$libId]; 179 | $libpath = $this->findDll($config['name']); 180 | 181 | $code = ['struct' => $this->struct]; 182 | foreach($config['header'] as $h) { 183 | $code[$h] = file_get_contents($this->headerDir . "/$h.h"); 184 | } 185 | 186 | try { 187 | $codeStr = join($code); 188 | $this->availableIn($codeStr); 189 | $ffiObj = FFI::cdef($codeStr, $libpath); 190 | $ffiObj->id($libId); 191 | return $ffiObj; 192 | } catch(ParserException $e) { 193 | $this->debugException($e, $code); 194 | } catch(\FFI\Exception $e) { 195 | $this->debugException($e, $libpath); 196 | } 197 | } 198 | 199 | private function debugException($e, &$code) 200 | { 201 | $message = $e->getMessage(); 202 | if(self::$isDebug && is_array($code)) { 203 | $m = []; 204 | preg_match('(\d+)', $e->getMessage(), $m); 205 | foreach($code as $f => $c) { 206 | $fl = substr_count($c, "\n") + 1; 207 | if($m[0] > $fl) { 208 | $m[0] = $m[0] - $fl + 1; 209 | } else { 210 | break; 211 | } 212 | } 213 | $message .= "; Actual at line {$m[0]} in file $f.h"; 214 | } else { 215 | $message .= "; load $code"; 216 | } 217 | throw new ParserException($message, $e->getCode()); 218 | } 219 | 220 | public function type($type, ?GtkAbstract $obj = null) 221 | { 222 | $ffi = $this->currentFFI($obj); 223 | return $ffi->type($type); 224 | } 225 | 226 | public function new($type, bool $owned = true, bool $persistent = false, GtkAbstract $obj = null) 227 | { 228 | $ffi = $this->currentFFI($obj); 229 | return $this->main->new($type, $owned, $persistent, $ffi); 230 | } 231 | 232 | public function currentFFI($obj = null) 233 | { 234 | if($obj) { 235 | $ffi = $obj::$ffi; 236 | } elseif($obj === null) { 237 | $ffi = $this::$ffi; 238 | } else { 239 | $ffi = null; 240 | } 241 | return $ffi; 242 | } 243 | 244 | public function cast($type, CData $cdata, GtkAbstract $obj = null) 245 | { 246 | $ffi = $this->currentFFI($obj); 247 | return $this->main->cast($type, $cdata, $ffi); 248 | } 249 | 250 | public function trunCast(CData $i, array $type, GtkAbstract $obj = null) 251 | { 252 | $ffi = $this->currentFFI($obj); 253 | return $this->main->trunCast($i, $type, $ffi); 254 | } 255 | 256 | public function free($cdata) 257 | { 258 | return $this->main->free($cdata); 259 | } 260 | 261 | protected function dynCall($name, $arguments = [], &$ret = null) 262 | { 263 | 264 | } 265 | 266 | protected function dynGet($name, &$hasRet = false) 267 | { 268 | 269 | } 270 | 271 | final public function getFFIOfFunc($func) 272 | { 273 | foreach($this->callMap as $a) { 274 | if($a->ffiExt()->hasCFunc($a->getFFI(), $func)) { 275 | return $a; 276 | } 277 | } 278 | return null; 279 | } 280 | 281 | final public function __call($name, $arguments) 282 | { 283 | $ret = false; 284 | $dynReturn = $this->dynCall($name, $arguments, $ret); 285 | if($ret) { 286 | return $dynReturn; 287 | } 288 | 289 | foreach(self::$unimplement as $ps) { 290 | if($this->main->str0($name, $ps)) { 291 | throw new RuntimeException("C macro '$name' can not implemented or deprecated"); 292 | } 293 | } 294 | 295 | $ffi = $this->getFFIOfFunc($name); 296 | 297 | if($ffi !== null) { 298 | return $ffi->$name(...$arguments); 299 | } 300 | 301 | $macroFunc = "_MACRO_$name"; 302 | if(strtoupper($name) === $name && \method_exists($this, $macroFunc)) { 303 | return $this->$macroFunc(...$arguments); 304 | } 305 | 306 | $class = get_class($this); 307 | throw new BadMethodCallException("Call to undefined method $class::$name()"); 308 | } 309 | 310 | final public function __get($name) 311 | { 312 | $ret = false; 313 | $dynReturn = $this->dynGet($name, $ret); 314 | if($ret) { 315 | return $dynReturn; 316 | } 317 | 318 | foreach($this->callMap as $a) { 319 | if($a->ffiExt()->hasCVariable($a->getFFI(), $name)) { 320 | return $a->$name; 321 | }elseif($a->ffiExt()->hasCEnum($a->getFFI(), $name)) { 322 | return $a->$name; 323 | } 324 | } 325 | 326 | $class = get_class($this); 327 | try { 328 | $ref = new ReflectionProperty($this, $name); 329 | if($ref->isStatic()) { 330 | return $class::$$name; 331 | } else { 332 | return $this->$$name; 333 | } 334 | } catch(ReflectionException $e) { 335 | 336 | } 337 | 338 | throw new RuntimeException("Get undefined property $class::\$$name"); 339 | } 340 | 341 | } 342 | -------------------------------------------------------------------------------- /src/GtkWidget.php: -------------------------------------------------------------------------------- 1 | widget = $widget; 39 | } 40 | 41 | public function getCData() 42 | { 43 | return $this->widget; 44 | } 45 | 46 | public function __invoke() 47 | { 48 | return $this->widget; 49 | } 50 | 51 | public function parent($type) 52 | { 53 | $w = new static($this->widget); 54 | $w->type = $type; 55 | $w->gtkTypeCast = $w->getTypeCast(); 56 | $w->typeInstance = $w->castTypeInstance(); 57 | return $w; 58 | } 59 | 60 | public function container() 61 | { 62 | return $this->parent('GtkContainer'); 63 | } 64 | 65 | public function getTypeClass() 66 | { 67 | return $this->type; 68 | } 69 | 70 | public function getTypeInstance() 71 | { 72 | return $this->typeInstance; 73 | } 74 | 75 | public function getTypeCast() 76 | { 77 | return strtolower(substr(preg_replace('/([A-Z]{1,2})/', '_$1', $this->type), 1)); 78 | } 79 | 80 | /** 81 | * 82 | * @param string $sig 83 | * @param callable $callable 84 | * @param mix $data 85 | */ 86 | public function sConnect($sig, $callable, $data = null) 87 | { 88 | return self::$gtkApp->g_signal_connect($this->widget, $sig, self::$gtkApp->G_CALLBACK($callable), $data); 89 | } 90 | 91 | public function sConnectS($sig, $callable, $data) 92 | { 93 | self::castWidget($data); 94 | return self::$gtkApp->g_signal_connect_swapped($this->widget, $sig, self::$gtkApp->G_CALLBACK($callable), $data); 95 | } 96 | 97 | public function sConnectA($sig, $callable, $data) 98 | { 99 | self::castWidget($data); 100 | return self::$gtkApp->g_signal_connect_after($this->widget, $sig, self::$gtkApp->G_CALLBACK($callable), $data); 101 | } 102 | 103 | protected function castTypeInstance() 104 | { 105 | $typeCast = strtoupper($this->gtkTypeCast); 106 | return self::$gtkApp->$typeCast($this->widget, $this->type); 107 | } 108 | 109 | protected function setTypeClass() 110 | { 111 | $this->type = self::$gtkApp->G_OBJECT_CLASS_NAME($this->widget->parent_instance->g_type_instance); 112 | $this->gtkTypeCast = $this->getTypeCast(); 113 | $this->typeInstance = $this->castTypeInstance(); 114 | } 115 | 116 | public static function castWidget(&$args) 117 | { 118 | if(is_array($args)) { 119 | foreach($args as &$arg) { 120 | self::castWidget($arg); 121 | } 122 | } else { 123 | if($args instanceof GtkWidget) { 124 | $args = $args->getCData(); 125 | } 126 | } 127 | } 128 | 129 | /** 130 | * 131 | * @param string $name 132 | * @param array $arguments 133 | * @return FFI\CData 134 | */ 135 | public function __call($name, $arguments = []) 136 | { 137 | self::castWidget($arguments); 138 | $fn = "{$this->gtkTypeCast}_{$name}"; 139 | $wfn = "gtk_widget_{$name}"; 140 | if(self::$gtkApp->ffi->hasCFunc($fn)) { 141 | $res = self::$gtkApp->$fn($this->typeInstance, ...$arguments); 142 | } elseif(self::$gtkApp->ffi->hasCFunc($wfn)) { 143 | $res = self::$gtkApp->$wfn($this->widget, ...$arguments); 144 | } 145 | if($res instanceof \FFI\CData) { 146 | $struct = self::$gtkApp->ffi->getCDataType($res); 147 | if($struct === 'struct _GtkWidget' || $struct === 'struct _GtkWidget*') { 148 | $w = new static($res); 149 | $w->setTypeClass(); 150 | return $w; 151 | } 152 | } 153 | return $res; 154 | } 155 | 156 | /** 157 | * 158 | * @param sttring $name 159 | * @param array $args 160 | * @return GtkWidget 161 | */ 162 | public static function __callStatic($name, $args = []) 163 | { 164 | self::castWidget($args); 165 | $res = self::$gtkApp->$name(...$args); 166 | if($res instanceof \FFI\CData) { 167 | $struct = self::$gtkApp->ffi->getCDataType($res); 168 | if($struct === 'struct _GtkWidget' || $struct === 'struct _GtkWidget*') { 169 | $w = new static($res); 170 | $w->setTypeClass(); 171 | return $w; 172 | } 173 | } 174 | return $res; 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /src/PHPGtk.php: -------------------------------------------------------------------------------- 1 | ['name' => 'libglib', 'header' => ['glib'], 'require_version' => '2.56'], 43 | self::GIO_ID => ['name' => 'libgio', 'header' => ['gio']], 44 | self::GOBJECT_ID => ['name' => 'libgobject', 'header' => ['gtype', 'gobject']], 45 | self::GTK_ID => ['name' => 'libgtk', 'header' => ['gtkfunc']], 46 | self::GDK_ID => ['name' => 'libgdk', 'header' => ['gdk'], 'require_version' => '3.20'], 47 | self::PIXBUF_ID => ['name' => 'libgdk_pixbuf', 'header' => ['pixbuf'], 'require_version' => '2.36'], 48 | self::PANGO_ID => ['name' => 'libpango', 'header' => ['pango'], 'require_version' => '1.42'], 49 | self::PANGO_CAIRO_ID => ['name' => 'libpangocairo', 'header' => ['pango_cairo']], 50 | self::ATK_ID => ['name' => 'libatk', 'header' => ['atk'], 'require_version' => '2.28'], 51 | ]; 52 | 53 | private function __construct(?string $libdir = null) 54 | { 55 | if(!defined('PHP_GTK_DEV_DEBUG')) { 56 | define('PHP_GTK_DEV_DEBUG', false); 57 | } 58 | self::$singleton = $this; 59 | $this->defineIsWin(); 60 | $this->autoload(); 61 | self::$unmanagedCData = new SplObjectStorage; 62 | self::$libdir = $libdir; 63 | $this->gtkLib = new Gtk($this, $libdir); 64 | } 65 | 66 | private function defineIsWin() 67 | { 68 | if(!defined('PHP_OS_WIN') && strcasecmp(PHP_OS_FAMILY, 'Windows') === 0) { 69 | define('PHP_OS_WIN', true); 70 | } else { 71 | define('PHP_OS_WIN', false); 72 | } 73 | } 74 | 75 | public function str0(string $str, string $begin): bool 76 | { 77 | return strpos($str, $begin) === 0; 78 | } 79 | 80 | public function new($type, $owned = true, $persistent = false, FFI $ffi = null): CData 81 | { 82 | if($ffi) { 83 | $cdata = $ffi->new($type, $owned, $persistent); 84 | } elseif($this->gtkLib) { 85 | $cdata = $this->gtkLib->new($type, $owned, $persistent); 86 | } else { 87 | $cdata = FFI::new($type, $owned, $persistent); 88 | } 89 | if(!$owned) { 90 | self::$unmanagedCData->attach($cdata); 91 | } 92 | return $cdata; 93 | } 94 | 95 | public function free($cdata = null): bool 96 | { 97 | if($cdata) { 98 | FFI::free($cdata); 99 | if(self::$unmanagedCData->contains($cdata)) { 100 | self::$unmanagedCData->detach($cdata); 101 | } 102 | return true; 103 | } 104 | foreach(self::$unmanagedCData as $cdata) { 105 | FFI::free($cdata); 106 | self::$unmanagedCData->detach($cdata); 107 | } 108 | return true; 109 | } 110 | 111 | public function trunCast(CData $i, array $type, $ffi = null) 112 | { 113 | if(count($type) < 1) { 114 | throw new InvalidArgumentException(__METHOD__ . "() paramter 2 can not empty array"); 115 | } 116 | foreach($type as $t) { 117 | $i = $this->cast($t, $i, $ffi); 118 | } 119 | return $i; 120 | } 121 | 122 | public function cast($type, CData $i, $ffi = null) 123 | { 124 | return $ffi ? $ffi->cast($type, $i) : ($this->gtkLib ? $this->gtkLib->cast($type, $i) : FFI::cast($type, $i)); 125 | } 126 | 127 | public function addr($v) 128 | { 129 | return FFI::addr($v); 130 | } 131 | 132 | public static function gtk(?string $libdir = null) 133 | { 134 | if(self::$singleton === null) { 135 | self::$singleton = new static($libdir); 136 | } 137 | return self::$singleton; 138 | } 139 | 140 | public static function atk(?string $libdir = null) 141 | { 142 | if(self::$singleton === null) { 143 | self::gtk($libdir); 144 | } 145 | return new Atk(self::$singleton, self::$libdir); 146 | } 147 | 148 | public static function pixbuf(?string $libdir = null) 149 | { 150 | if(self::$singleton === null) { 151 | self::gtk($libdir); 152 | } 153 | return new Pixbuf(self::$singleton, self::$libdir); 154 | } 155 | 156 | public static function pango(?string $libdir = null) 157 | { 158 | if(self::$singleton === null) { 159 | self::gtk($libdir); 160 | } 161 | return new Pango(self::$singleton, self::$libdir); 162 | } 163 | 164 | 165 | public function __get($name) 166 | { 167 | return $this->gtkLib->$name; 168 | } 169 | 170 | public function __set($name, $v) 171 | { 172 | return $this->gtkLib->$name = $v; 173 | } 174 | 175 | public function __call($name, $arguments) 176 | { 177 | return $this->gtkLib->$name(...$arguments); 178 | } 179 | 180 | public function autoload() 181 | { 182 | spl_autoload_register(function ($class) { 183 | $classInfo = explode('\\', $class); 184 | array_shift($classInfo); 185 | array_unshift($classInfo, __DIR__); 186 | $path = join(DIRECTORY_SEPARATOR, $classInfo) . '.php'; 187 | if(file_exists($path)) { 188 | include_once $path; 189 | } 190 | }); 191 | } 192 | 193 | public function __destruct() 194 | { 195 | $this->free(); 196 | } 197 | 198 | } 199 | -------------------------------------------------------------------------------- /src/Pango.php: -------------------------------------------------------------------------------- 1 | pango_version_string()); 29 | define('PANGO_VERSION', self::$ffi->pango_version()); 30 | $v = explode('.', PANGO_VERSION_STRING); 31 | define('PANGO_VERSION_MAJOR', $v[0]); 32 | define('PANGO_VERSION_MINOR', $v[1]); 33 | define('PANGO_VERSION_MICRO', $v[2]); 34 | } 35 | 36 | protected function availableIn(&$code) 37 | { 38 | parent::availableIn($code); 39 | $version = $this->preLoad(self::ID, 'const char *pango_version_string (void);')->pango_version_string(); 40 | $this->requireMinVersion(self::ID, $version); 41 | $this->versionReplace($code, 'PANGO_AVAILABLE_IN', '1.44', $version); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/PangoCairo.php: -------------------------------------------------------------------------------- 1 | gdk_pixbuf_version); 29 | define('GDK_PIXBUF_MAJOR', self::$ffi->gdk_pixbuf_major_version); 30 | define('GDK_PIXBUF_MINOR', self::$ffi->gdk_pixbuf_minor_version); 31 | define('GDK_PIXBUF_MICRO', self::$ffi->gdk_pixbuf_micro_version); 32 | } 33 | 34 | protected function availableIn(&$code) 35 | { 36 | parent::availableIn($code); 37 | $v = $this->preLoad(self::ID, 'const char *gdk_pixbuf_version;')->gdk_pixbuf_version; 38 | $this->requireMinVersion(self::ID, $v); 39 | $this->versionReplace($code, 'GDK_PIXBUF_AVAILABLE_IN', '2.40', $v); 40 | $this->versionReplace($code, 'GDK_PIXBUF_AVAILABLE_IN', '2.38', $v); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/include/atk.h: -------------------------------------------------------------------------------- 1 | extern guint atk_get_major_version(void); 2 | extern guint atk_get_minor_version(void); 3 | extern guint atk_get_micro_version(void); 4 | extern guint atk_get_binary_age(void); 5 | extern guint atk_get_interface_age(void); 6 | extern AtkStateType atk_state_type_register(const gchar *name); 7 | extern const gchar* atk_state_type_get_name(AtkStateType type); 8 | extern AtkStateType atk_state_type_for_name(const gchar *name); 9 | extern GType atk_object_get_type(void); 10 | extern GType atk_implementor_get_type(void); 11 | extern AtkObject* atk_implementor_ref_accessible(AtkImplementor *implementor); 12 | extern const gchar* atk_object_get_name(AtkObject *accessible); 13 | extern const gchar* atk_object_get_description(AtkObject *accessible); 14 | extern AtkObject* atk_object_get_parent(AtkObject *accessible); 15 | extern AtkObject* atk_object_peek_parent(AtkObject *accessible); 16 | extern gint atk_object_get_n_accessible_children(AtkObject *accessible); 17 | extern AtkObject* atk_object_ref_accessible_child(AtkObject *accessible, gint i); 18 | extern AtkRelationSet* atk_object_ref_relation_set(AtkObject *accessible); 19 | extern AtkRole atk_object_get_role(AtkObject *accessible); 20 | extern AtkLayer atk_object_get_layer(AtkObject *accessible); 21 | extern gint atk_object_get_mdi_zorder(AtkObject *accessible); 22 | extern AtkAttributeSet* atk_object_get_attributes(AtkObject *accessible); 23 | extern AtkStateSet* atk_object_ref_state_set(AtkObject *accessible); 24 | extern gint atk_object_get_index_in_parent(AtkObject *accessible); 25 | extern void atk_object_set_name(AtkObject *accessible, const gchar *name); 26 | extern void atk_object_set_description(AtkObject *accessible, const gchar *description); 27 | extern void atk_object_set_parent(AtkObject *accessible, AtkObject *parent); 28 | extern void atk_object_set_role(AtkObject *accessible, AtkRole role); 29 | extern guint atk_object_connect_property_change_handler(AtkObject *accessible, AtkPropertyChangeHandler *handler); 30 | extern void atk_object_remove_property_change_handler(AtkObject *accessible, guint handler_id); 31 | extern void atk_object_notify_state_change(AtkObject *accessible, AtkState state, gboolean value); 32 | extern void atk_object_initialize(AtkObject *accessible, gpointer data); 33 | extern const gchar* atk_role_get_name(AtkRole role); 34 | extern AtkRole atk_role_for_name(const gchar *name); 35 | extern gboolean atk_object_add_relationship(AtkObject *object, AtkRelationType relationship, AtkObject *target); 36 | extern gboolean atk_object_remove_relationship(AtkObject *object, AtkRelationType relationship, AtkObject *target); 37 | extern const gchar* atk_role_get_localized_name(AtkRole role); 38 | extern AtkRole atk_role_register(const gchar *name); 39 | extern const gchar* atk_object_get_object_locale(AtkObject *accessible); 40 | LIBGTK_FUNC_AVAILABLE_IN_UINX const gchar* atk_object_get_accessible_id(AtkObject *accessible); 41 | LIBGTK_FUNC_AVAILABLE_IN_UINX void atk_object_set_accessible_id(AtkObject *accessible, const gchar *name); 42 | extern GType atk_action_get_type(void); 43 | extern gboolean atk_action_do_action(AtkAction *action, gint i); 44 | extern gint atk_action_get_n_actions(AtkAction *action); 45 | extern const gchar* atk_action_get_description(AtkAction *action, gint i); 46 | extern const gchar* atk_action_get_name(AtkAction *action, gint i); 47 | extern const gchar* atk_action_get_keybinding(AtkAction *action, gint i); 48 | extern gboolean atk_action_set_description(AtkAction *action, gint i, const gchar *desc); 49 | extern const gchar* atk_action_get_localized_name(AtkAction *action, gint i); 50 | extern GType atk_util_get_type(void); 51 | extern guint atk_add_focus_tracker(AtkEventListener focus_tracker); 52 | extern void atk_remove_focus_tracker(guint tracker_id); 53 | extern void atk_focus_tracker_init(AtkEventListenerInit init); 54 | extern void atk_focus_tracker_notify(AtkObject *object); 55 | extern guint atk_add_global_event_listener(GSignalEmissionHook listener, const gchar *event_type); 56 | extern void atk_remove_global_event_listener(guint listener_id); 57 | extern guint atk_add_key_event_listener(AtkKeySnoopFunc listener, gpointer data); 58 | extern void atk_remove_key_event_listener(guint listener_id); 59 | extern AtkObject* atk_get_root(void); 60 | extern AtkObject* atk_get_focus_object(void); 61 | extern const gchar *atk_get_toolkit_name(void); 62 | extern const gchar *atk_get_toolkit_version(void); 63 | extern const gchar *atk_get_version(void); 64 | extern GType atk_rectangle_get_type(void); 65 | extern GType atk_component_get_type(void); 66 | extern guint atk_component_add_focus_handler(AtkComponent *component, AtkFocusHandler handler); 67 | extern gboolean atk_component_contains(AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 68 | extern AtkObject* atk_component_ref_accessible_at_point(AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 69 | extern void atk_component_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); 70 | extern void atk_component_get_position(AtkComponent *component, gint *x, gint *y, AtkCoordType coord_type); 71 | extern void atk_component_get_size(AtkComponent *component, gint *width, gint *height); 72 | extern AtkLayer atk_component_get_layer(AtkComponent *component); 73 | extern gint atk_component_get_mdi_zorder(AtkComponent *component); 74 | extern gboolean atk_component_grab_focus(AtkComponent *component); 75 | extern void atk_component_remove_focus_handler(AtkComponent *component, guint handler_id); 76 | extern gboolean atk_component_set_extents(AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type); 77 | extern gboolean atk_component_set_position(AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 78 | extern gboolean atk_component_set_size(AtkComponent *component, gint width, gint height); 79 | extern gdouble atk_component_get_alpha(AtkComponent *component); 80 | ATK_AVAILABLE_IN_2_30 gboolean atk_component_scroll_to(AtkComponent *component, AtkScrollType type); 81 | ATK_AVAILABLE_IN_2_30 gboolean atk_component_scroll_to_point(AtkComponent *component, AtkCoordType coords, gint x, gint y); 82 | extern GType atk_document_get_type(void); 83 | extern const gchar* atk_document_get_document_type(AtkDocument *document); 84 | extern gpointer atk_document_get_document(AtkDocument *document); 85 | extern const gchar* atk_document_get_locale(AtkDocument *document); 86 | extern AtkAttributeSet* atk_document_get_attributes(AtkDocument *document); 87 | extern const gchar* atk_document_get_attribute_value(AtkDocument *document, const gchar *attribute_name); 88 | extern gboolean atk_document_set_attribute_value(AtkDocument *document, const gchar *attribute_name, const gchar *attribute_value); 89 | extern gint atk_document_get_current_page_number(AtkDocument *document); 90 | extern gint atk_document_get_page_count(AtkDocument *document); 91 | extern AtkTextAttribute atk_text_attribute_register(const gchar *name); 92 | extern GType atk_text_range_get_type(void); 93 | extern GType atk_text_get_type(void); 94 | extern gchar* atk_text_get_text(AtkText *text, gint start_offset, gint end_offset); 95 | extern gunichar atk_text_get_character_at_offset(AtkText *text, gint offset); 96 | extern gchar* atk_text_get_text_after_offset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); 97 | extern gchar* atk_text_get_text_at_offset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); 98 | extern gchar* atk_text_get_text_before_offset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset); 99 | extern gchar* atk_text_get_string_at_offset(AtkText *text, gint offset, AtkTextGranularity granularity, gint *start_offset, gint *end_offset); 100 | extern gint atk_text_get_caret_offset(AtkText *text); 101 | extern void atk_text_get_character_extents(AtkText *text, gint offset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords); 102 | extern AtkAttributeSet* atk_text_get_run_attributes(AtkText *text, gint offset, gint *start_offset, gint *end_offset); 103 | extern AtkAttributeSet* atk_text_get_default_attributes(AtkText *text); 104 | extern gint atk_text_get_character_count(AtkText *text); 105 | extern gint atk_text_get_offset_at_point(AtkText *text, gint x, gint y, AtkCoordType coords); 106 | extern gint atk_text_get_n_selections(AtkText *text); 107 | extern gchar* atk_text_get_selection(AtkText *text, gint selection_num, gint *start_offset, gint *end_offset); 108 | extern gboolean atk_text_add_selection(AtkText *text, gint start_offset, gint end_offset); 109 | extern gboolean atk_text_remove_selection(AtkText *text, gint selection_num); 110 | extern gboolean atk_text_set_selection(AtkText *text, gint selection_num, gint start_offset, gint end_offset); 111 | extern gboolean atk_text_set_caret_offset(AtkText *text, gint offset); 112 | extern void atk_text_get_range_extents(AtkText *text, gint start_offset, gint end_offset, AtkCoordType coord_type, AtkTextRectangle *rect); 113 | extern AtkTextRange** atk_text_get_bounded_ranges(AtkText *text, AtkTextRectangle *rect, AtkCoordType coord_type, AtkTextClipType x_clip_type, AtkTextClipType y_clip_type); 114 | extern void atk_text_free_ranges(AtkTextRange **ranges); 115 | extern void atk_attribute_set_free(AtkAttributeSet *attrib_set); 116 | extern const gchar* atk_text_attribute_get_name(AtkTextAttribute attr); 117 | extern AtkTextAttribute atk_text_attribute_for_name(const gchar *name); 118 | extern const gchar* atk_text_attribute_get_value(AtkTextAttribute attr, gint index_); 119 | LIBGTK_FUNC_AVAILABLE_IN_UINX gboolean atk_text_scroll_substring_to(AtkText *text, gint start_offset, gint end_offset, AtkScrollType type); 120 | LIBGTK_FUNC_AVAILABLE_IN_UINX gboolean atk_text_scroll_substring_to_point(AtkText *text, gint start_offset, gint end_offset, AtkCoordType coords, gint x, gint y); 121 | extern GType atk_editable_text_get_type(void); 122 | extern gboolean atk_editable_text_set_run_attributes(AtkEditableText *text, AtkAttributeSet *attrib_set, gint start_offset, gint end_offset); 123 | extern void atk_editable_text_set_text_contents(AtkEditableText *text, const gchar *string); 124 | extern void atk_editable_text_insert_text(AtkEditableText *text, const gchar *string, gint length, gint *position); 125 | extern void atk_editable_text_copy_text(AtkEditableText *text, gint start_pos, gint end_pos); 126 | extern void atk_editable_text_cut_text(AtkEditableText *text, gint start_pos, gint end_pos); 127 | extern void atk_editable_text_delete_text(AtkEditableText *text, gint start_pos, gint end_pos); 128 | extern void atk_editable_text_paste_text(AtkEditableText *text, gint position); 129 | LIBGTK_FUNC_AVAILABLE_IN_UINX GType atk_scroll_type_get_type(void); 130 | extern GType atk_hyperlink_state_flags_get_type(void); 131 | extern GType atk_role_get_type(void); 132 | extern GType atk_layer_get_type(void); 133 | extern GType atk_relation_type_get_type(void); 134 | extern GType atk_state_type_get_type(void); 135 | extern GType atk_text_attribute_get_type(void); 136 | extern GType atk_text_boundary_get_type(void); 137 | extern GType atk_text_granularity_get_type(void); 138 | extern GType atk_text_clip_type_get_type(void); 139 | extern GType atk_key_event_type_get_type(void); 140 | extern GType atk_coord_type_get_type(void); 141 | extern GType atk_value_type_get_type(void); 142 | extern GType atk_gobject_accessible_get_type(void); 143 | extern AtkObject *atk_gobject_accessible_for_object(GObject *obj); 144 | extern GObject *atk_gobject_accessible_get_object(AtkGObjectAccessible *obj); 145 | GType atk_hyperlink_get_type(void); 146 | extern gchar* atk_hyperlink_get_uri(AtkHyperlink *link_, gint i); 147 | extern AtkObject* atk_hyperlink_get_object(AtkHyperlink *link_, gint i); 148 | extern gint atk_hyperlink_get_end_index(AtkHyperlink *link_); 149 | extern gint atk_hyperlink_get_start_index(AtkHyperlink *link_); 150 | extern gboolean atk_hyperlink_is_valid(AtkHyperlink *link_); 151 | extern gboolean atk_hyperlink_is_inline(AtkHyperlink *link_); 152 | extern gint atk_hyperlink_get_n_anchors(AtkHyperlink *link_); 153 | extern gboolean atk_hyperlink_is_selected_link(AtkHyperlink *link_); 154 | extern GType atk_hyperlink_impl_get_type(void); 155 | extern AtkHyperlink *atk_hyperlink_impl_get_hyperlink(AtkHyperlinkImpl *impl); 156 | extern GType atk_hypertext_get_type(void); 157 | extern AtkHyperlink* atk_hypertext_get_link(AtkHypertext *hypertext, gint link_index); 158 | extern gint atk_hypertext_get_n_links(AtkHypertext *hypertext); 159 | extern gint atk_hypertext_get_link_index(AtkHypertext *hypertext, gint char_index); 160 | extern GType atk_image_get_type(void); 161 | extern const gchar* atk_image_get_image_description(AtkImage *image); 162 | extern void atk_image_get_image_size(AtkImage *image, gint *width, gint *height); 163 | extern gboolean atk_image_set_image_description(AtkImage *image, const gchar *description); 164 | extern void atk_image_get_image_position(AtkImage *image, gint *x, gint *y, AtkCoordType coord_type); 165 | extern const gchar* atk_image_get_image_locale(AtkImage *image); 166 | extern GType atk_no_op_object_get_type(void); 167 | extern AtkObject *atk_no_op_object_new(GObject *obj); 168 | extern GType atk_object_factory_get_type(void); 169 | extern AtkObject* atk_object_factory_create_accessible(AtkObjectFactory *factory, GObject *obj); 170 | extern void atk_object_factory_invalidate(AtkObjectFactory *factory); 171 | extern GType atk_object_factory_get_accessible_type(AtkObjectFactory *factory); 172 | extern GType atk_no_op_object_factory_get_type(void); 173 | extern AtkObjectFactory *atk_no_op_object_factory_new(void); 174 | extern GType atk_plug_get_type(void); 175 | extern AtkObject* atk_plug_new(void); 176 | extern gchar* atk_plug_get_id(AtkPlug* plug); 177 | extern GType atk_range_get_type(void); 178 | extern AtkRange* atk_range_copy(AtkRange *src); 179 | extern void atk_range_free(AtkRange *range); 180 | extern gdouble atk_range_get_lower_limit(AtkRange *range); 181 | extern gdouble atk_range_get_upper_limit(AtkRange *range); 182 | extern const gchar* atk_range_get_description(AtkRange *range); 183 | extern AtkRange* atk_range_new(gdouble lower_limit, gdouble upper_limit, const gchar *description); 184 | extern GType atk_registry_get_type(void); 185 | extern void atk_registry_set_factory_type(AtkRegistry *registry, GType type, GType factory_type); 186 | extern GType atk_registry_get_factory_type(AtkRegistry *registry, GType type); 187 | extern AtkObjectFactory* atk_registry_get_factory(AtkRegistry *registry, GType type); 188 | extern AtkRegistry* atk_get_default_registry(void); 189 | extern GType atk_relation_get_type(void); 190 | extern AtkRelationType atk_relation_type_register(const gchar *name); 191 | extern const gchar* atk_relation_type_get_name(AtkRelationType type); 192 | extern AtkRelationType atk_relation_type_for_name(const gchar *name); 193 | extern AtkRelation* atk_relation_new(AtkObject **targets, gint n_targets, AtkRelationType relationship); 194 | extern AtkRelationType atk_relation_get_relation_type(AtkRelation *relation); 195 | extern GPtrArray* atk_relation_get_target(AtkRelation *relation); 196 | extern void atk_relation_add_target(AtkRelation *relation, AtkObject *target); 197 | extern gboolean atk_relation_remove_target(AtkRelation *relation, AtkObject *target); 198 | extern GType atk_relation_set_get_type(void); 199 | extern AtkRelationSet* atk_relation_set_new(void); 200 | extern gboolean atk_relation_set_contains(AtkRelationSet *set, AtkRelationType relationship); 201 | extern gboolean atk_relation_set_contains_target(AtkRelationSet *set, AtkRelationType relationship, AtkObject *target); 202 | extern void atk_relation_set_remove(AtkRelationSet *set, AtkRelation *relation); 203 | extern void atk_relation_set_add(AtkRelationSet *set, AtkRelation *relation); 204 | extern gint atk_relation_set_get_n_relations(AtkRelationSet *set); 205 | extern AtkRelation* atk_relation_set_get_relation(AtkRelationSet *set, gint i); 206 | extern AtkRelation* atk_relation_set_get_relation_by_type(AtkRelationSet *set, AtkRelationType relationship); 207 | extern void atk_relation_set_add_relation_by_type(AtkRelationSet *set, AtkRelationType relationship, AtkObject *target); 208 | extern GType atk_selection_get_type(void); 209 | extern gboolean atk_selection_add_selection(AtkSelection *selection, gint i); 210 | extern gboolean atk_selection_clear_selection(AtkSelection *selection); 211 | extern AtkObject* atk_selection_ref_selection(AtkSelection *selection, gint i); 212 | extern gint atk_selection_get_selection_count(AtkSelection *selection); 213 | extern gboolean atk_selection_is_child_selected(AtkSelection *selection, gint i); 214 | extern gboolean atk_selection_remove_selection(AtkSelection *selection, gint i); 215 | extern gboolean atk_selection_select_all_selection(AtkSelection *selection); 216 | extern GType atk_socket_get_type(void); 217 | extern AtkObject* atk_socket_new(void); 218 | extern void atk_socket_embed(AtkSocket* obj, gchar* plug_id); 219 | extern gboolean atk_socket_is_occupied(AtkSocket* obj); 220 | extern GType atk_state_set_get_type(void); 221 | extern AtkStateSet* atk_state_set_new(void); 222 | extern gboolean atk_state_set_is_empty(AtkStateSet *set); 223 | extern gboolean atk_state_set_add_state(AtkStateSet *set, AtkStateType type); 224 | extern void atk_state_set_add_states(AtkStateSet *set, AtkStateType *types, gint n_types); 225 | extern void atk_state_set_clear_states(AtkStateSet *set); 226 | extern gboolean atk_state_set_contains_state(AtkStateSet *set, AtkStateType type); 227 | extern gboolean atk_state_set_contains_states(AtkStateSet *set, AtkStateType *types, gint n_types); 228 | extern gboolean atk_state_set_remove_state(AtkStateSet *set, AtkStateType type); 229 | extern AtkStateSet* atk_state_set_and_sets(AtkStateSet *set, AtkStateSet *compare_set); 230 | extern AtkStateSet* atk_state_set_or_sets(AtkStateSet *set, AtkStateSet *compare_set); 231 | extern AtkStateSet* atk_state_set_xor_sets(AtkStateSet *set, AtkStateSet *compare_set); 232 | extern GType atk_streamable_content_get_type(void); 233 | extern gint atk_streamable_content_get_n_mime_types(AtkStreamableContent *streamable); 234 | extern const gchar* atk_streamable_content_get_mime_type(AtkStreamableContent *streamable, gint i); 235 | extern GIOChannel* atk_streamable_content_get_stream(AtkStreamableContent *streamable, const gchar *mime_type); 236 | extern const gchar* atk_streamable_content_get_uri(AtkStreamableContent *streamable, const gchar *mime_type); 237 | extern GType atk_table_get_type(void); 238 | extern AtkObject* atk_table_ref_at(AtkTable *table, gint row, gint column); 239 | extern gint atk_table_get_index_at(AtkTable *table, gint row, gint column); 240 | extern gint atk_table_get_column_at_index(AtkTable *table, gint index_); 241 | extern gint atk_table_get_row_at_index(AtkTable *table, gint index_); 242 | extern gint atk_table_get_n_columns(AtkTable *table); 243 | extern gint atk_table_get_n_rows(AtkTable *table); 244 | extern gint atk_table_get_column_extent_at(AtkTable *table, gint row, gint column); 245 | extern gint atk_table_get_row_extent_at(AtkTable *table, gint row, gint column); 246 | extern AtkObject*atk_table_get_caption(AtkTable *table); 247 | extern const gchar* atk_table_get_column_description(AtkTable *table, gint column); 248 | extern AtkObject* atk_table_get_column_header(AtkTable *table, gint column); 249 | extern const gchar* atk_table_get_row_description(AtkTable *table, gint row); 250 | extern AtkObject* atk_table_get_row_header(AtkTable *table, gint row); 251 | extern AtkObject* atk_table_get_summary(AtkTable *table); 252 | extern void atk_table_set_caption(AtkTable *table, AtkObject *caption); 253 | extern void atk_table_set_column_description(AtkTable *table, gint column, const gchar *description); 254 | extern void atk_table_set_column_header(AtkTable *table, gint column, AtkObject *header); 255 | extern void atk_table_set_row_description(AtkTable *table, gint row, const gchar *description); 256 | extern void atk_table_set_row_header(AtkTable *table, gint row, AtkObject *header); 257 | extern void atk_table_set_summary(AtkTable *table, AtkObject *accessible); 258 | extern gint atk_table_get_selected_columns(AtkTable *table, gint **selected); 259 | extern gint atk_table_get_selected_rows(AtkTable *table, gint **selected); 260 | extern gboolean atk_table_is_column_selected(AtkTable *table, gint column); 261 | extern gboolean atk_table_is_row_selected(AtkTable *table, gint row); 262 | extern gboolean atk_table_is_selected(AtkTable *table, gint row, gint column); 263 | extern gboolean atk_table_add_row_selection(AtkTable *table, gint row); 264 | extern gboolean atk_table_remove_row_selection(AtkTable *table, gint row); 265 | extern gboolean atk_table_add_column_selection(AtkTable *table, gint column); 266 | extern gboolean atk_table_remove_column_selection(AtkTable *table, gint column); 267 | extern GType atk_table_cell_get_type(void); 268 | extern gint atk_table_cell_get_column_span(AtkTableCell *cell); 269 | extern GPtrArray * atk_table_cell_get_column_header_cells(AtkTableCell *cell); 270 | extern gboolean atk_table_cell_get_position(AtkTableCell *cell, gint *row, gint *column); 271 | extern gint atk_table_cell_get_row_span(AtkTableCell *cell); 272 | extern GPtrArray * atk_table_cell_get_row_header_cells(AtkTableCell *cell); 273 | extern gboolean atk_table_cell_get_row_column_span(AtkTableCell *cell, gint *row, gint *column, gint *row_span, gint *column_span); 274 | extern AtkObject * atk_table_cell_get_table(AtkTableCell *cell); 275 | extern GType atk_misc_get_type(void); 276 | extern void atk_misc_threads_enter(AtkMisc *misc); 277 | extern void atk_misc_threads_leave(AtkMisc *misc); 278 | extern const AtkMisc *atk_misc_get_instance(void); 279 | extern GType atk_value_get_type(void); 280 | extern void atk_value_get_current_value(AtkValue *obj, GValue *value); 281 | extern void atk_value_get_maximum_value(AtkValue *obj, GValue *value); 282 | extern void atk_value_get_minimum_value(AtkValue *obj, GValue *value); 283 | extern gboolean atk_value_set_current_value(AtkValue *obj, const GValue *value); 284 | extern void atk_value_get_minimum_increment(AtkValue *obj, GValue *value); 285 | extern void atk_value_get_value_and_text(AtkValue *obj, gdouble *value, gchar **text); 286 | extern AtkRange* atk_value_get_range(AtkValue *obj); 287 | extern gdouble atk_value_get_increment(AtkValue *obj); 288 | extern GSList* atk_value_get_sub_ranges(AtkValue *obj); 289 | extern void atk_value_set_value(AtkValue *obj, const gdouble new_value); 290 | extern const gchar* atk_value_type_get_name(AtkValueType value_type); 291 | extern const gchar* atk_value_type_get_localized_name(AtkValueType value_type); 292 | extern GType atk_window_get_type(void); 293 | extern AtkMisc *atk_misc_instance; -------------------------------------------------------------------------------- /src/include/gio.h: -------------------------------------------------------------------------------- 1 | extern 2 | GType g_application_get_type(void); 3 | extern 4 | gboolean g_application_id_is_valid(const gchar *application_id); 5 | extern 6 | GApplication * g_application_new(const gchar *application_id, GApplicationFlags flags); 7 | extern 8 | const gchar * g_application_get_application_id(GApplication *application); 9 | extern 10 | void g_application_set_application_id(GApplication *application, const gchar *application_id); 11 | extern 12 | GDBusConnection * g_application_get_dbus_connection(GApplication *application); 13 | extern 14 | const gchar * g_application_get_dbus_object_path(GApplication *application); 15 | extern 16 | guint g_application_get_inactivity_timeout(GApplication *application); 17 | extern 18 | void g_application_set_inactivity_timeout(GApplication *application, guint inactivity_timeout); 19 | extern 20 | GApplicationFlags g_application_get_flags(GApplication *application); 21 | extern 22 | void g_application_set_flags(GApplication *application, GApplicationFlags flags); 23 | extern 24 | const gchar * g_application_get_resource_base_path(GApplication *application); 25 | extern 26 | void g_application_set_resource_base_path(GApplication *application, const gchar *resource_path); 27 | extern 28 | void g_application_set_action_group(GApplication *application, GActionGroup *action_group); 29 | extern 30 | void g_application_add_main_option_entries(GApplication *application, const GOptionEntry *entries); 31 | extern 32 | void g_application_add_main_option(GApplication *application, const char *long_name, char short_name, GOptionFlags flags, GOptionArg arg, const char *description, const char *arg_description); 33 | extern 34 | void g_application_add_option_group(GApplication *application, GOptionGroup *group); 35 | extern 36 | void g_application_set_option_context_parameter_string(GApplication *application, const gchar *parameter_string); 37 | extern 38 | void g_application_set_option_context_summary(GApplication *application, const gchar *summary); 39 | extern 40 | void g_application_set_option_context_description(GApplication *application, const gchar *description); 41 | extern 42 | gboolean g_application_get_is_registered(GApplication *application); 43 | extern 44 | gboolean g_application_get_is_remote(GApplication *application); 45 | extern 46 | gboolean g_application_register(GApplication *application, GCancellable *cancellable, GError **error); 47 | extern 48 | void g_application_hold(GApplication *application); 49 | extern 50 | void g_application_release(GApplication *application); 51 | extern 52 | void g_application_activate(GApplication *application); 53 | extern 54 | void g_application_open(GApplication *application, GFile **files, gint n_files, const gchar *hint); 55 | extern 56 | int g_application_run(GApplication *application, int argc, char **argv); 57 | extern 58 | void g_application_quit(GApplication *application); 59 | extern 60 | GApplication * g_application_get_default(void); 61 | extern 62 | void g_application_set_default(GApplication *application); 63 | extern 64 | void g_application_mark_busy(GApplication *application); 65 | extern 66 | void g_application_unmark_busy(GApplication *application); 67 | extern 68 | gboolean g_application_get_is_busy(GApplication *application); 69 | extern 70 | void g_application_send_notification(GApplication *application, const gchar *id, GNotification *notification); 71 | extern 72 | void g_application_withdraw_notification(GApplication *application, const gchar *id); 73 | extern 74 | void g_application_bind_busy_property(GApplication *application, gpointer object, const gchar *property); 75 | extern 76 | void g_application_unbind_busy_property(GApplication *application, gpointer object, const gchar *property); 77 | extern 78 | GType g_application_command_line_get_type(void); 79 | extern 80 | gchar ** g_application_command_line_get_arguments(GApplicationCommandLine *cmdline, int *argc); 81 | extern 82 | GVariantDict * g_application_command_line_get_options_dict(GApplicationCommandLine *cmdline); 83 | extern 84 | GInputStream * g_application_command_line_get_stdin(GApplicationCommandLine *cmdline); 85 | extern 86 | const gchar * const * g_application_command_line_get_environ(GApplicationCommandLine *cmdline); 87 | extern 88 | const gchar * g_application_command_line_getenv(GApplicationCommandLine *cmdline, const gchar *name); 89 | extern 90 | const gchar * g_application_command_line_get_cwd(GApplicationCommandLine *cmdline); 91 | extern 92 | gboolean g_application_command_line_get_is_remote(GApplicationCommandLine *cmdline); 93 | extern 94 | void g_application_command_line_print(GApplicationCommandLine *cmdline, const gchar *format, ...); 95 | extern 96 | void g_application_command_line_printerr(GApplicationCommandLine *cmdline, const gchar *format, ...); 97 | extern 98 | int g_application_command_line_get_exit_status(GApplicationCommandLine *cmdline); 99 | extern 100 | void g_application_command_line_set_exit_status(GApplicationCommandLine *cmdline, int exit_status); 101 | extern 102 | GVariant * g_application_command_line_get_platform_data(GApplicationCommandLine *cmdline); 103 | extern 104 | GFile * g_application_command_line_create_file_for_arg(GApplicationCommandLine *cmdline, const gchar *arg); 105 | extern 106 | GVariant * g_action_get_state_hint(GAction *action); 107 | extern 108 | gboolean g_action_get_enabled(GAction *action); 109 | extern 110 | GVariant * g_action_get_state(GAction *action); 111 | extern 112 | void g_action_change_state(GAction *action, GVariant *value); 113 | extern 114 | void g_action_activate(GAction *action, GVariant *parameter); 115 | extern 116 | gboolean g_action_name_is_valid(const gchar *action_name); 117 | extern 118 | gboolean g_action_parse_detailed_name(const gchar *detailed_name, gchar **action_name, GVariant **target_value, GError **error); 119 | extern 120 | gchar * g_action_print_detailed_name(const gchar *action_name, GVariant *target_value); 121 | extern 122 | GType g_action_group_get_type(void); 123 | extern 124 | gboolean g_action_group_has_action(GActionGroup *action_group, const gchar *action_name); 125 | extern 126 | gchar ** g_action_group_list_actions(GActionGroup *action_group); 127 | extern 128 | const GVariantType * g_action_group_get_action_parameter_type(GActionGroup *action_group, const gchar *action_name); 129 | extern 130 | const GVariantType * g_action_group_get_action_state_type(GActionGroup *action_group, const gchar *action_name); 131 | extern 132 | GVariant * g_action_group_get_action_state_hint(GActionGroup *action_group, const gchar *action_name); 133 | extern 134 | gboolean g_action_group_get_action_enabled(GActionGroup *action_group, const gchar *action_name); 135 | extern 136 | GVariant * g_action_group_get_action_state(GActionGroup *action_group, const gchar *action_name); 137 | extern 138 | void g_action_group_change_action_state(GActionGroup *action_group, const gchar *action_name, GVariant *value); 139 | extern 140 | void g_action_group_activate_action(GActionGroup *action_group, const gchar *action_name, GVariant *parameter); 141 | extern 142 | void g_action_group_action_added(GActionGroup *action_group, const gchar *action_name); 143 | extern 144 | void g_action_group_action_removed(GActionGroup *action_group, const gchar *action_name); 145 | extern 146 | void g_action_group_action_enabled_changed(GActionGroup *action_group, const gchar *action_name, gboolean enabled); 147 | extern 148 | void g_action_group_action_state_changed(GActionGroup *action_group, const gchar *action_name, GVariant *state); 149 | extern 150 | gboolean g_action_group_query_action(GActionGroup *action_group, const gchar *action_name, gboolean *enabled, const GVariantType **parameter_type, const GVariantType **state_type, GVariant **state_hint, GVariant **state); 151 | extern 152 | guint g_dbus_connection_export_action_group(GDBusConnection *connection, const gchar *object_path, GActionGroup *action_group, GError **error); 153 | extern 154 | void g_dbus_connection_unexport_action_group(GDBusConnection *connection, guint export_id); 155 | extern 156 | GType g_action_map_get_type(void); 157 | extern 158 | GAction * g_action_map_lookup_action(GActionMap *action_map, const gchar *action_name); 159 | extern 160 | void g_action_map_add_action(GActionMap *action_map, GAction *action); 161 | extern 162 | void g_action_map_remove_action(GActionMap *action_map, const gchar *action_name); 163 | extern 164 | void g_action_map_add_action_entries(GActionMap *action_map, const GActionEntry *entries, gint n_entries, gpointer user_data); 165 | extern 166 | GType g_app_info_get_type(void); 167 | extern 168 | GAppInfo * g_app_info_create_from_commandline(const char *commandline, const char *application_name, GAppInfoCreateFlags flags, GError **error); 169 | extern 170 | GAppInfo * g_app_info_dup(GAppInfo *appinfo); 171 | extern 172 | gboolean g_app_info_equal(GAppInfo *appinfo1, GAppInfo *appinfo2); 173 | extern 174 | const char *g_app_info_get_id(GAppInfo *appinfo); 175 | extern 176 | const char *g_app_info_get_name(GAppInfo *appinfo); 177 | extern 178 | const char *g_app_info_get_display_name(GAppInfo *appinfo); 179 | extern 180 | const char *g_app_info_get_description(GAppInfo *appinfo); 181 | extern 182 | const char *g_app_info_get_executable(GAppInfo *appinfo); 183 | extern 184 | const char *g_app_info_get_commandline(GAppInfo *appinfo); 185 | extern 186 | GIcon * g_app_info_get_icon(GAppInfo *appinfo); 187 | extern 188 | gboolean g_app_info_launch(GAppInfo *appinfo, GList *files, GAppLaunchContext *context, GError **error); 189 | extern 190 | gboolean g_app_info_supports_uris(GAppInfo *appinfo); 191 | extern 192 | gboolean g_app_info_supports_files(GAppInfo *appinfo); 193 | extern 194 | gboolean g_app_info_launch_uris(GAppInfo *appinfo, GList *uris, GAppLaunchContext *context, GError **error); 195 | GLIB_AVAILABLE_IN_2_60 void g_app_info_launch_uris_async(GAppInfo *appinfo, GList *uris, GAppLaunchContext *context, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 196 | GLIB_AVAILABLE_IN_2_60 gboolean g_app_info_launch_uris_finish(GAppInfo *appinfo, GAsyncResult *result, GError **error); 197 | extern 198 | gboolean g_app_info_should_show(GAppInfo *appinfo); 199 | extern 200 | gboolean g_app_info_set_as_default_for_type(GAppInfo *appinfo, const char *content_type, GError **error); 201 | extern 202 | gboolean g_app_info_set_as_default_for_extension(GAppInfo *appinfo, const char *extension, GError **error); 203 | extern 204 | gboolean g_app_info_add_supports_type(GAppInfo *appinfo, const char *content_type, GError **error); 205 | extern 206 | gboolean g_app_info_can_remove_supports_type(GAppInfo *appinfo); 207 | extern 208 | gboolean g_app_info_remove_supports_type(GAppInfo *appinfo, const char *content_type, GError **error); 209 | extern 210 | const char **g_app_info_get_supported_types(GAppInfo *appinfo); 211 | extern 212 | gboolean g_app_info_can_delete(GAppInfo *appinfo); 213 | extern 214 | gboolean g_app_info_delete(GAppInfo *appinfo); 215 | extern 216 | gboolean g_app_info_set_as_last_used_for_type(GAppInfo *appinfo, const char *content_type, GError **error); 217 | extern 218 | GList * g_app_info_get_all(void); 219 | extern 220 | GList * g_app_info_get_all_for_type(const char *content_type); 221 | extern 222 | GList * g_app_info_get_recommended_for_type(const gchar *content_type); 223 | extern 224 | GList * g_app_info_get_fallback_for_type(const gchar *content_type); 225 | extern 226 | void g_app_info_reset_type_associations(const char *content_type); 227 | extern 228 | GAppInfo *g_app_info_get_default_for_type(const char *content_type, gboolean must_support_uris); 229 | extern 230 | GAppInfo *g_app_info_get_default_for_uri_scheme(const char *uri_scheme); 231 | extern 232 | gboolean g_app_info_launch_default_for_uri(const char *uri, GAppLaunchContext *context, GError **error); 233 | extern 234 | void g_app_info_launch_default_for_uri_async(const char *uri, GAppLaunchContext *context, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 235 | extern 236 | gboolean g_app_info_launch_default_for_uri_finish(GAsyncResult *result, GError **error); 237 | extern 238 | GType g_app_launch_context_get_type(void); 239 | extern 240 | GAppLaunchContext *g_app_launch_context_new(void); 241 | extern 242 | void g_app_launch_context_setenv(GAppLaunchContext *context, const char *variable, const char *value); 243 | extern 244 | void g_app_launch_context_unsetenv(GAppLaunchContext *context, const char *variable); 245 | extern 246 | char ** g_app_launch_context_get_environment(GAppLaunchContext *context); 247 | extern 248 | char * g_app_launch_context_get_display(GAppLaunchContext *context, GAppInfo *info, GList *files); 249 | extern 250 | char * g_app_launch_context_get_startup_notify_id(GAppLaunchContext *context, GAppInfo *info, GList *files); 251 | extern 252 | void g_app_launch_context_launch_failed(GAppLaunchContext *context, const char * startup_notify_id); 253 | extern 254 | GType g_app_info_monitor_get_type(void); 255 | extern 256 | GAppInfoMonitor * g_app_info_monitor_get(void); 257 | extern 258 | GType g_initable_get_type(void); 259 | extern 260 | gboolean g_initable_init(GInitable *initable, GCancellable *cancellable, GError **error); 261 | extern 262 | gpointer g_initable_new(GType object_type, GCancellable *cancellable, GError **error, const gchar *first_property_name, ...); 263 | extern 264 | gpointer g_initable_newv(GType object_type, guint n_parameters, GParameter *parameters, GCancellable *cancellable, GError **error); 265 | extern 266 | GObject* g_initable_new_valist(GType object_type, const gchar *first_property_name, va_list var_args, GCancellable *cancellable, GError **error); 267 | extern 268 | GType g_async_initable_get_type(void); 269 | extern 270 | void g_async_initable_init_async(GAsyncInitable *initable, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 271 | extern 272 | gboolean g_async_initable_init_finish(GAsyncInitable *initable, GAsyncResult *res, GError **error); 273 | extern 274 | void g_async_initable_new_async(GType object_type, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, const gchar *first_property_name, ...); 275 | extern 276 | void g_async_initable_newv_async(GType object_type, guint n_parameters, GParameter *parameters, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 277 | extern 278 | void g_async_initable_new_valist_async(GType object_type, const gchar *first_property_name, va_list var_args, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 279 | extern 280 | GObject *g_async_initable_new_finish(GAsyncInitable *initable, GAsyncResult *res, GError **error); 281 | extern 282 | GType g_async_result_get_type(void); 283 | extern 284 | gpointer g_async_result_get_user_data(GAsyncResult *res); 285 | extern 286 | GObject *g_async_result_get_source_object(GAsyncResult *res); 287 | extern 288 | gboolean g_async_result_legacy_propagate_error(GAsyncResult *res, GError **error); 289 | extern 290 | gboolean g_async_result_is_tagged(GAsyncResult *res, gpointer source_tag); 291 | extern 292 | GType g_input_stream_get_type(void); 293 | extern 294 | gssize g_input_stream_read(GInputStream *stream, void *buffer, gsize count, GCancellable *cancellable, GError **error); 295 | extern 296 | gboolean g_input_stream_read_all(GInputStream *stream, void *buffer, gsize count, gsize *bytes_read, GCancellable *cancellable, GError **error); 297 | extern 298 | GBytes *g_input_stream_read_bytes(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error); 299 | extern 300 | gssize g_input_stream_skip(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error); 301 | extern 302 | gboolean g_input_stream_close(GInputStream *stream, GCancellable *cancellable, GError **error); 303 | extern 304 | void g_input_stream_read_async(GInputStream *stream, void *buffer, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 305 | extern 306 | gssize g_input_stream_read_finish(GInputStream *stream, GAsyncResult *result, GError **error); 307 | extern 308 | void g_input_stream_read_all_async(GInputStream *stream, void *buffer, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 309 | extern 310 | gboolean g_input_stream_read_all_finish(GInputStream *stream, GAsyncResult *result, gsize *bytes_read, GError **error); 311 | extern 312 | void g_input_stream_read_bytes_async(GInputStream *stream, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 313 | extern 314 | GBytes *g_input_stream_read_bytes_finish(GInputStream *stream, GAsyncResult *result, GError **error); 315 | extern 316 | void g_input_stream_skip_async(GInputStream *stream, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 317 | extern 318 | gssize g_input_stream_skip_finish(GInputStream *stream, GAsyncResult *result, GError **error); 319 | extern 320 | void g_input_stream_close_async(GInputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 321 | extern 322 | gboolean g_input_stream_close_finish(GInputStream *stream, GAsyncResult *result, GError **error); 323 | extern 324 | gboolean g_input_stream_is_closed(GInputStream *stream); 325 | extern 326 | gboolean g_input_stream_has_pending(GInputStream *stream); 327 | extern 328 | gboolean g_input_stream_set_pending(GInputStream *stream, GError **error); 329 | extern 330 | void g_input_stream_clear_pending(GInputStream *stream); 331 | extern 332 | GType g_filter_input_stream_get_type(void); 333 | extern 334 | GInputStream * g_filter_input_stream_get_base_stream(GFilterInputStream *stream); 335 | extern 336 | gboolean g_filter_input_stream_get_close_base_stream(GFilterInputStream *stream); 337 | extern 338 | void g_filter_input_stream_set_close_base_stream(GFilterInputStream *stream, gboolean close_base); 339 | extern 340 | GType g_buffered_input_stream_get_type(void); 341 | extern 342 | GInputStream* g_buffered_input_stream_new(GInputStream *base_stream); 343 | extern 344 | GInputStream* g_buffered_input_stream_new_sized(GInputStream *base_stream, gsize size); 345 | extern 346 | gsize g_buffered_input_stream_get_buffer_size(GBufferedInputStream *stream); 347 | extern 348 | void g_buffered_input_stream_set_buffer_size(GBufferedInputStream *stream, gsize size); 349 | extern 350 | gsize g_buffered_input_stream_get_available(GBufferedInputStream *stream); 351 | extern 352 | gsize g_buffered_input_stream_peek(GBufferedInputStream *stream, void *buffer, gsize offset, gsize count); 353 | extern 354 | const void* g_buffered_input_stream_peek_buffer(GBufferedInputStream *stream, gsize *count); 355 | extern 356 | gssize g_buffered_input_stream_fill(GBufferedInputStream *stream, gssize count, GCancellable *cancellable, GError **error); 357 | extern 358 | void g_buffered_input_stream_fill_async(GBufferedInputStream *stream, gssize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 359 | extern 360 | gssize g_buffered_input_stream_fill_finish(GBufferedInputStream *stream, GAsyncResult *result, GError **error); 361 | extern 362 | int g_buffered_input_stream_read_byte(GBufferedInputStream *stream, GCancellable *cancellable, GError **error); 363 | extern 364 | GType g_output_stream_get_type(void); 365 | extern 366 | gssize g_output_stream_write(GOutputStream *stream, const void *buffer, gsize count, GCancellable *cancellable, GError **error); 367 | extern 368 | gboolean g_output_stream_write_all(GOutputStream *stream, const void *buffer, gsize count, gsize *bytes_written, GCancellable *cancellable, GError **error); 369 | GLIB_AVAILABLE_IN_2_60 gboolean g_output_stream_writev(GOutputStream *stream, const GOutputVector *vectors, gsize n_vectors, gsize *bytes_written, GCancellable *cancellable, GError **error); 370 | GLIB_AVAILABLE_IN_2_60 gboolean g_output_stream_writev_all(GOutputStream *stream, GOutputVector *vectors, gsize n_vectors, gsize *bytes_written, GCancellable *cancellable, GError **error); 371 | extern 372 | gboolean g_output_stream_printf(GOutputStream *stream, gsize *bytes_written, GCancellable *cancellable, GError **error, const gchar *format, ...); 373 | extern 374 | gboolean g_output_stream_vprintf(GOutputStream *stream, gsize *bytes_written, GCancellable *cancellable, GError **error, const gchar *format, va_list args); 375 | extern 376 | gssize g_output_stream_write_bytes(GOutputStream *stream, GBytes *bytes, GCancellable *cancellable, GError **error); 377 | extern 378 | gssize g_output_stream_splice(GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, GCancellable *cancellable, GError **error); 379 | extern 380 | gboolean g_output_stream_flush(GOutputStream *stream, GCancellable *cancellable, GError **error); 381 | extern 382 | gboolean g_output_stream_close(GOutputStream *stream, GCancellable *cancellable, GError **error); 383 | extern 384 | void g_output_stream_write_async(GOutputStream *stream, const void *buffer, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 385 | extern 386 | gssize g_output_stream_write_finish(GOutputStream *stream, GAsyncResult *result, GError **error); 387 | extern 388 | void g_output_stream_write_all_async(GOutputStream *stream, const void *buffer, gsize count, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 389 | extern 390 | gboolean g_output_stream_write_all_finish(GOutputStream *stream, GAsyncResult *result, gsize *bytes_written, GError **error); 391 | GLIB_AVAILABLE_IN_2_60 void g_output_stream_writev_async(GOutputStream *stream, const GOutputVector *vectors, gsize n_vectors, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 392 | GLIB_AVAILABLE_IN_2_60 gboolean g_output_stream_writev_finish(GOutputStream *stream, GAsyncResult *result, gsize *bytes_written, GError **error); 393 | GLIB_AVAILABLE_IN_2_60 void g_output_stream_writev_all_async(GOutputStream *stream, GOutputVector *vectors, gsize n_vectors, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 394 | GLIB_AVAILABLE_IN_2_60 gboolean g_output_stream_writev_all_finish(GOutputStream *stream, GAsyncResult *result, gsize *bytes_written, GError **error); 395 | extern void g_output_stream_write_bytes_async(GOutputStream *stream, GBytes *bytes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 396 | extern 397 | gssize g_output_stream_write_bytes_finish(GOutputStream *stream, GAsyncResult *result, GError **error); 398 | extern 399 | void g_output_stream_splice_async(GOutputStream *stream, GInputStream *source, GOutputStreamSpliceFlags flags, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 400 | extern 401 | gssize g_output_stream_splice_finish(GOutputStream *stream, GAsyncResult *result, GError **error); 402 | extern 403 | void g_output_stream_flush_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 404 | extern 405 | gboolean g_output_stream_flush_finish(GOutputStream *stream, GAsyncResult *result, GError **error); 406 | extern 407 | void g_output_stream_close_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 408 | extern 409 | gboolean g_output_stream_close_finish(GOutputStream *stream, GAsyncResult *result, GError **error); 410 | extern 411 | gboolean g_output_stream_is_closed(GOutputStream *stream); 412 | extern 413 | gboolean g_output_stream_is_closing(GOutputStream *stream); 414 | extern 415 | gboolean g_output_stream_has_pending(GOutputStream *stream); 416 | extern 417 | gboolean g_output_stream_set_pending(GOutputStream *stream, GError **error); 418 | extern 419 | void g_output_stream_clear_pending(GOutputStream *stream); 420 | extern 421 | GType g_filter_output_stream_get_type(void); 422 | extern 423 | GOutputStream * g_filter_output_stream_get_base_stream(GFilterOutputStream *stream); 424 | extern 425 | gboolean g_filter_output_stream_get_close_base_stream(GFilterOutputStream *stream); 426 | extern 427 | void g_filter_output_stream_set_close_base_stream(GFilterOutputStream *stream, gboolean close_base); 428 | extern 429 | GType g_buffered_output_stream_get_type(void); 430 | extern 431 | GOutputStream* g_buffered_output_stream_new(GOutputStream *base_stream); 432 | extern 433 | GOutputStream* g_buffered_output_stream_new_sized(GOutputStream *base_stream, gsize size); 434 | extern 435 | gsize g_buffered_output_stream_get_buffer_size(GBufferedOutputStream *stream); 436 | extern 437 | void g_buffered_output_stream_set_buffer_size(GBufferedOutputStream *stream, gsize size); 438 | extern 439 | gboolean g_buffered_output_stream_get_auto_grow(GBufferedOutputStream *stream); 440 | extern 441 | void g_buffered_output_stream_set_auto_grow(GBufferedOutputStream *stream, gboolean auto_grow); 442 | extern 443 | GType g_bytes_icon_get_type(void); 444 | extern 445 | GIcon * g_bytes_icon_new(GBytes *bytes); 446 | extern 447 | GBytes * g_bytes_icon_get_bytes(GBytesIcon *icon); 448 | extern 449 | GType g_cancellable_get_type(void); 450 | extern 451 | GCancellable *g_cancellable_new(void); 452 | extern 453 | gboolean g_cancellable_is_cancelled(GCancellable *cancellable); 454 | extern 455 | gboolean g_cancellable_set_error_if_cancelled(GCancellable *cancellable, GError **error); 456 | extern 457 | int g_cancellable_get_fd(GCancellable *cancellable); 458 | extern 459 | gboolean g_cancellable_make_pollfd(GCancellable *cancellable, GPollFD *pollfd); 460 | extern 461 | void g_cancellable_release_fd(GCancellable *cancellable); 462 | extern 463 | GSource * g_cancellable_source_new(GCancellable *cancellable); 464 | extern 465 | GCancellable *g_cancellable_get_current(void); 466 | extern 467 | void g_cancellable_push_current(GCancellable *cancellable); 468 | extern 469 | void g_cancellable_pop_current(GCancellable *cancellable); 470 | extern 471 | void g_cancellable_reset(GCancellable *cancellable); 472 | extern 473 | gulong g_cancellable_connect(GCancellable *cancellable, GCallback callback, gpointer data, GDestroyNotify data_destroy_func); 474 | extern 475 | void g_cancellable_disconnect(GCancellable *cancellable, gulong handler_id); 476 | extern 477 | void g_cancellable_cancel(GCancellable *cancellable); 478 | extern 479 | GType g_converter_get_type(void); 480 | extern 481 | GConverterResult g_converter_convert(GConverter *converter, const void *inbuf, gsize inbuf_size, void *outbuf, gsize outbuf_size, GConverterFlags flags, gsize *bytes_read, gsize *bytes_written, GError **error); 482 | extern 483 | void g_converter_reset(GConverter *converter); 484 | extern 485 | GType g_charset_converter_get_type(void); 486 | extern 487 | GCharsetConverter *g_charset_converter_new(const gchar *to_charset, const gchar *from_charset, GError **error); 488 | extern 489 | void g_charset_converter_set_use_fallback(GCharsetConverter *converter, gboolean use_fallback); 490 | extern 491 | gboolean g_charset_converter_get_use_fallback(GCharsetConverter *converter); 492 | extern 493 | guint g_charset_converter_get_num_fallbacks(GCharsetConverter *converter); 494 | extern 495 | gboolean g_content_type_equals(const gchar *type1, const gchar *type2); 496 | extern 497 | gboolean g_content_type_is_a(const gchar *type, const gchar *supertype); 498 | extern 499 | gboolean g_content_type_is_mime_type(const gchar *type, const gchar *mime_type); 500 | extern 501 | gboolean g_content_type_is_unknown(const gchar *type); 502 | extern 503 | gchar * g_content_type_get_description(const gchar *type); 504 | extern 505 | gchar * g_content_type_get_mime_type(const gchar *type); 506 | extern 507 | GIcon * g_content_type_get_icon(const gchar *type); 508 | extern 509 | GIcon * g_content_type_get_symbolic_icon(const gchar *type); 510 | extern 511 | gchar * g_content_type_get_generic_icon_name(const gchar *type); 512 | extern 513 | gboolean g_content_type_can_be_executable(const gchar *type); 514 | extern 515 | gchar * g_content_type_from_mime_type(const gchar *mime_type); 516 | extern 517 | gchar * g_content_type_guess(const gchar *filename, const guchar *data, gsize data_size, gboolean *result_uncertain); 518 | extern 519 | gchar ** g_content_type_guess_for_tree(GFile *root); 520 | extern 521 | GList * g_content_types_get_registered(void); 522 | GLIB_AVAILABLE_IN_2_60 const gchar * const *g_content_type_get_mime_dirs(void); 523 | GLIB_AVAILABLE_IN_2_60 void g_content_type_set_mime_dirs(const gchar * const *dirs); 524 | extern 525 | GType g_converter_input_stream_get_type(void); 526 | extern 527 | GInputStream *g_converter_input_stream_new(GInputStream *base_stream, GConverter *converter); 528 | extern 529 | GConverter *g_converter_input_stream_get_converter(GConverterInputStream *converter_stream); 530 | extern 531 | GType g_converter_output_stream_get_type(void); 532 | extern 533 | GOutputStream *g_converter_output_stream_new(GOutputStream *base_stream, GConverter *converter); 534 | extern 535 | GConverter *g_converter_output_stream_get_converter(GConverterOutputStream *converter_stream); 536 | extern 537 | GType g_credentials_get_type(void); 538 | extern 539 | GCredentials *g_credentials_new(void); 540 | extern 541 | gchar *g_credentials_to_string(GCredentials *credentials); 542 | extern 543 | gpointer g_credentials_get_native(GCredentials *credentials, GCredentialsType native_type); 544 | extern 545 | void g_credentials_set_native(GCredentials *credentials, GCredentialsType native_type, gpointer native); 546 | extern 547 | gboolean g_credentials_is_same_user(GCredentials *credentials, GCredentials *other_credentials, GError **error); 548 | LIBGTK_FUNC_AVAILABLE_IN_UINX pid_t g_credentials_get_unix_pid(GCredentials *credentials, GError **error); 549 | LIBGTK_FUNC_AVAILABLE_IN_UINX uid_t g_credentials_get_unix_user(GCredentials *credentials, GError **error); 550 | LIBGTK_FUNC_AVAILABLE_IN_UINX gboolean g_credentials_set_unix_user(GCredentials *credentials, uid_t uid, GError **error); 551 | extern GType g_datagram_based_get_type(void); 552 | extern gint g_datagram_based_receive_messages(GDatagramBased *datagram_based, GInputMessage *messages, guint num_messages, gint flags, gint64 timeout, GCancellable *cancellable, GError **error); 553 | extern gint g_datagram_based_send_messages(GDatagramBased *datagram_based, GOutputMessage *messages, guint num_messages, gint flags, gint64 timeout, GCancellable *cancellable, GError **error); 554 | extern GSource * g_datagram_based_create_source(GDatagramBased *datagram_based, GIOCondition condition, GCancellable *cancellable); 555 | extern GIOCondition g_datagram_based_condition_check(GDatagramBased *datagram_based, GIOCondition condition); 556 | extern gboolean g_datagram_based_condition_wait(GDatagramBased *datagram_based, GIOCondition condition, gint64 timeout, GCancellable *cancellable, GError **error); 557 | extern 558 | GType g_data_input_stream_get_type(void); 559 | extern 560 | GDataInputStream * g_data_input_stream_new(GInputStream *base_stream); 561 | extern 562 | void g_data_input_stream_set_byte_order(GDataInputStream *stream, GDataStreamByteOrder order); 563 | extern 564 | GDataStreamByteOrder g_data_input_stream_get_byte_order(GDataInputStream *stream); 565 | extern 566 | void g_data_input_stream_set_newline_type(GDataInputStream *stream, GDataStreamNewlineType type); 567 | extern 568 | GDataStreamNewlineType g_data_input_stream_get_newline_type(GDataInputStream *stream); 569 | extern 570 | guchar g_data_input_stream_read_byte(GDataInputStream *stream, GCancellable *cancellable, GError **error); 571 | extern 572 | gint16 g_data_input_stream_read_int16(GDataInputStream *stream, GCancellable *cancellable, GError **error); 573 | extern 574 | guint16 g_data_input_stream_read_uint16(GDataInputStream *stream, GCancellable *cancellable, GError **error); 575 | extern 576 | gint32 g_data_input_stream_read_int32(GDataInputStream *stream, GCancellable *cancellable, GError **error); 577 | extern 578 | guint32 g_data_input_stream_read_uint32(GDataInputStream *stream, GCancellable *cancellable, GError **error); 579 | extern 580 | gint64 g_data_input_stream_read_int64(GDataInputStream *stream, GCancellable *cancellable, GError **error); 581 | extern 582 | guint64 g_data_input_stream_read_uint64(GDataInputStream *stream, GCancellable *cancellable, GError **error); 583 | extern 584 | char * g_data_input_stream_read_line(GDataInputStream *stream, gsize *length, GCancellable *cancellable, GError **error); 585 | extern 586 | char * g_data_input_stream_read_line_utf8(GDataInputStream *stream, gsize *length, GCancellable *cancellable, GError **error); 587 | extern 588 | void g_data_input_stream_read_line_async(GDataInputStream *stream, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 589 | extern 590 | char * g_data_input_stream_read_line_finish(GDataInputStream *stream, GAsyncResult *result, gsize *length, GError **error); 591 | extern 592 | char * g_data_input_stream_read_line_finish_utf8(GDataInputStream *stream, GAsyncResult *result, gsize *length, GError **error); 593 | extern 594 | char * g_data_input_stream_read_until(GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error); 595 | extern 596 | void g_data_input_stream_read_until_async(GDataInputStream *stream, const gchar *stop_chars, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 597 | extern 598 | char * g_data_input_stream_read_until_finish(GDataInputStream *stream, GAsyncResult *result, gsize *length, GError **error); 599 | extern 600 | char * g_data_input_stream_read_upto(GDataInputStream *stream, const gchar *stop_chars, gssize stop_chars_len, gsize *length, GCancellable *cancellable, GError **error); 601 | extern 602 | void g_data_input_stream_read_upto_async(GDataInputStream *stream, const gchar *stop_chars, gssize stop_chars_len, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 603 | extern 604 | char * g_data_input_stream_read_upto_finish(GDataInputStream *stream, GAsyncResult *result, gsize *length, GError **error); 605 | -------------------------------------------------------------------------------- /src/include/gobject.h: -------------------------------------------------------------------------------- 1 | extern 2 | guint g_signal_newv (const gchar *signal_name,GType itype,GSignalFlags signal_flags,GClosure *class_closure,GSignalAccumulator accumulator,gpointer accu_data,GSignalCMarshaller c_marshaller,GType return_type,guint n_params,GType *param_types); 3 | extern 4 | guint g_signal_new_valist (const gchar *signal_name,GType itype,GSignalFlags signal_flags,GClosure *class_closure,GSignalAccumulator accumulator,gpointer accu_data,GSignalCMarshaller c_marshaller,GType return_type,guint n_params,va_list args); 5 | extern 6 | guint g_signal_new (const gchar *signal_name,GType itype,GSignalFlags signal_flags,guint class_offset,GSignalAccumulator accumulator,gpointer accu_data,GSignalCMarshaller c_marshaller,GType return_type,guint n_params,...); 7 | extern 8 | guint g_signal_new_class_handler (const gchar *signal_name,GType itype,GSignalFlags signal_flags,GCallback class_handler,GSignalAccumulator accumulator,gpointer accu_data,GSignalCMarshaller c_marshaller,GType return_type,guint n_params,...); 9 | extern 10 | void g_signal_set_va_marshaller (guint signal_id,GType instance_type,GSignalCVaMarshaller va_marshaller); 11 | extern 12 | void g_signal_emitv (const GValue *instance_and_params,guint signal_id,GQuark detail,GValue *return_value); 13 | extern 14 | void g_signal_emit_valist (gpointer instance,guint signal_id,GQuark detail,va_list var_args); 15 | extern 16 | void g_signal_emit (gpointer instance,guint signal_id,GQuark detail,...); 17 | extern 18 | void g_signal_emit_by_name (gpointer instance,const gchar *detailed_signal,...); 19 | extern 20 | guint g_signal_lookup (const gchar *name,GType itype); 21 | extern 22 | const gchar * g_signal_name (guint signal_id); 23 | extern 24 | void g_signal_query (guint signal_id,GSignalQuery *query); 25 | extern 26 | guint* g_signal_list_ids (GType itype,guint *n_ids); 27 | extern 28 | gboolean g_signal_parse_name (const gchar *detailed_signal,GType itype,guint *signal_id_p,GQuark *detail_p,gboolean force_detail_quark); 29 | extern 30 | GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance); 31 | extern 32 | void g_signal_stop_emission (gpointer instance,guint signal_id,GQuark detail); 33 | extern 34 | void g_signal_stop_emission_by_name (gpointer instance,const gchar *detailed_signal); 35 | extern 36 | gulong g_signal_add_emission_hook (guint signal_id,GQuark detail,GSignalEmissionHook hook_func,gpointer hook_data,GDestroyNotify data_destroy); 37 | extern 38 | void g_signal_remove_emission_hook (guint signal_id,gulong hook_id); 39 | extern 40 | gboolean g_signal_has_handler_pending (gpointer instance,guint signal_id,GQuark detail,gboolean may_be_blocked); 41 | extern 42 | gulong g_signal_connect_closure_by_id (gpointer instance,guint signal_id,GQuark detail,GClosure *closure,gboolean after); 43 | extern 44 | gulong g_signal_connect_closure (gpointer instance,const gchar *detailed_signal,GClosure *closure,gboolean after); 45 | extern 46 | gulong g_signal_connect_data (gpointer instance,const gchar *detailed_signal,GCallback c_handler,gpointer data,GClosureNotify destroy_data,GConnectFlags connect_flags); 47 | extern 48 | void g_signal_handler_block (gpointer instance,gulong handler_id); 49 | extern 50 | void g_signal_handler_unblock (gpointer instance,gulong handler_id); 51 | extern 52 | void g_signal_handler_disconnect (gpointer instance,gulong handler_id); 53 | extern 54 | gboolean g_signal_handler_is_connected (gpointer instance,gulong handler_id); 55 | extern 56 | gulong g_signal_handler_find (gpointer instance,GSignalMatchType mask,guint signal_id,GQuark detail,GClosure *closure,gpointer func,gpointer data); 57 | extern 58 | guint g_signal_handlers_block_matched (gpointer instance,GSignalMatchType mask,guint signal_id,GQuark detail,GClosure *closure,gpointer func,gpointer data); 59 | extern 60 | guint g_signal_handlers_unblock_matched (gpointer instance,GSignalMatchType mask,guint signal_id,GQuark detail,GClosure *closure,gpointer func,gpointer data); 61 | extern 62 | guint g_signal_handlers_disconnect_matched (gpointer instance,GSignalMatchType mask,guint signal_id,GQuark detail,GClosure *closure,gpointer func,gpointer data); 63 | GLIB_AVAILABLE_IN_2_62 void g_clear_signal_handler (gulong *handler_id_ptr,gpointer instance); 64 | extern 65 | void g_signal_override_class_closure (guint signal_id,GType instance_type,GClosure *class_closure); 66 | extern 67 | void g_signal_override_class_handler (const gchar *signal_name,GType instance_type,GCallback class_handler); 68 | extern 69 | void g_signal_chain_from_overridden (const GValue *instance_and_params,GValue *return_value); 70 | extern 71 | void g_signal_chain_from_overridden_handler (gpointer instance,...); 72 | extern 73 | gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint,GValue *return_accu,const GValue *handler_return,gpointer dummy); 74 | extern 75 | gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint,GValue *return_accu,const GValue *handler_return,gpointer dummy); 76 | extern 77 | void g_signal_handlers_destroy (gpointer instance);extern 78 | void g_object_unref (gpointer object);extern 79 | GType g_initially_unowned_get_type (void); 80 | extern 81 | void g_object_class_install_property (GObjectClass *oclass,guint property_id,GParamSpec *pspec); 82 | extern 83 | GParamSpec* g_object_class_find_property (GObjectClass *oclass,const gchar *property_name); 84 | extern 85 | GParamSpec**g_object_class_list_properties (GObjectClass *oclass,guint *n_properties); 86 | extern 87 | void g_object_class_override_property (GObjectClass *oclass,guint property_id,const gchar *name); 88 | extern 89 | void g_object_class_install_properties (GObjectClass *oclass,guint n_pspecs,GParamSpec **pspecs); 90 | extern 91 | void g_object_interface_install_property (gpointer g_iface,GParamSpec *pspec); 92 | extern 93 | GParamSpec* g_object_interface_find_property (gpointer g_iface,const gchar *property_name); 94 | extern 95 | GParamSpec**g_object_interface_list_properties (gpointer g_iface,guint *n_properties_p); 96 | extern 97 | GType g_object_get_type (void); 98 | extern 99 | gpointer g_object_new (GType object_type,const gchar *first_property_name,...); 100 | extern 101 | GObject* g_object_new_with_properties (GType object_type,guint n_properties,const char *names[],const GValue values[]); 102 | extern 103 | gpointer g_object_newv (GType object_type,guint n_parameters,GParameter *parameters); 104 | extern 105 | GObject* g_object_new_valist (GType object_type,const gchar *first_property_name,va_list var_args); 106 | extern 107 | void g_object_set (gpointer object,const gchar *first_property_name,...) ; 108 | extern 109 | void g_object_get (gpointer object,const gchar *first_property_name,...) ; 110 | extern 111 | gpointer g_object_connect (gpointer object,const gchar *signal_spec,...) ; 112 | extern 113 | void g_object_disconnect (gpointer object,const gchar *signal_spec,...) ; 114 | extern 115 | void g_object_setv (GObject *object,guint n_properties,const gchar *names[],const GValue values[]); 116 | extern 117 | void g_object_set_valist (GObject *object,const gchar *first_property_name,va_list var_args); 118 | extern 119 | void g_object_getv (GObject *object,guint n_properties,const gchar *names[],GValue values[]); 120 | extern 121 | void g_object_get_valist (GObject *object,const gchar *first_property_name,va_list var_args); 122 | extern 123 | void g_object_set_property (GObject *object,const gchar *property_name,const GValue *value); 124 | extern 125 | void g_object_get_property (GObject *object,const gchar *property_name,GValue *value); 126 | extern 127 | void g_object_freeze_notify (GObject *object); 128 | extern 129 | void g_object_notify (GObject *object,const gchar *property_name); 130 | extern 131 | void g_object_notify_by_pspec (GObject *object,GParamSpec *pspec); 132 | extern 133 | void g_object_thaw_notify (GObject *object); 134 | extern 135 | gboolean g_object_is_floating (gpointer object); 136 | extern 137 | gpointer g_object_ref_sink (gpointer object); 138 | extern 139 | gpointer g_object_ref (gpointer object);extern 140 | void g_object_weak_ref (GObject *object,GWeakNotify notify,gpointer data); 141 | extern 142 | void g_object_weak_unref (GObject *object,GWeakNotify notify,gpointer data); 143 | extern 144 | void g_object_add_weak_pointer (GObject *object,gpointer *weak_pointer_location); 145 | extern 146 | void g_object_remove_weak_pointer (GObject *object,gpointer *weak_pointer_location);extern 147 | void g_object_add_toggle_ref (GObject *object,GToggleNotify notify,gpointer data); 148 | extern 149 | void g_object_remove_toggle_ref (GObject *object,GToggleNotify notify,gpointer data); 150 | extern 151 | gpointer g_object_get_qdata (GObject *object,GQuark quark); 152 | extern 153 | void g_object_set_qdata (GObject *object,GQuark quark,gpointer data); 154 | extern 155 | void g_object_set_qdata_full (GObject *object,GQuark quark,gpointer data,GDestroyNotify destroy); 156 | extern 157 | gpointer g_object_steal_qdata (GObject *object,GQuark quark); 158 | extern 159 | gpointer g_object_dup_qdata (GObject *object,GQuark quark,GDuplicateFunc dup_func,gpointer user_data); 160 | extern 161 | gboolean g_object_replace_qdata (GObject *object,GQuark quark,gpointer oldval,gpointer newval,GDestroyNotify destroy,GDestroyNotify *old_destroy); 162 | extern 163 | gpointer g_object_get_data (GObject *object,const gchar *key); 164 | extern 165 | void g_object_set_data (GObject *object,const gchar *key,gpointer data); 166 | extern 167 | void g_object_set_data_full (GObject *object,const gchar *key,gpointer data,GDestroyNotify destroy); 168 | extern 169 | gpointer g_object_steal_data (GObject *object,const gchar *key); 170 | extern 171 | gpointer g_object_dup_data (GObject *object,const gchar *key,GDuplicateFunc dup_func,gpointer user_data); 172 | extern 173 | gboolean g_object_replace_data (GObject *object,const gchar *key,gpointer oldval,gpointer newval,GDestroyNotify destroy,GDestroyNotify *old_destroy); 174 | extern 175 | void g_object_watch_closure (GObject *object,GClosure *closure); 176 | extern 177 | GClosure* g_cclosure_new_object (GCallback callback_func,GObject *object); 178 | extern 179 | GClosure* g_cclosure_new_object_swap (GCallback callback_func,GObject *object); 180 | extern 181 | GClosure* g_closure_new_object (guint sizeof_closure,GObject *object); 182 | extern 183 | void g_value_set_object (GValue *value,gpointer v_object); 184 | extern 185 | gpointer g_value_get_object (const GValue *value); 186 | extern 187 | gpointer g_value_dup_object (const GValue *value); 188 | extern 189 | gulong g_signal_connect_object (gpointer instance,const gchar *detailed_signal,GCallback c_handler,gpointer gobject,GConnectFlags connect_flags); 190 | extern 191 | void g_object_force_floating (GObject *object); 192 | extern 193 | void g_object_run_dispose (GObject *object); 194 | extern 195 | void g_value_take_object (GValue *value,gpointer v_object); 196 | extern 197 | void g_value_set_object_take_ownership (GValue *value,gpointer v_object); 198 | extern 199 | gsize g_object_compat_control (gsize what,gpointer data); 200 | extern 201 | void g_clear_object (GObject **object_ptr); 202 | extern 203 | void g_weak_ref_init (GWeakRef *weak_ref,gpointer object); 204 | extern 205 | void g_weak_ref_clear (GWeakRef *weak_ref); 206 | extern 207 | gpointer g_weak_ref_get (GWeakRef *weak_ref); 208 | extern 209 | void g_weak_ref_set (GWeakRef *weak_ref,gpointer object);extern 210 | GType g_binding_flags_get_type (void); 211 | extern 212 | GType g_binding_get_type (void); 213 | extern 214 | GBindingFlags g_binding_get_flags (GBinding *binding); 215 | extern 216 | GObject * g_binding_get_source (GBinding *binding); 217 | extern 218 | GObject * g_binding_get_target (GBinding *binding); 219 | extern 220 | const gchar * g_binding_get_source_property (GBinding *binding); 221 | extern 222 | const gchar * g_binding_get_target_property (GBinding *binding); 223 | extern 224 | void g_binding_unbind (GBinding *binding); 225 | extern 226 | GBinding *g_object_bind_property (gpointer source,const gchar *source_property,gpointer target,const gchar *target_property,GBindingFlags flags); 227 | extern 228 | GBinding *g_object_bind_property_full (gpointer source,const gchar *source_property,gpointer target,const gchar *target_property,GBindingFlags flags,GBindingTransformFunc transform_to,GBindingTransformFunc transform_from,gpointer user_data,GDestroyNotify notify); 229 | extern 230 | GBinding *g_object_bind_property_with_closures (gpointer source,const gchar *source_property,gpointer target,const gchar *target_property,GBindingFlags flags,GClosure *transform_to,GClosure *transform_from); 231 | extern 232 | GClosure* g_cclosure_new (GCallback callback_func,gpointer user_data,GClosureNotify destroy_data); 233 | extern 234 | GClosure* g_cclosure_new_swap (GCallback callback_func,gpointer user_data,GClosureNotify destroy_data); 235 | extern 236 | GClosure* g_signal_type_cclosure_new (GType itype,guint struct_offset); 237 | extern 238 | GClosure* g_closure_ref (GClosure *closure); 239 | extern 240 | void g_closure_sink (GClosure *closure); 241 | extern 242 | void g_closure_unref (GClosure *closure); 243 | extern 244 | GClosure* g_closure_new_simple (guint sizeof_closure,gpointer data); 245 | extern 246 | void g_closure_add_finalize_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 247 | extern 248 | void g_closure_remove_finalize_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 249 | extern 250 | void g_closure_add_invalidate_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 251 | extern 252 | void g_closure_remove_invalidate_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 253 | extern 254 | void g_closure_add_marshal_guards (GClosure *closure,gpointer pre_marshal_data,GClosureNotify pre_marshal_notify,gpointer post_marshal_data,GClosureNotify post_marshal_notify); 255 | extern 256 | void g_closure_set_marshal (GClosure *closure,GClosureMarshal marshal); 257 | extern 258 | void g_closure_set_meta_marshal (GClosure *closure,gpointer marshal_data,GClosureMarshal meta_marshal); 259 | extern 260 | void g_closure_invalidate (GClosure *closure); 261 | extern 262 | void g_closure_invoke (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint); 263 | extern 264 | void g_cclosure_marshal_generic (GClosure *closure,GValue *return_gvalue,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 265 | extern 266 | void g_cclosure_marshal_generic_va (GClosure *closure,GValue *return_value,gpointer instance,va_list args_list,gpointer marshal_data,int n_params,GType *param_types);extern 267 | void g_cclosure_marshal_VOID__VOID (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 268 | extern 269 | void g_cclosure_marshal_VOID__VOIDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 270 | extern 271 | void g_cclosure_marshal_VOID__BOOLEAN (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 272 | extern 273 | void g_cclosure_marshal_VOID__BOOLEANv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 274 | extern 275 | void g_cclosure_marshal_VOID__CHAR (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 276 | extern 277 | void g_cclosure_marshal_VOID__CHARv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 278 | extern 279 | void g_cclosure_marshal_VOID__UCHAR (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 280 | extern 281 | void g_cclosure_marshal_VOID__UCHARv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 282 | extern 283 | void g_cclosure_marshal_VOID__INT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 284 | extern 285 | void g_cclosure_marshal_VOID__INTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 286 | extern 287 | void g_cclosure_marshal_VOID__UINT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 288 | extern 289 | void g_cclosure_marshal_VOID__UINTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 290 | extern 291 | void g_cclosure_marshal_VOID__LONG (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 292 | extern 293 | void g_cclosure_marshal_VOID__LONGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 294 | extern 295 | void g_cclosure_marshal_VOID__ULONG (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 296 | extern 297 | void g_cclosure_marshal_VOID__ULONGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 298 | extern 299 | void g_cclosure_marshal_VOID__ENUM (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 300 | extern 301 | void g_cclosure_marshal_VOID__ENUMv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 302 | extern 303 | void g_cclosure_marshal_VOID__FLAGS (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 304 | extern 305 | void g_cclosure_marshal_VOID__FLAGSv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 306 | extern 307 | void g_cclosure_marshal_VOID__FLOAT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 308 | extern 309 | void g_cclosure_marshal_VOID__FLOATv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 310 | extern 311 | void g_cclosure_marshal_VOID__DOUBLE (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 312 | extern 313 | void g_cclosure_marshal_VOID__DOUBLEv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 314 | extern 315 | void g_cclosure_marshal_VOID__STRING (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 316 | extern 317 | void g_cclosure_marshal_VOID__STRINGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 318 | extern 319 | void g_cclosure_marshal_VOID__PARAM (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 320 | extern 321 | void g_cclosure_marshal_VOID__PARAMv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 322 | extern 323 | void g_cclosure_marshal_VOID__BOXED (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 324 | extern 325 | void g_cclosure_marshal_VOID__BOXEDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 326 | extern 327 | void g_cclosure_marshal_VOID__POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 328 | extern 329 | void g_cclosure_marshal_VOID__POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 330 | extern 331 | void g_cclosure_marshal_VOID__OBJECT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 332 | extern 333 | void g_cclosure_marshal_VOID__OBJECTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 334 | extern 335 | void g_cclosure_marshal_VOID__VARIANT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 336 | extern 337 | void g_cclosure_marshal_VOID__VARIANTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 338 | extern 339 | void g_cclosure_marshal_VOID__UINT_POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 340 | extern 341 | void g_cclosure_marshal_VOID__UINT_POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 342 | extern 343 | void g_cclosure_marshal_BOOLEAN__FLAGS (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 344 | extern 345 | void g_cclosure_marshal_BOOLEAN__FLAGSv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 346 | extern 347 | void g_cclosure_marshal_STRING__OBJECT_POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 348 | extern 349 | void g_cclosure_marshal_STRING__OBJECT_POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 350 | extern 351 | void g_cclosure_marshal_BOOLEAN__BOXED_BOXED (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 352 | extern 353 | void g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 354 | -------------------------------------------------------------------------------- /src/include/gtype.h: -------------------------------------------------------------------------------- 1 | void g_type_init (void); 2 | extern 3 | void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags);extern 4 | const gchar * g_type_name (GType type); 5 | extern 6 | GQuark g_type_qname (GType type); 7 | extern 8 | GType g_type_from_name (const gchar *name); 9 | extern 10 | GType g_type_parent (GType type); 11 | extern 12 | guint g_type_depth (GType type); 13 | extern 14 | GType g_type_next_base (GType leaf_type,GType root_type); 15 | extern 16 | gboolean g_type_is_a (GType type,GType is_a_type); 17 | extern 18 | gpointer g_type_class_ref (GType type); 19 | extern 20 | gpointer g_type_class_peek (GType type); 21 | extern 22 | gpointer g_type_class_peek_static (GType type); 23 | extern 24 | void g_type_class_unref (gpointer g_class); 25 | extern 26 | gpointer g_type_class_peek_parent (gpointer g_class); 27 | extern 28 | gpointer g_type_interface_peek (gpointer instance_class,GType iface_type); 29 | extern 30 | gpointer g_type_interface_peek_parent (gpointer g_iface); 31 | extern 32 | gpointer g_type_default_interface_ref (GType g_type); 33 | extern 34 | gpointer g_type_default_interface_peek (GType g_type); 35 | extern 36 | void g_type_default_interface_unref (gpointer g_iface); 37 | extern 38 | GType* g_type_children (GType type,guint *n_children); 39 | extern 40 | GType* g_type_interfaces (GType type,guint *n_interfaces); 41 | extern 42 | void g_type_set_qdata (GType type,GQuark quark,gpointer data); 43 | extern 44 | gpointer g_type_get_qdata (GType type,GQuark quark); 45 | extern 46 | void g_type_query (GType type,GTypeQuery *query); 47 | extern 48 | int g_type_get_instance_count (GType type); 49 | extern 50 | GType g_type_register_static (GType parent_type,const gchar *type_name,const GTypeInfo *info,GTypeFlags flags); 51 | extern 52 | GType g_type_register_static_simple (GType parent_type,const gchar *type_name,guint class_size,GClassInitFunc class_init,guint instance_size,GInstanceInitFunc instance_init,GTypeFlags flags); 53 | extern 54 | GType g_type_register_dynamic (GType parent_type,const gchar *type_name,GTypePlugin *plugin,GTypeFlags flags); 55 | extern 56 | GType g_type_register_fundamental (GType type_id,const gchar *type_name,const GTypeInfo *info,const GTypeFundamentalInfo *finfo,GTypeFlags flags); 57 | extern 58 | void g_type_add_interface_static (GType instance_type,GType interface_type,const GInterfaceInfo *info); 59 | extern 60 | void g_type_add_interface_dynamic (GType instance_type,GType interface_type,GTypePlugin *plugin); 61 | extern 62 | void g_type_interface_add_prerequisite (GType interface_type,GType prerequisite_type); 63 | extern 64 | GType*g_type_interface_prerequisites (GType interface_type,guint *n_prerequisites); 65 | extern 66 | void g_type_class_add_private (gpointer g_class,gsize private_size); 67 | extern 68 | gint g_type_add_instance_private (GType class_type,gsize private_size); 69 | extern 70 | gpointer g_type_instance_get_private (GTypeInstance *instance,GType private_type); 71 | extern 72 | void g_type_class_adjust_private_offset (gpointer g_class,gint *private_size_or_offset); 73 | extern 74 | void g_type_add_class_private (GType class_type,gsize private_size); 75 | extern 76 | gpointer g_type_class_get_private (GTypeClass *klass,GType private_type); 77 | extern 78 | gint g_type_class_get_instance_private_offset (gpointer g_class); 79 | extern 80 | void g_type_ensure (GType type); 81 | extern 82 | guint g_type_get_type_registration_serial (void); 83 | extern 84 | GTypePlugin* g_type_get_plugin (GType type); 85 | extern 86 | GTypePlugin* g_type_interface_get_plugin (GType instance_type,GType interface_type); 87 | extern 88 | GType g_type_fundamental_next (void); 89 | extern 90 | GType g_type_fundamental (GType type_id); 91 | extern 92 | GTypeInstance* g_type_create_instance (GType type); 93 | extern 94 | void g_type_free_instance (GTypeInstance *instance); 95 | extern 96 | void g_type_add_class_cache_func (gpointer cache_data,GTypeClassCacheFunc cache_func); 97 | extern 98 | void g_type_remove_class_cache_func (gpointer cache_data,GTypeClassCacheFunc cache_func); 99 | extern 100 | void g_type_class_unref_uncached (gpointer g_class); 101 | extern 102 | void g_type_add_interface_check (gpointer check_data,GTypeInterfaceCheckFunc check_func); 103 | extern 104 | void g_type_remove_interface_check (gpointer check_data,GTypeInterfaceCheckFunc check_func); 105 | extern 106 | GTypeValueTable* g_type_value_table_peek (GType type); 107 | extern 108 | gboolean g_type_check_instance (GTypeInstance *instance) __attribute__((__pure__)); 109 | extern 110 | GTypeInstance* g_type_check_instance_cast (GTypeInstance *instance,GType iface_type); 111 | extern 112 | gboolean g_type_check_instance_is_a (GTypeInstance *instance,GType iface_type) __attribute__((__pure__)); 113 | extern 114 | gboolean g_type_check_instance_is_fundamentally_a (GTypeInstance *instance,GType fundamental_type) __attribute__((__pure__)); 115 | extern 116 | GTypeClass* g_type_check_class_cast (GTypeClass *g_class,GType is_a_type); 117 | extern 118 | gboolean g_type_check_class_is_a (GTypeClass *g_class,GType is_a_type) __attribute__((__pure__)); 119 | extern 120 | gboolean g_type_check_is_value_type (GType type) __attribute__((__const__)); 121 | extern 122 | gboolean g_type_check_value (const GValue *value) __attribute__((__pure__)); 123 | extern 124 | gboolean g_type_check_value_holds (const GValue *value,GType type) __attribute__((__pure__)); 125 | extern 126 | gboolean g_type_test_flags (GType type,guint flags) __attribute__((__const__)); 127 | extern 128 | const gchar * g_type_name_from_instance (GTypeInstance *instance); 129 | extern 130 | const gchar * g_type_name_from_class (GTypeClass *g_class);extern 131 | GParamSpec* g_param_spec_ref (GParamSpec *pspec); 132 | extern 133 | void g_param_spec_unref (GParamSpec *pspec); 134 | extern 135 | void g_param_spec_sink (GParamSpec *pspec); 136 | extern 137 | GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec); 138 | extern 139 | gpointer g_param_spec_get_qdata (GParamSpec *pspec,GQuark quark); 140 | extern 141 | void g_param_spec_set_qdata (GParamSpec *pspec,GQuark quark,gpointer data); 142 | extern 143 | void g_param_spec_set_qdata_full (GParamSpec *pspec,GQuark quark,gpointer data,GDestroyNotify destroy); 144 | extern 145 | gpointer g_param_spec_steal_qdata (GParamSpec *pspec,GQuark quark); 146 | extern 147 | GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec); 148 | extern 149 | void g_param_value_set_default (GParamSpec *pspec,GValue *value); 150 | extern 151 | gboolean g_param_value_defaults (GParamSpec *pspec,GValue *value); 152 | extern 153 | gboolean g_param_value_validate (GParamSpec *pspec,GValue *value); 154 | extern 155 | gboolean g_param_value_convert (GParamSpec *pspec,const GValue *src_value,GValue *dest_value,gboolean strict_validation); 156 | extern 157 | gint g_param_values_cmp (GParamSpec *pspec,const GValue *value1,const GValue *value2); 158 | extern 159 | const gchar * g_param_spec_get_name (GParamSpec *pspec); 160 | extern 161 | const gchar * g_param_spec_get_nick (GParamSpec *pspec); 162 | extern 163 | const gchar * g_param_spec_get_blurb (GParamSpec *pspec); 164 | extern 165 | void g_value_set_param (GValue *value,GParamSpec *param); 166 | extern 167 | GParamSpec* g_value_get_param (const GValue *value); 168 | extern 169 | GParamSpec* g_value_dup_param (const GValue *value); 170 | extern 171 | void g_value_take_param (GValue *value,GParamSpec *param); 172 | extern 173 | void g_value_set_param_take_ownership (GValue *value,GParamSpec *param); 174 | extern 175 | const GValue * g_param_spec_get_default_value (GParamSpec *pspec); 176 | extern 177 | GQuark g_param_spec_get_name_quark (GParamSpec *pspec);extern 178 | GType g_param_type_register_static (const gchar *name,const GParamSpecTypeInfo *pspec_info); 179 | extern 180 | gpointer g_param_spec_internal (GType param_type,const gchar *name,const gchar *nick,const gchar *blurb,GParamFlags flags); 181 | extern 182 | GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing); 183 | extern 184 | void g_param_spec_pool_insert (GParamSpecPool *pool,GParamSpec *pspec,GType owner_type); 185 | extern 186 | void g_param_spec_pool_remove (GParamSpecPool *pool,GParamSpec *pspec); 187 | extern 188 | GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool,const gchar *param_name,GType owner_type,gboolean walk_ancestors); 189 | extern 190 | GList* g_param_spec_pool_list_owned (GParamSpecPool *pool,GType owner_type); 191 | extern 192 | GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool,GType owner_type,guint *n_pspecs_p);extern 193 | GClosure* g_cclosure_new (GCallback callback_func,gpointer user_data,GClosureNotify destroy_data); 194 | extern 195 | GClosure* g_cclosure_new_swap (GCallback callback_func,gpointer user_data,GClosureNotify destroy_data); 196 | extern 197 | GClosure* g_signal_type_cclosure_new (GType itype,guint struct_offset); 198 | extern 199 | GClosure* g_closure_ref (GClosure *closure); 200 | extern 201 | void g_closure_sink (GClosure *closure); 202 | extern 203 | void g_closure_unref (GClosure *closure); 204 | extern 205 | GClosure* g_closure_new_simple (guint sizeof_closure,gpointer data); 206 | extern 207 | void g_closure_add_finalize_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 208 | extern 209 | void g_closure_remove_finalize_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 210 | extern 211 | void g_closure_add_invalidate_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 212 | extern 213 | void g_closure_remove_invalidate_notifier (GClosure *closure,gpointer notify_data,GClosureNotify notify_func); 214 | extern 215 | void g_closure_add_marshal_guards (GClosure *closure,gpointer pre_marshal_data,GClosureNotify pre_marshal_notify,gpointer post_marshal_data,GClosureNotify post_marshal_notify); 216 | extern 217 | void g_closure_set_marshal (GClosure *closure,GClosureMarshal marshal); 218 | extern 219 | void g_closure_set_meta_marshal (GClosure *closure,gpointer marshal_data,GClosureMarshal meta_marshal); 220 | extern 221 | void g_closure_invalidate (GClosure *closure); 222 | extern 223 | void g_closure_invoke (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint); 224 | extern 225 | void g_cclosure_marshal_generic (GClosure *closure,GValue *return_gvalue,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 226 | extern 227 | void g_cclosure_marshal_generic_va (GClosure *closure,GValue *return_value,gpointer instance,va_list args_list,gpointer marshal_data,int n_params,GType *param_types); 228 | extern 229 | void g_cclosure_marshal_VOID__VOID (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 230 | extern 231 | void g_cclosure_marshal_VOID__VOIDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 232 | extern 233 | void g_cclosure_marshal_VOID__BOOLEAN (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 234 | extern 235 | void g_cclosure_marshal_VOID__BOOLEANv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 236 | extern 237 | void g_cclosure_marshal_VOID__CHAR (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 238 | extern 239 | void g_cclosure_marshal_VOID__CHARv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 240 | extern 241 | void g_cclosure_marshal_VOID__UCHAR (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 242 | extern 243 | void g_cclosure_marshal_VOID__UCHARv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 244 | extern 245 | void g_cclosure_marshal_VOID__INT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 246 | extern 247 | void g_cclosure_marshal_VOID__INTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 248 | extern 249 | void g_cclosure_marshal_VOID__UINT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 250 | extern 251 | void g_cclosure_marshal_VOID__UINTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 252 | extern 253 | void g_cclosure_marshal_VOID__LONG (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 254 | extern 255 | void g_cclosure_marshal_VOID__LONGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 256 | extern 257 | void g_cclosure_marshal_VOID__ULONG (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 258 | extern 259 | void g_cclosure_marshal_VOID__ULONGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 260 | extern 261 | void g_cclosure_marshal_VOID__ENUM (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 262 | extern 263 | void g_cclosure_marshal_VOID__ENUMv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 264 | extern 265 | void g_cclosure_marshal_VOID__FLAGS (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 266 | extern 267 | void g_cclosure_marshal_VOID__FLAGSv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 268 | extern 269 | void g_cclosure_marshal_VOID__FLOAT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 270 | extern 271 | void g_cclosure_marshal_VOID__FLOATv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 272 | extern 273 | void g_cclosure_marshal_VOID__DOUBLE (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 274 | extern 275 | void g_cclosure_marshal_VOID__DOUBLEv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 276 | extern 277 | void g_cclosure_marshal_VOID__STRING (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 278 | extern 279 | void g_cclosure_marshal_VOID__STRINGv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 280 | extern 281 | void g_cclosure_marshal_VOID__PARAM (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 282 | extern 283 | void g_cclosure_marshal_VOID__PARAMv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 284 | extern 285 | void g_cclosure_marshal_VOID__BOXED (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 286 | extern 287 | void g_cclosure_marshal_VOID__BOXEDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 288 | extern 289 | void g_cclosure_marshal_VOID__POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 290 | extern 291 | void g_cclosure_marshal_VOID__POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 292 | extern 293 | void g_cclosure_marshal_VOID__OBJECT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 294 | extern 295 | void g_cclosure_marshal_VOID__OBJECTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 296 | extern 297 | void g_cclosure_marshal_VOID__VARIANT (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 298 | extern 299 | void g_cclosure_marshal_VOID__VARIANTv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 300 | extern 301 | void g_cclosure_marshal_VOID__UINT_POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 302 | extern 303 | void g_cclosure_marshal_VOID__UINT_POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 304 | extern 305 | void g_cclosure_marshal_BOOLEAN__FLAGS (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 306 | extern 307 | void g_cclosure_marshal_BOOLEAN__FLAGSv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 308 | extern 309 | void g_cclosure_marshal_STRING__OBJECT_POINTER (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 310 | extern 311 | void g_cclosure_marshal_STRING__OBJECT_POINTERv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types); 312 | extern 313 | void g_cclosure_marshal_BOOLEAN__BOXED_BOXED (GClosure *closure,GValue *return_value,guint n_param_values,const GValue *param_values,gpointer invocation_hint,gpointer marshal_data); 314 | extern 315 | void g_cclosure_marshal_BOOLEAN__BOXED_BOXEDv (GClosure *closure,GValue *return_value,gpointer instance,va_list args,gpointer marshal_data,int n_params,GType *param_types);extern 316 | GType g_date_get_type (void); 317 | extern 318 | GType g_strv_get_type (void); 319 | extern 320 | GType g_gstring_get_type (void); 321 | extern 322 | GType g_hash_table_get_type (void); 323 | extern 324 | GType g_array_get_type (void); 325 | extern 326 | GType g_byte_array_get_type (void); 327 | extern 328 | GType g_ptr_array_get_type (void); 329 | extern 330 | GType g_bytes_get_type (void); 331 | extern 332 | GType g_variant_type_get_gtype (void); 333 | extern 334 | GType g_regex_get_type (void); 335 | extern 336 | GType g_match_info_get_type (void); 337 | extern 338 | GType g_error_get_type (void); 339 | extern 340 | GType g_date_time_get_type (void); 341 | extern 342 | GType g_time_zone_get_type (void); 343 | extern 344 | GType g_io_channel_get_type (void); 345 | extern 346 | GType g_io_condition_get_type (void); 347 | extern 348 | GType g_variant_builder_get_type (void); 349 | extern 350 | GType g_variant_dict_get_type (void); 351 | extern 352 | GType g_key_file_get_type (void); 353 | extern 354 | GType g_main_loop_get_type (void); 355 | extern 356 | GType g_main_context_get_type (void); 357 | extern 358 | GType g_source_get_type (void); 359 | extern 360 | GType g_pollfd_get_type (void); 361 | extern 362 | GType g_thread_get_type (void); 363 | extern 364 | GType g_checksum_get_type (void); 365 | extern 366 | GType g_markup_parse_context_get_type (void); 367 | extern 368 | GType g_mapped_file_get_type (void); 369 | extern 370 | GType g_option_group_get_type (void); 371 | extern 372 | GType g_variant_get_gtype (void); 373 | extern 374 | gpointer g_boxed_copy (GType boxed_type,gconstpointer src_boxed); 375 | extern 376 | void g_boxed_free (GType boxed_type,gpointer boxed); 377 | extern 378 | void g_value_set_boxed (GValue *value,gconstpointer v_boxed); 379 | extern 380 | void g_value_set_static_boxed (GValue *value,gconstpointer v_boxed); 381 | extern 382 | void g_value_take_boxed (GValue *value,gconstpointer v_boxed); 383 | extern 384 | void g_value_set_boxed_take_ownership (GValue *value,gconstpointer v_boxed); 385 | extern 386 | gpointer g_value_get_boxed (const GValue *value); 387 | extern 388 | gpointer g_value_dup_boxed (const GValue *value); 389 | extern 390 | GType g_boxed_type_register_static (const gchar *name,GBoxedCopyFunc boxed_copy,GBoxedFreeFunc boxed_free); 391 | extern 392 | GType g_closure_get_type (void); 393 | extern 394 | GType g_value_get_type (void); 395 | extern 396 | GEnumValue* g_enum_get_value (GEnumClass *enum_class,gint value); 397 | extern 398 | GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class,const gchar *name); 399 | extern 400 | GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class,const gchar *nick); 401 | extern 402 | GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class,guint value); 403 | extern 404 | GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class,const gchar *name); 405 | extern 406 | GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class,const gchar *nick); 407 | extern 408 | gchar *g_enum_to_string (GType g_enum_type,gint value); 409 | extern 410 | gchar *g_flags_to_string (GType flags_type,guint value); 411 | extern 412 | void g_value_set_enum (GValue *value,gint v_enum); 413 | extern 414 | gint g_value_get_enum (const GValue *value); 415 | extern 416 | void g_value_set_flags (GValue *value,guint v_flags); 417 | extern 418 | guint g_value_get_flags (const GValue *value); 419 | extern 420 | GType g_enum_register_static (const gchar *name,const GEnumValue *const_static_values); 421 | extern 422 | GType g_flags_register_static (const gchar *name,const GFlagsValue *const_static_values); 423 | extern 424 | void g_enum_complete_type_info (GType g_enum_type,GTypeInfo *info,const GEnumValue *const_values); 425 | extern 426 | void g_flags_complete_type_info (GType g_flags_type,GTypeInfo *info,const GFlagsValue *const_values); 427 | extern 428 | GParamSpec* g_param_spec_char (const gchar *name,const gchar *nick,const gchar *blurb,gint8 minimum,gint8 maximum,gint8 default_value,GParamFlags flags); 429 | extern 430 | GParamSpec* g_param_spec_uchar (const gchar *name,const gchar *nick,const gchar *blurb,guint8 minimum,guint8 maximum,guint8 default_value,GParamFlags flags); 431 | extern 432 | GParamSpec* g_param_spec_boolean (const gchar *name,const gchar *nick,const gchar *blurb,gboolean default_value,GParamFlags flags); 433 | extern 434 | GParamSpec* g_param_spec_int (const gchar *name,const gchar *nick,const gchar *blurb,gint minimum,gint maximum,gint default_value,GParamFlags flags); 435 | extern 436 | GParamSpec* g_param_spec_uint (const gchar *name,const gchar *nick,const gchar *blurb,guint minimum,guint maximum,guint default_value,GParamFlags flags); 437 | extern 438 | GParamSpec* g_param_spec_long (const gchar *name,const gchar *nick,const gchar *blurb,glong minimum,glong maximum,glong default_value,GParamFlags flags); 439 | extern 440 | GParamSpec* g_param_spec_ulong (const gchar *name,const gchar *nick,const gchar *blurb,gulong minimum,gulong maximum,gulong default_value,GParamFlags flags); 441 | extern 442 | GParamSpec* g_param_spec_int64 (const gchar *name,const gchar *nick,const gchar *blurb,gint64 minimum,gint64 maximum,gint64 default_value,GParamFlags flags); 443 | extern 444 | GParamSpec* g_param_spec_uint64 (const gchar *name,const gchar *nick,const gchar *blurb,guint64 minimum,guint64 maximum,guint64 default_value,GParamFlags flags); 445 | extern 446 | GParamSpec* g_param_spec_unichar (const gchar *name,const gchar *nick,const gchar *blurb,gunichar default_value,GParamFlags flags); 447 | extern 448 | GParamSpec* g_param_spec_enum (const gchar *name,const gchar *nick,const gchar *blurb,GType enum_type,gint default_value,GParamFlags flags); 449 | extern 450 | GParamSpec* g_param_spec_flags (const gchar *name,const gchar *nick,const gchar *blurb,GType flags_type,guint default_value,GParamFlags flags); 451 | extern 452 | GParamSpec* g_param_spec_float (const gchar *name,const gchar *nick,const gchar *blurb,gfloat minimum,gfloat maximum,gfloat default_value,GParamFlags flags); 453 | extern 454 | GParamSpec* g_param_spec_double (const gchar *name,const gchar *nick,const gchar *blurb,gdouble minimum,gdouble maximum,gdouble default_value,GParamFlags flags); 455 | extern 456 | GParamSpec* g_param_spec_string (const gchar *name,const gchar *nick,const gchar *blurb,const gchar *default_value,GParamFlags flags); 457 | extern 458 | GParamSpec* g_param_spec_param (const gchar *name,const gchar *nick,const gchar *blurb,GType param_type,GParamFlags flags); 459 | extern 460 | GParamSpec* g_param_spec_boxed (const gchar *name,const gchar *nick,const gchar *blurb,GType boxed_type,GParamFlags flags); 461 | extern 462 | GParamSpec* g_param_spec_pointer (const gchar *name,const gchar *nick,const gchar *blurb,GParamFlags flags); 463 | extern 464 | GParamSpec* g_param_spec_value_array (const gchar *name,const gchar *nick,const gchar *blurb,GParamSpec *element_spec,GParamFlags flags); 465 | extern 466 | GParamSpec* g_param_spec_object (const gchar *name,const gchar *nick,const gchar *blurb,GType object_type,GParamFlags flags); 467 | extern 468 | GParamSpec* g_param_spec_override (const gchar *name,GParamSpec *overridden); 469 | extern 470 | GParamSpec* g_param_spec_gtype (const gchar *name,const gchar *nick,const gchar *blurb,GType is_a_type,GParamFlags flags); 471 | extern 472 | GParamSpec* g_param_spec_variant (const gchar *name,const gchar *nick,const gchar *blurb,const GVariantType *type,GVariant *default_value,GParamFlags flags); 473 | extern GType *g_param_spec_types; 474 | extern 475 | void g_source_set_closure (GSource *source,GClosure *closure); 476 | extern 477 | void g_source_set_dummy_callback (GSource *source); 478 | extern 479 | GType g_type_module_get_type (void); 480 | extern 481 | gboolean g_type_module_use (GTypeModule *module); 482 | extern 483 | void g_type_module_unuse (GTypeModule *module); 484 | extern 485 | void g_type_module_set_name (GTypeModule *module,const gchar *name); 486 | extern 487 | GType g_type_module_register_type (GTypeModule *module,GType parent_type,const gchar *type_name,const GTypeInfo *type_info,GTypeFlags flags); 488 | extern 489 | void g_type_module_add_interface (GTypeModule *module,GType instance_type,GType interface_type,const GInterfaceInfo *interface_info); 490 | extern 491 | GType g_type_module_register_enum (GTypeModule *module,const gchar *name,const GEnumValue *const_static_values); 492 | extern 493 | GType g_type_module_register_flags (GTypeModule *module,const gchar *name,const GFlagsValue *const_static_values); 494 | extern 495 | GType g_type_plugin_get_type (void); 496 | extern 497 | void g_type_plugin_use (GTypePlugin *plugin); 498 | extern 499 | void g_type_plugin_unuse (GTypePlugin *plugin); 500 | extern 501 | void g_type_plugin_complete_type_info (GTypePlugin *plugin,GType g_type,GTypeInfo *info,GTypeValueTable *value_table); 502 | extern 503 | void g_type_plugin_complete_interface_info (GTypePlugin *plugin,GType instance_type,GType interface_type,GInterfaceInfo *info); 504 | extern 505 | GType g_value_array_get_type (void); 506 | extern 507 | GValue* g_value_array_get_nth (GValueArray *value_array,guint index_); 508 | extern 509 | GValueArray* g_value_array_new (guint n_prealloced); 510 | extern 511 | void g_value_array_free (GValueArray *value_array); 512 | extern 513 | GValueArray* g_value_array_copy (const GValueArray *value_array); 514 | extern 515 | GValueArray* g_value_array_prepend (GValueArray *value_array,const GValue *value); 516 | extern 517 | GValueArray* g_value_array_append (GValueArray *value_array,const GValue *value); 518 | extern 519 | GValueArray* g_value_array_insert (GValueArray *value_array,guint index_,const GValue *value); 520 | extern 521 | GValueArray* g_value_array_remove (GValueArray *value_array,guint index_); 522 | extern 523 | GValueArray* g_value_array_sort (GValueArray *value_array,GCompareFunc compare_func); 524 | extern 525 | GValueArray* g_value_array_sort_with_data (GValueArray *value_array,GCompareDataFunc compare_func,gpointer user_data); 526 | extern 527 | void g_value_set_char (GValue *value,gchar v_char); 528 | extern 529 | gchar g_value_get_char (const GValue *value); 530 | extern 531 | void g_value_set_schar (GValue *value,gint8 v_char); 532 | extern 533 | gint8 g_value_get_schar (const GValue *value); 534 | extern 535 | void g_value_set_uchar (GValue *value,guchar v_uchar); 536 | extern 537 | guchar g_value_get_uchar (const GValue *value); 538 | extern 539 | void g_value_set_boolean (GValue *value,gboolean v_boolean); 540 | extern 541 | gboolean g_value_get_boolean (const GValue *value); 542 | extern 543 | void g_value_set_int (GValue *value,gint v_int); 544 | extern 545 | gint g_value_get_int (const GValue *value); 546 | extern 547 | void g_value_set_uint (GValue *value,guint v_uint); 548 | extern 549 | guint g_value_get_uint (const GValue *value); 550 | extern 551 | void g_value_set_long (GValue *value,glong v_long); 552 | extern 553 | glong g_value_get_long (const GValue *value); 554 | extern 555 | void g_value_set_ulong (GValue *value,gulong v_ulong); 556 | extern 557 | gulong g_value_get_ulong (const GValue *value); 558 | extern 559 | void g_value_set_int64 (GValue *value,gint64 v_int64); 560 | extern 561 | gint64 g_value_get_int64 (const GValue *value); 562 | extern 563 | void g_value_set_uint64 (GValue *value,guint64 v_uint64); 564 | extern 565 | guint64 g_value_get_uint64 (const GValue *value); 566 | extern 567 | void g_value_set_float (GValue *value,gfloat v_float); 568 | extern 569 | gfloat g_value_get_float (const GValue *value); 570 | extern 571 | void g_value_set_double (GValue *value,gdouble v_double); 572 | extern 573 | gdouble g_value_get_double (const GValue *value); 574 | extern 575 | void g_value_set_string (GValue *value,const gchar *v_string); 576 | extern 577 | void g_value_set_static_string (GValue *value,const gchar *v_string); 578 | extern 579 | const gchar * g_value_get_string (const GValue *value); 580 | extern 581 | gchar* g_value_dup_string (const GValue *value); 582 | extern 583 | void g_value_set_pointer (GValue *value,gpointer v_pointer); 584 | extern 585 | gpointer g_value_get_pointer (const GValue *value); 586 | extern 587 | GType g_gtype_get_type (void); 588 | extern 589 | void g_value_set_gtype (GValue *value,GType v_gtype); 590 | extern 591 | GType g_value_get_gtype (const GValue *value); 592 | extern 593 | void g_value_set_variant (GValue *value,GVariant *variant); 594 | extern 595 | void g_value_take_variant (GValue *value,GVariant *variant); 596 | extern 597 | GVariant* g_value_get_variant (const GValue *value); 598 | extern 599 | GVariant* g_value_dup_variant (const GValue *value); 600 | extern 601 | GType g_pointer_type_register_static (const gchar *name); 602 | extern 603 | gchar* g_strdup_value_contents (const GValue *value); 604 | extern 605 | void g_value_take_string (GValue *value,gchar *v_string); 606 | extern 607 | void g_value_set_string_take_ownership (GValue *value,gchar *v_string); 608 | GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void); 609 | GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void); 610 | GLIB_AVAILABLE_IN_2_60 GType g_unicode_script_get_type (void); 611 | GLIB_AVAILABLE_IN_2_60 GType g_normalize_mode_get_type (void); 612 | -------------------------------------------------------------------------------- /src/include/pango_cairo.h: -------------------------------------------------------------------------------- 1 | extern GType pango_cairo_font_map_get_type(void); 2 | extern PangoFontMap *pango_cairo_font_map_new(void); 3 | extern PangoFontMap *pango_cairo_font_map_new_for_font_type(cairo_font_type_t fonttype); 4 | extern PangoFontMap *pango_cairo_font_map_get_default(void); 5 | extern void pango_cairo_font_map_set_default(PangoCairoFontMap *fontmap); 6 | extern cairo_font_type_t pango_cairo_font_map_get_font_type(PangoCairoFontMap *fontmap); 7 | extern void pango_cairo_font_map_set_resolution(PangoCairoFontMap *fontmap, double dpi); 8 | extern double pango_cairo_font_map_get_resolution(PangoCairoFontMap *fontmap); 9 | extern PangoContext *pango_cairo_font_map_create_context(PangoCairoFontMap *fontmap); 10 | extern GType pango_cairo_font_get_type(void); 11 | extern cairo_scaled_font_t *pango_cairo_font_get_scaled_font(PangoCairoFont *font); 12 | extern void pango_cairo_update_context(cairo_t *cr, PangoContext *context); 13 | extern void pango_cairo_context_set_font_options(PangoContext *context, const cairo_font_options_t *options); 14 | extern const cairo_font_options_t *pango_cairo_context_get_font_options(PangoContext *context); 15 | extern void pango_cairo_context_set_resolution(PangoContext *context, double dpi); 16 | extern double pango_cairo_context_get_resolution(PangoContext *context); 17 | extern void pango_cairo_context_set_shape_renderer(PangoContext *context, PangoCairoShapeRendererFunc func, gpointer data, GDestroyNotify dnotify); 18 | extern PangoCairoShapeRendererFunc pango_cairo_context_get_shape_renderer(PangoContext *context, gpointer *data); 19 | extern PangoContext *pango_cairo_create_context(cairo_t *cr); 20 | extern PangoLayout *pango_cairo_create_layout(cairo_t *cr); 21 | extern void pango_cairo_update_layout(cairo_t *cr, PangoLayout *layout); 22 | extern void pango_cairo_show_glyph_string(cairo_t *cr, PangoFont *font, PangoGlyphString *glyphs); 23 | extern void pango_cairo_show_glyph_item(cairo_t *cr, const char *text, PangoGlyphItem *glyph_item); 24 | extern void pango_cairo_show_layout_line(cairo_t *cr, PangoLayoutLine *line); 25 | extern void pango_cairo_show_layout(cairo_t *cr, PangoLayout *layout); 26 | extern void pango_cairo_show_error_underline(cairo_t *cr, double x, double y, double width, double height); 27 | extern void pango_cairo_glyph_string_path(cairo_t *cr, PangoFont *font, PangoGlyphString *glyphs); 28 | extern void pango_cairo_layout_line_path(cairo_t *cr, PangoLayoutLine *line); 29 | extern void pango_cairo_layout_path(cairo_t *cr, PangoLayout *layout); 30 | extern void pango_cairo_error_underline_path(cairo_t *cr, double x, double y, double width, double height); 31 | -------------------------------------------------------------------------------- /src/include/pixbuf.h: -------------------------------------------------------------------------------- 1 | extern const guint gdk_pixbuf_major_version; 2 | extern const guint gdk_pixbuf_minor_version; 3 | extern const guint gdk_pixbuf_micro_version; 4 | extern const char *gdk_pixbuf_version; 5 | extern GQuark gdk_pixbuf_error_quark(void); 6 | extern GType gdk_pixbuf_get_type(void); 7 | extern GdkPixbuf *gdk_pixbuf_ref(GdkPixbuf *pixbuf); 8 | extern void gdk_pixbuf_unref(GdkPixbuf *pixbuf); 9 | extern GdkColorspace gdk_pixbuf_get_colorspace(const GdkPixbuf *pixbuf); 10 | extern int gdk_pixbuf_get_n_channels(const GdkPixbuf *pixbuf); 11 | extern gboolean gdk_pixbuf_get_has_alpha(const GdkPixbuf *pixbuf); 12 | extern int gdk_pixbuf_get_bits_per_sample(const GdkPixbuf *pixbuf); 13 | extern guchar *gdk_pixbuf_get_pixels(const GdkPixbuf *pixbuf); 14 | extern int gdk_pixbuf_get_width(const GdkPixbuf *pixbuf); 15 | extern int gdk_pixbuf_get_height(const GdkPixbuf *pixbuf); 16 | extern int gdk_pixbuf_get_rowstride(const GdkPixbuf *pixbuf); 17 | extern gsize gdk_pixbuf_get_byte_length(const GdkPixbuf *pixbuf); 18 | extern guchar *gdk_pixbuf_get_pixels_with_length(const GdkPixbuf *pixbuf, guint *length); 19 | extern const guint8* gdk_pixbuf_read_pixels(const GdkPixbuf *pixbuf); 20 | extern GBytes * gdk_pixbuf_read_pixel_bytes(const GdkPixbuf *pixbuf); 21 | extern GdkPixbuf *gdk_pixbuf_new(GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height); 22 | extern gint gdk_pixbuf_calculate_rowstride(GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height); 23 | extern GdkPixbuf *gdk_pixbuf_copy(const GdkPixbuf *pixbuf); 24 | extern GdkPixbuf *gdk_pixbuf_new_subpixbuf(GdkPixbuf *src_pixbuf, int src_x, int src_y, int width, int height); 25 | extern GdkPixbuf *gdk_pixbuf_new_from_file(const char *filename, GError **error); 26 | extern GdkPixbuf *gdk_pixbuf_new_from_file_at_size(const char *filename, int width, int height, GError **error); 27 | extern GdkPixbuf *gdk_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio, GError **error); 28 | extern GdkPixbuf *gdk_pixbuf_new_from_resource(const char *resource_path, GError **error); 29 | extern GdkPixbuf *gdk_pixbuf_new_from_resource_at_scale(const char *resource_path, int width, int height, gboolean preserve_aspect_ratio, GError **error); 30 | extern GdkPixbuf *gdk_pixbuf_new_from_data(const guchar *data, GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height, int rowstride, GdkPixbufDestroyNotify destroy_fn, gpointer destroy_fn_data); 31 | extern GdkPixbuf *gdk_pixbuf_new_from_bytes(GBytes *data, GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height, int rowstride); 32 | extern GdkPixbuf *gdk_pixbuf_new_from_xpm_data(const char **data); 33 | extern GdkPixbuf* gdk_pixbuf_new_from_inline(gint data_length, const guint8 *data, gboolean copy_pixels, GError **error); 34 | extern void gdk_pixbuf_fill(GdkPixbuf *pixbuf, guint32 pixel); 35 | LIBGTK_FUNC_AVAILABLE_IN_UINX gboolean gdk_pixbuf_save(GdkPixbuf *pixbuf, const char *filename, const char *type, GError **error, ...); 36 | LIBGTK_FUNC_AVAILABLE_IN_WIN gboolean gdk_pixbuf_savev_utf8(GdkPixbuf *pixbuf, const char *filename, const char *type, char **option_keys, char **option_values, GError **error); 37 | extern gboolean gdk_pixbuf_savev(GdkPixbuf *pixbuf, const char *filename, const char *type, char **option_keys, char **option_values, GError **error); 38 | extern gboolean gdk_pixbuf_save_to_callback(GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, GError **error, ...); 39 | extern gboolean gdk_pixbuf_save_to_callbackv(GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, char **option_keys, char **option_values, GError **error); 40 | extern gboolean gdk_pixbuf_save_to_buffer(GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, GError **error, ...); 41 | extern gboolean gdk_pixbuf_save_to_bufferv(GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, char **option_keys, char **option_values, GError **error); 42 | extern GdkPixbuf *gdk_pixbuf_new_from_stream(GInputStream *stream, GCancellable *cancellable, GError **error); 43 | extern void gdk_pixbuf_new_from_stream_async(GInputStream *stream, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 44 | extern GdkPixbuf *gdk_pixbuf_new_from_stream_finish(GAsyncResult *async_result, GError **error); 45 | extern GdkPixbuf *gdk_pixbuf_new_from_stream_at_scale(GInputStream *stream, gint width, gint height, gboolean preserve_aspect_ratio, GCancellable *cancellable, GError **error); 46 | extern void gdk_pixbuf_new_from_stream_at_scale_async(GInputStream *stream, gint width, gint height, gboolean preserve_aspect_ratio, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 47 | extern gboolean gdk_pixbuf_save_to_stream(GdkPixbuf *pixbuf, GOutputStream *stream, const char *type, GCancellable *cancellable, GError **error, ...); 48 | extern void gdk_pixbuf_save_to_stream_async(GdkPixbuf *pixbuf, GOutputStream *stream, const gchar *type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, ...); 49 | extern gboolean gdk_pixbuf_save_to_stream_finish(GAsyncResult *async_result, GError **error); 50 | extern void gdk_pixbuf_save_to_streamv_async(GdkPixbuf *pixbuf, GOutputStream *stream, const gchar *type, gchar **option_keys, gchar **option_values, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 51 | extern gboolean gdk_pixbuf_save_to_streamv(GdkPixbuf *pixbuf, GOutputStream *stream, const char *type, char **option_keys, char **option_values, GCancellable *cancellable, GError **error); 52 | extern GdkPixbuf *gdk_pixbuf_add_alpha(const GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b); 53 | extern void gdk_pixbuf_copy_area(const GdkPixbuf *src_pixbuf, int src_x, int src_y, int width, int height, GdkPixbuf *dest_pixbuf, int dest_x, int dest_y); 54 | extern void gdk_pixbuf_saturate_and_pixelate(const GdkPixbuf *src, GdkPixbuf *dest, gfloat saturation, gboolean pixelate); 55 | extern GdkPixbuf *gdk_pixbuf_apply_embedded_orientation(GdkPixbuf *src); 56 | extern gboolean gdk_pixbuf_set_option(GdkPixbuf *pixbuf, const gchar *key, const gchar *value); 57 | extern const gchar * gdk_pixbuf_get_option(GdkPixbuf *pixbuf, const gchar *key); 58 | extern gboolean gdk_pixbuf_remove_option(GdkPixbuf *pixbuf, const gchar *key); 59 | extern GHashTable * gdk_pixbuf_get_options(GdkPixbuf *pixbuf); 60 | extern gboolean gdk_pixbuf_copy_options(GdkPixbuf *src_pixbuf, GdkPixbuf *dest_pixbuf); 61 | extern void gdk_pixbuf_scale(const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, GdkInterpType interp_type); 62 | extern void gdk_pixbuf_composite(const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, GdkInterpType interp_type, int overall_alpha); 63 | extern void gdk_pixbuf_composite_color(const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, GdkInterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, guint32 color1, guint32 color2); 64 | extern GdkPixbuf *gdk_pixbuf_scale_simple(const GdkPixbuf *src, int dest_width, int dest_height, GdkInterpType interp_type); 65 | extern GdkPixbuf *gdk_pixbuf_composite_color_simple(const GdkPixbuf *src, int dest_width, int dest_height, GdkInterpType interp_type, int overall_alpha, int check_size, guint32 color1, guint32 color2); 66 | extern GdkPixbuf *gdk_pixbuf_rotate_simple(const GdkPixbuf *src, GdkPixbufRotation angle); 67 | extern GdkPixbuf *gdk_pixbuf_flip(const GdkPixbuf *src, gboolean horizontal); 68 | extern GType gdk_pixbuf_animation_get_type(void); 69 | extern GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file(const char *filename, GError **error); 70 | extern GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream(GInputStream *stream, GCancellable *cancellable, GError **error); 71 | extern void gdk_pixbuf_animation_new_from_stream_async(GInputStream *stream, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 72 | extern GdkPixbufAnimation *gdk_pixbuf_animation_new_from_stream_finish(GAsyncResult*async_result, GError **error); 73 | extern GdkPixbufAnimation *gdk_pixbuf_animation_new_from_resource(const char *resource_path, GError **error); 74 | extern GdkPixbufAnimation *gdk_pixbuf_animation_ref(GdkPixbufAnimation *animation); 75 | extern void gdk_pixbuf_animation_unref(GdkPixbufAnimation *animation); 76 | extern int gdk_pixbuf_animation_get_width(GdkPixbufAnimation *animation); 77 | extern int gdk_pixbuf_animation_get_height(GdkPixbufAnimation *animation); 78 | extern gboolean gdk_pixbuf_animation_is_static_image(GdkPixbufAnimation *animation); 79 | extern GdkPixbuf *gdk_pixbuf_animation_get_static_image(GdkPixbufAnimation *animation); 80 | extern GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter(GdkPixbufAnimation *animation, const GTimeVal *start_time); 81 | extern GType gdk_pixbuf_animation_iter_get_type(void); 82 | extern int gdk_pixbuf_animation_iter_get_delay_time(GdkPixbufAnimationIter *iter); 83 | extern GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf(GdkPixbufAnimationIter *iter); 84 | extern gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame(GdkPixbufAnimationIter *iter); 85 | extern gboolean gdk_pixbuf_animation_iter_advance(GdkPixbufAnimationIter *iter, const GTimeVal *current_time); 86 | extern GType gdk_pixbuf_simple_anim_get_type(void); 87 | extern GType gdk_pixbuf_simple_anim_iter_get_type(void); 88 | extern GdkPixbufSimpleAnim *gdk_pixbuf_simple_anim_new(gint width, gint height, gfloat rate); 89 | extern void gdk_pixbuf_simple_anim_add_frame(GdkPixbufSimpleAnim *animation, GdkPixbuf *pixbuf); 90 | extern void gdk_pixbuf_simple_anim_set_loop(GdkPixbufSimpleAnim *animation, gboolean loop); 91 | extern gboolean gdk_pixbuf_simple_anim_get_loop(GdkPixbufSimpleAnim *animation); 92 | GDK_PIXBUF_AVAILABLE_IN_2_40 gboolean gdk_pixbuf_init_modules(const char *path, GError **error); 93 | extern GType gdk_pixbuf_format_get_type(void); 94 | extern GSList *gdk_pixbuf_get_formats(void); 95 | extern gchar *gdk_pixbuf_format_get_name(GdkPixbufFormat *format); 96 | extern gchar *gdk_pixbuf_format_get_description(GdkPixbufFormat *format); 97 | extern gchar **gdk_pixbuf_format_get_mime_types(GdkPixbufFormat *format); 98 | extern gchar **gdk_pixbuf_format_get_extensions(GdkPixbufFormat *format); 99 | extern gboolean gdk_pixbuf_format_is_save_option_supported(GdkPixbufFormat *format, const gchar *option_key); 100 | extern gboolean gdk_pixbuf_format_is_writable(GdkPixbufFormat *format); 101 | extern gboolean gdk_pixbuf_format_is_scalable(GdkPixbufFormat *format); 102 | extern gboolean gdk_pixbuf_format_is_disabled(GdkPixbufFormat *format); 103 | extern void gdk_pixbuf_format_set_disabled(GdkPixbufFormat *format, gboolean disabled); 104 | extern gchar *gdk_pixbuf_format_get_license(GdkPixbufFormat *format); 105 | extern GdkPixbufFormat *gdk_pixbuf_get_file_info(const gchar *filename, gint *width, gint *height); 106 | extern void gdk_pixbuf_get_file_info_async(const gchar *filename, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 107 | extern GdkPixbufFormat *gdk_pixbuf_get_file_info_finish(GAsyncResult *async_result, gint *width, gint *height, GError **error); 108 | extern GdkPixbufFormat *gdk_pixbuf_format_copy(const GdkPixbufFormat *format); 109 | extern void gdk_pixbuf_format_free(GdkPixbufFormat *format); 110 | extern GType gdk_pixbuf_loader_get_type(void); 111 | extern GdkPixbufLoader * gdk_pixbuf_loader_new(void); 112 | extern GdkPixbufLoader * gdk_pixbuf_loader_new_with_type(const char *image_type, GError **error); 113 | extern GdkPixbufLoader * gdk_pixbuf_loader_new_with_mime_type(const char *mime_type, GError **error); 114 | extern void gdk_pixbuf_loader_set_size(GdkPixbufLoader *loader, int width, int height); 115 | extern gboolean gdk_pixbuf_loader_write(GdkPixbufLoader *loader, const guchar *buf, gsize count, GError **error); 116 | extern gboolean gdk_pixbuf_loader_write_bytes(GdkPixbufLoader *loader, GBytes *buffer, GError **error); 117 | extern GdkPixbuf * gdk_pixbuf_loader_get_pixbuf(GdkPixbufLoader *loader); 118 | extern GdkPixbufAnimation * gdk_pixbuf_loader_get_animation(GdkPixbufLoader *loader); 119 | extern gboolean gdk_pixbuf_loader_close(GdkPixbufLoader *loader, GError **error); 120 | extern GdkPixbufFormat *gdk_pixbuf_loader_get_format(GdkPixbufLoader *loader); 121 | extern GType gdk_pixbuf_alpha_mode_get_type(void); 122 | extern GType gdk_colorspace_get_type(void); 123 | extern GType gdk_pixbuf_error_get_type(void); 124 | extern GType gdk_interp_type_get_type(void); 125 | extern GType gdk_pixbuf_rotation_get_type(void); 126 | -------------------------------------------------------------------------------- /tests/basics.php: -------------------------------------------------------------------------------- 1 | gtk_application_window_new($app); 10 | $gtk->gtk_window_set_title($gtk->GTK_WINDOW($window), "Window"); 11 | $gtk->gtk_window_set_default_size($gtk->GTK_WINDOW($window), 200, 200); 12 | $gtk->gtk_widget_show_all($window); 13 | } catch(\Error $e) { 14 | echo $e; 15 | } 16 | } 17 | 18 | function main($argc, $argv): int 19 | { 20 | global $gtk; 21 | 22 | $app = $gtk->gtk_application_new("org.gtk.example", 0); 23 | 24 | $gtk->g_signal_connect($app, "activate", $gtk->G_CALLBACK('activate')); 25 | 26 | $gapp = $gtk->G_APPLICATION($app); 27 | 28 | $status = $gtk->g_application_run($gapp, $argc, $argv); 29 | 30 | $gtk->g_object_unref($app); 31 | return $status; 32 | } 33 | 34 | return main($argc, $argv); 35 | -------------------------------------------------------------------------------- /tests/buildinterface.php: -------------------------------------------------------------------------------- 1 | g_print("Hello World\n"); 9 | } 10 | 11 | function main($argc, $argv) 12 | { 13 | global $gtk; 14 | $error = $gtk->ffi->new('GError*', false); 15 | $gtk->gtk_init($argc, $argv); 16 | /* Construct a GtkBuilder instance and load our UI description */ 17 | $builder = $gtk->gtk_builder_new(); 18 | if ($gtk->gtk_builder_add_from_file($builder, __DIR__ ."/buildinterface.ui", FFI::addr($error)) == 0) { 19 | $gtk->g_printerr("Error loading file: %s\n", $error->message); 20 | $gtk->g_clear_error(FFI::addr($error)); 21 | return 1; 22 | } 23 | /* Connect signal handlers to the constructed widgets. */ 24 | $window = $gtk->gtk_builder_get_object($builder, "window"); 25 | $gtk->g_signal_connect($window, "destroy", $gtk->G_CALLBACK([$gtk, 'gtk_main_quit', true]), NULL); 26 | $button = $gtk->gtk_builder_get_object($builder, "button1"); 27 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK('print_hello'), NULL); 28 | $button = $gtk->gtk_builder_get_object($builder, "button2"); 29 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK('print_hello'), NULL); 30 | $button = $gtk->gtk_builder_get_object($builder, "quit"); 31 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK([$gtk, 'gtk_main_quit', true]), NULL); 32 | 33 | $gtk->gtk_main(); 34 | 35 | return 0; 36 | } 37 | main($argc, $argv); 38 | -------------------------------------------------------------------------------- /tests/buildinterface.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | True 4 | Grid 5 | 10 6 | 7 | 8 | True 9 | 10 | 11 | True 12 | Button 1 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | True 22 | Button 2 23 | 24 | 25 | 1 26 | 0 27 | 28 | 29 | 30 | 31 | True 32 | Quit 33 | 34 | 35 | 0 36 | 1 37 | 2 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tests/devtest.php: -------------------------------------------------------------------------------- 1 | gtk_init($argc, $argv); 6 | 7 | // Create the main window 8 | $mainwin = $gtk->gtk_window_new($gtk->GTK_WINDOW_TOPLEVEL); 9 | 10 | GtkWidget::init($gtk); 11 | 12 | $b = $gtk->gtk_builder_new_from_string('*', -1); 13 | $obj = $gtk->gtk_builder_get_object($b, 'entry1'); 14 | $w = $gtk->GTK_WIDGET($obj); 15 | $e = $gtk->GTK_ENTRY($obj); 16 | $gtk->gtk_entry_set_invisible_char($e, ord('*')); 17 | $gtk->gtk_entry_set_visibility($e, false); 18 | $gtk->gtk_container_add($gtk->GTK_CONTAINER($mainwin), $w); 19 | 20 | // ... 21 | // Show the application window 22 | $gtk->gtk_widget_show_all($mainwin); 23 | 24 | // Enter the main event loop, and wait for user interaction 25 | $gtk->gtk_main(); 26 | -------------------------------------------------------------------------------- /tests/helloword.php: -------------------------------------------------------------------------------- 1 | g_print("Hello World\n"); 8 | 9 | } 10 | 11 | function activate($app, $user_data) 12 | { 13 | global $gtk; 14 | try { 15 | 16 | $window = $gtk->gtk_application_window_new($app); 17 | $gtk->gtk_window_set_title($gtk->GTK_WINDOW($window), "Window"); 18 | $gtk->gtk_window_set_default_size($gtk->GTK_WINDOW($window), 200, 200); 19 | 20 | $button_box = $gtk->gtk_button_box_new($gtk->GTK_ORIENTATION_HORIZONTAL); 21 | 22 | $gtk->gtk_container_add($gtk->GTK_CONTAINER($window), $button_box); 23 | 24 | $button = $gtk->gtk_button_new_with_label("Hello World"); 25 | 26 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK('print_hello'), NULL); 27 | 28 | $gtk->g_signal_connect_swapped($button, "clicked", $gtk->G_CALLBACK([$gtk, 'gtk_widget_destroy', true]), $window); 29 | 30 | $gtk->gtk_container_add($gtk->GTK_CONTAINER($button_box), $button); 31 | 32 | $gtk->gtk_widget_show_all($window); 33 | 34 | } catch(\Error $e) { 35 | echo $e; 36 | } catch(\Exception $e) { 37 | echo $e; 38 | } 39 | } 40 | 41 | 42 | function main(int $argc, $argv): int 43 | { 44 | global $gtk,$app; 45 | 46 | $app = $gtk->gtk_application_new("org.gtk.example", $gtk->G_APPLICATION_FLAGS_NONE); 47 | $gtk->g_signal_connect($app, "activate", $gtk->G_CALLBACK('activate'), NULL); 48 | 49 | $status = $gtk->g_application_run($gtk->G_APPLICATION($app), $argc, $argv); 50 | 51 | $gtk->g_object_unref($app); 52 | 53 | return $status; 54 | } 55 | main($argc, $argv); 56 | -------------------------------------------------------------------------------- /tests/load.php: -------------------------------------------------------------------------------- 1 | >>>>>>>>>>>>>>>>>>>>>>>>" . PHP_EOL; 27 | var_dump($v); 28 | echo '<<<<<<<<<<<<<<<<<<<<<<<<<' . PHP_EOL; 29 | } 30 | -------------------------------------------------------------------------------- /tests/mainloop.php: -------------------------------------------------------------------------------- 1 | gtk_init($argc, $argv); 15 | 16 | // Create the main window 17 | $mainwin = $gtk->gtk_window_new($gtk->GTK_WINDOW_TOPLEVEL); 18 | 19 | // Set up our GUI elements 20 | 21 | // ... 22 | 23 | // Show the application window 24 | $gtk->gtk_widget_show_all($mainwin); 25 | 26 | // Enter the main event loop, and wait for user interaction 27 | $gtk->gtk_main(); 28 | 29 | // The user lost interest 30 | return 0; 31 | } 32 | 33 | main($argc, $argv); 34 | -------------------------------------------------------------------------------- /tests/packing.php: -------------------------------------------------------------------------------- 1 | g_print("Hello World\n"); 8 | } 9 | 10 | function activate($app, $user_data) 11 | { 12 | global $gtk; 13 | try { 14 | /* create a new window, and set its title */ 15 | $window = $gtk->gtk_application_window_new($app); 16 | $gtk->gtk_window_set_title($gtk->GTK_WINDOW($window), "Window"); 17 | $gtk->gtk_container_set_border_width($gtk->GTK_CONTAINER($window), 10); 18 | 19 | /* Here we construct the container that is going pack our buttons */ 20 | $grid = $gtk->gtk_grid_new(); 21 | 22 | /* Pack the container in the window */ 23 | $gtk->gtk_container_add($gtk->GTK_CONTAINER($window), $grid); 24 | 25 | $button = $gtk->gtk_button_new_with_label("Button 1"); 26 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK('print_hello'), NULL); 27 | 28 | /* Place the first button in the grid cell (0, 0), and make it fill 29 | * just 1 cell horizontally and vertically (ie no spanning) 30 | */ 31 | $gtk->gtk_grid_attach($gtk->GTK_GRID($grid), $button, 0, 0, 1, 1); 32 | 33 | $button = $gtk->gtk_button_new_with_label("Button 2"); 34 | $gtk->g_signal_connect($button, "clicked", $gtk->G_CALLBACK('print_hello'), NULL); 35 | 36 | /* Place the second button in the grid cell (1, 0), and make it fill 37 | * just 1 cell horizontally and vertically (ie no spanning) 38 | */ 39 | $gtk->gtk_grid_attach($gtk->GTK_GRID($grid), $button, 1, 0, 1, 1); 40 | 41 | $button = $gtk->gtk_button_new_with_label("Quit"); 42 | $gtk->g_signal_connect_swapped($button, "clicked", $gtk->G_CALLBACK([$gtk, 'gtk_widget_destroy', true]), $window); 43 | 44 | /* Place the Quit button in the grid cell (0, 1), and make it 45 | * span 2 columns. 46 | */ 47 | $gtk->gtk_grid_attach($gtk->GTK_GRID($grid), $button, 0, 1, 2, 1); 48 | 49 | /* Now that we are done packing our widgets, we show them all 50 | * in one go, by calling gtk_widget_show_all() on the window. 51 | * This call recursively calls gtk_widget_show() on all widgets 52 | * that are contained in the window, directly or indirectly. 53 | */ 54 | $gtk->gtk_widget_show_all($window); 55 | } catch(Error $e) { 56 | echo $e; 57 | } catch(Exception $e) { 58 | echo $e; 59 | } 60 | } 61 | 62 | function 63 | main( 64 | int $argc, 65 | $argv 66 | ) { 67 | global $gtk; 68 | $app = $gtk->gtk_application_new("org.gtk.example", $gtk->G_APPLICATION_FLAGS_NONE); 69 | $gtk->g_signal_connect($app, "activate", $gtk->G_CALLBACK('activate'), NULL); 70 | $status = $gtk->g_application_run($gtk->G_APPLICATION($app), $argc, $argv); 71 | $gtk->g_object_unref($app); 72 | 73 | return $status; 74 | } 75 | 76 | main($argc, $argv); 77 | -------------------------------------------------------------------------------- /tests/version.php: -------------------------------------------------------------------------------- 1 | g_print("Hello World\n"); 13 | } 14 | 15 | function activate($app, $user_data) 16 | { 17 | global $gtk; 18 | try { 19 | 20 | $w = GtkWidget::gtk_application_window_new($app); 21 | $window = $w->parent('GtkWindow'); 22 | $window->set_title("Window"); 23 | $window->set_default_size(200, 200); 24 | 25 | $button_box = GtkWidget::gtk_button_box_new($gtk->GTK_ORIENTATION_HORIZONTAL); 26 | $wc = $window->container(); 27 | $wc->add($button_box); 28 | $bbc = $button_box->container(); 29 | $button = GtkWidget::gtk_button_new_with_label("Hello World"); 30 | 31 | $button->sConnect("clicked", 'print_hello'); 32 | 33 | $button->sConnectS("clicked", [$gtk, 'gtk_widget_destroy', true], $window); 34 | 35 | $bbc->add($button); 36 | 37 | GtkWidget::gtk_widget_show_all($window); 38 | } catch(\Error $e) { 39 | echo $e; 40 | } catch(\Exception $e) { 41 | echo $e; 42 | } 43 | } 44 | 45 | function main(int $argc, $argv): int 46 | { 47 | global $gtk, $app; 48 | 49 | $app = $gtk->gtk_application_new("org.gtk.example", $gtk->G_APPLICATION_FLAGS_NONE); 50 | $gtk->g_signal_connect($app, "activate", $gtk->G_CALLBACK('activate'), NULL); 51 | 52 | $status = $gtk->g_application_run($gtk->G_APPLICATION($app), $argc, $argv); 53 | 54 | $gtk->g_object_unref($app); 55 | 56 | return $status; 57 | } 58 | 59 | main($argc, $argv); 60 | --------------------------------------------------------------------------------