cvs: php-gtk /ext/gtkhtml Makefile.in config.m4 gtkhtml.defs gtkhtml.overrides gtkhtml.php php_gtkhtml.c php_gtkhtml.h

From: Date: Wed, 28 Nov 2001 01:28:33 +0000
Subject: cvs: php-gtk /ext/gtkhtml Makefile.in config.m4 gtkhtml.defs gtkhtml.overrides gtkhtml.php php_gtkhtml.c php_gtkhtml.h
Groups: php.gtk.cvs 
Request: Send a blank email to php-gtk-cvs+get-339@lists.php.net to get a copy of this message
alan_k Tue Nov 27 20:28:33 2001 EDT Added files: /php-gtk/ext/gtkhtml Makefile.in config.m4 gtkhtml.defs gtkhtml.overrides gtkhtml.php php_gtkhtml.c php_gtkhtml.h Log: first import of gtkhtml widget

Index: php-gtk/ext/gtkhtml/Makefile.in +++ php-gtk/ext/gtkhtml/Makefile.in LTLIBRARY_NAME = libgtkhtml.la LTLIBRARY_SOURCES = php_gtkhtml.c gen_gtkhtml.c LTLIBRARY_LIBADD = $(HTML_SHARED_LIBADD) LTLIBRARY_SHARED_NAME = php_gtk_gtkhtml.la LTLIBRARY_SHARED_LIBADD = $(HTML_SHARED_LIBADD) include $(top_srcdir)/build/dynlib.mk php_gtkhtml.o php_gtkhtml.lo php_gtkhtml.slo: gen_ce_gtkhtml.h gen_gtkhtml.c: gtkhtml.defs gtkhtml.overrides php -q $(top_srcdir)/generator/generator.php -o $(srcdir)/gtkhtml.overrides -p gtkhtml -r $(top_srcdir)/ext/gtk%2b/gtk.defs $(srcdir)/gtkhtml.defs > gen_gtkhtml.c gen_ce_gtkhtml.h: gen_gtkhtml.c grep -h "^PHP_GTK_EXPORT_CE" gen_gtkhtml.c | sed -e "s!^!extern !" > gen_ce_gtkhtml.h Index: php-gtk/ext/gtkhtml/config.m4 +++ php-gtk/ext/gtkhtml/config.m4 dnl $Id: config.m4,v 1.1 2001/11/28 01:28:33 alan_k Exp $ dnl config.m4 for gtkhtml module dnl PHP_PATH_GNOME_CONFIG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]) dnl Test to see if gtkhtml is installed, and define GTKHTML_CFLAGS, LIBS dnl AC_DEFUN(PHP_PATH_GNOME_CONFIG, [dnl dnl Get the cflags and libraries from the gnome-config script dnl AC_ARG_WITH(gnome-config, [ --with-gnome-config=GNOME_CONFIG Location of gnome-config], GNOME_CONFIG="$withval") module_args=gtkhtml AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) AC_MSG_CHECKING(for gnome-config) if test "$GNOME_CONFIG " = "no"; then AC_MSG_RESULT(no) ifelse([$2], , :, [$2]) else HTML_CFLAGS=`$GNOME_CONFIG --cflags $module_args` HTML_LIBS=`$GNOME_CONFIG --libs $module_args` HTML_HAVE_GCONFTEST=`$GNOME_CONFIG --cflags $module_args | grep GTKHTML_HAVE_GCONF` AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) fi AC_SUBST(HTML_CFLAGS) AC_SUBST(HTML_LIBS) AC_SUBST(HTML_HAVE_GCONFTEST) ]) PHP_GTK_ARG_ENABLE(gtkhtml,for gtkhtml support, [ --enable-gtkhtml Enable gtkhtml support]) if test "$PHP_GTK_HTML" != "no"; then PHP_PATH_GNOME_CONFIG(have_gnomeconfig=yes,have_gnomeconfig=no) if test "$have_gnomeconfig" != "yes"; then AC_MSG_ERROR(Unable to locate gnomeconfig) else AC_DEFINE(HAVE_HTML,1,[gtkhtml support]) PHP_EVAL_INCLINE($HTML_CFLAGS) if test "$HTML_HAVE_GCONFTEST no" != " no"; then AC_DEFINE(GTKHTML_HAVE_GCONF,1,[ ]) fi PHP_EVAL_LIBLINE($HTML_LIBS, HTML_SHARED_LIBADD) PHP_SUBST(HTML_SHARED_LIBADD) PHP_GTK_EXTENSION(gtkhtml, $php_gtk_ext_shared) fi fi Index: php-gtk/ext/gtkhtml/gtkhtml.defs +++ php-gtk/ext/gtkhtml/gtkhtml.defs ;; -*- scheme -*- ; object definitions ... ; Creation (object HTML (in-module Gtk) (parent Widget (Gtk)) (c-name GtkHTML) ) (enum FundamentalType (in-module GtkHTML) (c-name GtkHTMLFundamentalType) (value (name paragraph_style) (c-name GTK_TYPE_HTMLPARAGRAPH_STYLE)) (value (name paragraph_alignment) (c-name GTK_TYPE_HTMLPARAGRAPH_ALIGNMENT)) (value (name font_style) (c-name GTK_TYPE_HTMLFONT_STYLE)) ) (enum ParagraphStyle (in-module GtkHTML) (c-name GtkHTMLParagraphStyle) (value (name normal) (c-name GTK_HTML_PARAGRAPH_STYLE_NORMAL)) (value (name h1) (c-name GTK_HTML_PARAGRAPH_STYLE_H1)) (value (name h2) (c-name GTK_HTML_PARAGRAPH_STYLE_H2)) (value (name h3) (c-name GTK_HTML_PARAGRAPH_STYLE_H3)) (value (name h4) (c-name GTK_HTML_PARAGRAPH_STYLE_H4)) (value (name h5) (c-name GTK_HTML_PARAGRAPH_STYLE_H5)) (value (name h6) (c-name GTK_HTML_PARAGRAPH_STYLE_H6)) (value (name address) (c-name GTK_HTML_PARAGRAPH_STYLE_ADDRESS)) (value (name pre) (c-name GTK_HTML_PARAGRAPH_STYLE_PRE)) (value (name itemdotted) (c-name GTK_HTML_PARAGRAPH_STYLE_ITEMDOTTED)) (value (name itemroman) (c-name GTK_HTML_PARAGRAPH_STYLE_ITEMROMAN)) (value (name itemdigit) (c-name GTK_HTML_PARAGRAPH_STYLE_ITEMDIGIT)) (value (name itemalpha) (c-name GTK_HTML_PARAGRAPH_STYLE_ITEMALPHA)) ) (enum ParagraphAlignment (in-module GtkHTML) (c-name GtkHTMLParagraphAlignment) (value (name left) (c-name GTK_HTML_PARAGRAPH_ALIGNMENT_LEFT)) (value (name right) (c-name GTK_HTML_PARAGRAPH_ALIGNMENT_RIGHT)) (value (name center) (c-name GTK_HTML_PARAGRAPH_ALIGNMENT_CENTER)) ) (enum FontStyle (in-module GtkHTML) (c-name GtkHTMLFontStyle) (value (name default ) (c-name GTK_HTML_FONT_STYLE_DEFAULT)) (value (name size_1 ) (c-name GTK_HTML_FONT_STYLE_SIZE_1)) (value (name size_2 ) (c-name GTK_HTML_FONT_STYLE_SIZE_2)) (value (name size_3 ) (c-name GTK_HTML_FONT_STYLE_SIZE_3)) (value (name size_4 ) (c-name GTK_HTML_FONT_STYLE_SIZE_4)) (value (name size_5 ) (c-name GTK_HTML_FONT_STYLE_SIZE_5)) (value (name size_6 ) (c-name GTK_HTML_FONT_STYLE_SIZE_6)) (value (name size_7 ) (c-name GTK_HTML_FONT_STYLE_SIZE_7)) (value (name size_mask ) (c-name GTK_HTML_FONT_STYLE_SIZE_MASK)) (value (name bold ) (c-name GTK_HTML_FONT_STYLE_BOLD)) (value (name italic ) (c-name GTK_HTML_FONT_STYLE_ITALIC)) (value (name underline ) (c-name GTK_HTML_FONT_STYLE_UNDERLINE)) (value (name strikeout ) (c-name GTK_HTML_FONT_STYLE_STRIKEOUT)) (value (name fixed ) (c-name GTK_HTML_FONT_STYLE_FIXED)) (value (name subscript ) (c-name GTK_HTML_FONT_STYLE_SUBSCRIPT)) (value (name superscript ) (c-name GTK_HTML_FONT_STYLE_SUPERSCRIPT)) ) (enum CommandType (in-module GtkHTML) (c-name GtkHTMLCommandType) (value (name undo) (c-name GTK_HTML_COMMAND_UNDO)) (value (name redo) (c-name GTK_HTML_COMMAND_REDO)) (value (name copy) (c-name GTK_HTML_COMMAND_COPY)) (value (name copy_and_disable_selection) (c-name GTK_HTML_COMMAND_COPY_AND_DISABLE_SELECTION)) (value (name cut) (c-name GTK_HTML_COMMAND_CUT)) (value (name paste) (c-name GTK_HTML_COMMAND_PASTE)) (value (name cut_line) (c-name GTK_HTML_COMMAND_CUT_LINE)) (value (name insert_paragraph) (c-name GTK_HTML_COMMAND_INSERT_PARAGRAPH)) (value (name insert_tab) (c-name GTK_HTML_COMMAND_INSERT_TAB)) (value (name insert_rule) (c-name GTK_HTML_COMMAND_INSERT_RULE)) (value (name insert_rule_param) (c-name GTK_HTML_COMMAND_INSERT_RULE_PARAM)) (value (name insert_image_param) (c-name GTK_HTML_COMMAND_INSERT_IMAGE_PARAM)) (value (name insert_tab_or_indent_more) (c-name GTK_HTML_COMMAND_INSERT_TAB_OR_INDENT_MORE)) ; (value (name insert_tab_or_indent_more_or_next_cell) (c-name GTK_HTML_COMMAND_INSERT_TAB_OR_INDENT_MORE_OR_NEXT_CELL)) (value (name make_link) (c-name GTK_HTML_COMMAND_MAKE_LINK)) (value (name remove_link) (c-name GTK_HTML_COMMAND_REMOVE_LINK)) (value (name delete) (c-name GTK_HTML_COMMAND_DELETE)) (value (name delete_back) (c-name GTK_HTML_COMMAND_DELETE_BACK)) (value (name delete_back_or_indent_dec) (c-name GTK_HTML_COMMAND_DELETE_BACK_OR_INDENT_DEC)) (value (name selection_mode) (c-name GTK_HTML_COMMAND_SELECTION_MODE)) (value (name disable_selection) (c-name GTK_HTML_COMMAND_DISABLE_SELECTION)) (value (name bold_on) (c-name GTK_HTML_COMMAND_BOLD_ON)) (value (name bold_off) (c-name GTK_HTML_COMMAND_BOLD_OFF)) (value (name bold_toggle) (c-name GTK_HTML_COMMAND_BOLD_TOGGLE)) (value (name italic_on) (c-name GTK_HTML_COMMAND_ITALIC_ON)) (value (name italic_off) (c-name GTK_HTML_COMMAND_ITALIC_OFF)) (value (name italic_toggle) (c-name GTK_HTML_COMMAND_ITALIC_TOGGLE)) (value (name underline_on) (c-name GTK_HTML_COMMAND_UNDERLINE_ON)) (value (name underline_off) (c-name GTK_HTML_COMMAND_UNDERLINE_OFF)) (value (name underline_toggle) (c-name GTK_HTML_COMMAND_UNDERLINE_TOGGLE)) (value (name strikeout_on) (c-name GTK_HTML_COMMAND_STRIKEOUT_ON)) (value (name strikeout_off) (c-name GTK_HTML_COMMAND_STRIKEOUT_OFF)) (value (name strikeout_toggle) (c-name GTK_HTML_COMMAND_STRIKEOUT_TOGGLE)) (value (name size_minus_2) (c-name GTK_HTML_COMMAND_SIZE_MINUS_2)) (value (name size_minus_1) (c-name GTK_HTML_COMMAND_SIZE_MINUS_1)) (value (name size_plus_0) (c-name GTK_HTML_COMMAND_SIZE_PLUS_0)) (value (name size_plus_1) (c-name GTK_HTML_COMMAND_SIZE_PLUS_1)) (value (name size_plus_2) (c-name GTK_HTML_COMMAND_SIZE_PLUS_2)) (value (name size_plus_3) (c-name GTK_HTML_COMMAND_SIZE_PLUS_3)) (value (name size_plus_4) (c-name GTK_HTML_COMMAND_SIZE_PLUS_4)) (value (name size_increase) (c-name GTK_HTML_COMMAND_SIZE_INCREASE)) (value (name size_decrease) (c-name GTK_HTML_COMMAND_SIZE_DECREASE)) (value (name align_left) (c-name GTK_HTML_COMMAND_ALIGN_LEFT)) (value (name align_center) (c-name GTK_HTML_COMMAND_ALIGN_CENTER)) (value (name align_right) (c-name GTK_HTML_COMMAND_ALIGN_RIGHT)) (value (name indent_zero) (c-name GTK_HTML_COMMAND_INDENT_ZERO)) (value (name indent_inc) (c-name GTK_HTML_COMMAND_INDENT_INC)) (value (name indent_inc_or_next_cell) (c-name GTK_HTML_COMMAND_INDENT_INC_OR_NEXT_CELL)) (value (name indent_dec) (c-name GTK_HTML_COMMAND_INDENT_DEC)) ; (value (name indent_dec_or_prev_cell) (c-name GTK_HTML_COMMAND_INDENT_DEC_OR_PREV_CELL)) (value (name indent_paragraph) (c-name GTK_HTML_COMMAND_INDENT_PARAGRAPH)) (value (name break_and_fill_line) (c-name GTK_HTML_COMMAND_BREAK_AND_FILL_LINE)) (value (name space_and_fill_line) (c-name GTK_HTML_COMMAND_SPACE_AND_FILL_LINE)) (value (name paragraph_style_normal) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_NORMAL)) (value (name paragraph_style_h1) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H1)) (value (name paragraph_style_h2) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H2)) (value (name paragraph_style_h3) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H3)) (value (name paragraph_style_h4) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H4)) (value (name paragraph_style_h5) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H5)) (value (name paragraph_style_h6) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_H6)) (value (name paragraph_style_address) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_ADDRESS)) (value (name paragraph_style_pre) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_PRE)) (value (name paragraph_style_itemdotted) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_ITEMDOTTED)) (value (name paragraph_style_itemroman) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_ITEMROMAN)) (value (name paragraph_style_itemdigit) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_ITEMDIGIT)) (value (name paragraph_style_itemalpha) (c-name GTK_HTML_COMMAND_PARAGRAPH_STYLE_ITEMALPHA)) (value (name modify_selection_up) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_UP)) (value (name modify_selection_down) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_DOWN)) (value (name modify_selection_left) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_LEFT)) (value (name modify_selection_right) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_RIGHT)) (value (name modify_selection_pageup) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEUP)) (value (name modify_selection_pagedown) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEDOWN)) (value (name modify_selection_bol) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_BOL)) (value (name modify_selection_eol) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_EOL)) (value (name modify_selection_bod) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_BOD)) (value (name modify_selection_eod) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_EOD)) (value (name modify_selection_prev_word) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_PREV_WORD)) (value (name modify_selection_next_word) (c-name GTK_HTML_COMMAND_MODIFY_SELECTION_NEXT_WORD)) (value (name capitalize_word) (c-name GTK_HTML_COMMAND_CAPITALIZE_WORD)) (value (name upcase_word) (c-name GTK_HTML_COMMAND_UPCASE_WORD)) (value (name downcase_word) (c-name GTK_HTML_COMMAND_DOWNCASE_WORD)) (value (name spell_suggest) (c-name GTK_HTML_COMMAND_SPELL_SUGGEST)) (value (name spell_personal_dictionary_add) (c-name GTK_HTML_COMMAND_SPELL_PERSONAL_DICTIONARY_ADD)) (value (name spell_session_dictionary_add) (c-name GTK_HTML_COMMAND_SPELL_SESSION_DICTIONARY_ADD)) (value (name search) (c-name GTK_HTML_COMMAND_SEARCH)) (value (name search_incremental_forward) (c-name GTK_HTML_COMMAND_SEARCH_INCREMENTAL_FORWARD)) (value (name search_incremental_backward) (c-name GTK_HTML_COMMAND_SEARCH_INCREMENTAL_BACKWARD)) (value (name search_regex) (c-name GTK_HTML_COMMAND_SEARCH_REGEX)) (value (name focus_forward) (c-name GTK_HTML_COMMAND_FOCUS_FORWARD)) (value (name focus_backward) (c-name GTK_HTML_COMMAND_FOCUS_BACKWARD)) (value (name popup_menu) (c-name GTK_HTML_COMMAND_POPUP_MENU)) (value (name properties_dialog) (c-name GTK_HTML_COMMAND_PROPERTIES_DIALOG)) (value (name cursor_forward) (c-name GTK_HTML_COMMAND_CURSOR_FORWARD)) (value (name cursor_backward) (c-name GTK_HTML_COMMAND_CURSOR_BACKWARD)) (value (name insert_table_1_1) (c-name GTK_HTML_COMMAND_INSERT_TABLE_1_1)) (value (name table_insert_col_after) (c-name GTK_HTML_COMMAND_TABLE_INSERT_COL_AFTER)) (value (name table_insert_col_before) (c-name GTK_HTML_COMMAND_TABLE_INSERT_COL_BEFORE)) (value (name table_insert_row_after) (c-name GTK_HTML_COMMAND_TABLE_INSERT_ROW_AFTER)) (value (name table_insert_row_before) (c-name GTK_HTML_COMMAND_TABLE_INSERT_ROW_BEFORE)) (value (name table_delete_col) (c-name GTK_HTML_COMMAND_TABLE_DELETE_COL)) (value (name table_delete_row) (c-name GTK_HTML_COMMAND_TABLE_DELETE_ROW)) (value (name table_cell_inc_cspan) (c-name GTK_HTML_COMMAND_TABLE_CELL_INC_CSPAN)) (value (name table_cell_dec_cspan) (c-name GTK_HTML_COMMAND_TABLE_CELL_DEC_CSPAN)) (value (name table_cell_inc_rspan) (c-name GTK_HTML_COMMAND_TABLE_CELL_INC_RSPAN)) (value (name table_cell_dec_rspan) (c-name GTK_HTML_COMMAND_TABLE_CELL_DEC_RSPAN)) (value (name table_cell_join_left) (c-name GTK_HTML_COMMAND_TABLE_CELL_JOIN_LEFT)) (value (name table_cell_join_right) (c-name GTK_HTML_COMMAND_TABLE_CELL_JOIN_RIGHT)) (value (name table_cell_join_up) (c-name GTK_HTML_COMMAND_TABLE_CELL_JOIN_UP)) (value (name table_cell_join_down) (c-name GTK_HTML_COMMAND_TABLE_CELL_JOIN_DOWN)) (value (name table_border_width_inc) (c-name GTK_HTML_COMMAND_TABLE_BORDER_WIDTH_INC)) (value (name table_border_width_dec) (c-name GTK_HTML_COMMAND_TABLE_BORDER_WIDTH_DEC)) (value (name table_border_width_zero) (c-name GTK_HTML_COMMAND_TABLE_BORDER_WIDTH_ZERO)) (value (name text_set_default_color) (c-name GTK_HTML_COMMAND_TEXT_SET_DEFAULT_COLOR)) (value (name select_word) (c-name GTK_HTML_COMMAND_SELECT_WORD)) (value (name select_line) (c-name GTK_HTML_COMMAND_SELECT_LINE)) (value (name select_paragraph) (c-name GTK_HTML_COMMAND_SELECT_PARAGRAPH)) (value (name select_paragraph_extended) (c-name GTK_HTML_COMMAND_SELECT_PARAGRAPH_EXTENDED)) (value (name select_all) (c-name GTK_HTML_COMMAND_SELECT_ALL)) (value (name cursor_position_save) (c-name GTK_HTML_COMMAND_CURSOR_POSITION_SAVE)) (value (name cursor_position_restore) (c-name GTK_HTML_COMMAND_CURSOR_POSITION_RESTORE)) (value (name cursor_bod) (c-name GTK_HTML_COMMAND_CURSOR_BOD)) (value (name cursor_eod) (c-name GTK_HTML_COMMAND_CURSOR_EOD)) (value (name block_redraw) (c-name GTK_HTML_COMMAND_BLOCK_REDRAW)) (value (name unblock_redraw) (c-name GTK_HTML_COMMAND_UNBLOCK_REDRAW)) (value (name zoom_in) (c-name GTK_HTML_COMMAND_ZOOM_IN)) (value (name zoom_out) (c-name GTK_HTML_COMMAND_ZOOM_OUT)) (value (name zoom_reset) (c-name GTK_HTML_COMMAND_ZOOM_RESET)) (value (name table_spacing_inc) (c-name GTK_HTML_COMMAND_TABLE_SPACING_INC)) (value (name table_spacing_dec) (c-name GTK_HTML_COMMAND_TABLE_SPACING_DEC)) (value (name table_spacing_zero) (c-name GTK_HTML_COMMAND_TABLE_SPACING_ZERO)) (value (name table_padding_inc) (c-name GTK_HTML_COMMAND_TABLE_PADDING_INC)) (value (name table_padding_dec) (c-name GTK_HTML_COMMAND_TABLE_PADDING_DEC)) (value (name table_padding_zero) (c-name GTK_HTML_COMMAND_TABLE_PADDING_ZERO)) (value (name delete_table) (c-name GTK_HTML_COMMAND_DELETE_TABLE)) (value (name delete_table_row) (c-name GTK_HTML_COMMAND_DELETE_TABLE_ROW)) (value (name delete_table_column) (c-name GTK_HTML_COMMAND_DELETE_TABLE_COLUMN)) (value (name delete_table_cell_contents) (c-name GTK_HTML_COMMAND_DELETE_TABLE_CELL_CONTENTS)) (value (name grab_focus) (c-name GTK_HTML_COMMAND_GRAB_FOCUS)) ) (enum EditorEventType (in-module GtkHTML) (c-name GtkHTMLEditorEventType) (value (name command) (c-name GTK_HTML_EDITOR_EVENT_COMMAND_BEFORE)) (value (name command) (c-name GTK_HTML_EDITOR_EVENT_COMMAND_AFTER)) (value (name image_url) (c-name GTK_HTML_EDITOR_EVENT_IMAGE_URL)) (value (name delete) (c-name GTK_HTML_EDITOR_EVENT_DELETE)) ) (function gtk_html_new (c-name gtk_html_new) (is-constructor-of GtkHTML) (return-type GtkHTML*) ) (function gtk_html_new_from_string (c-name gtk_html_new_from_string) (is-constructor-of GtkHTML) (return-type GtkHTML*) (parameter (type-and-name const-gchar* str)) (parameter (type-and-name gint len)) ) (method gtk_html_set_editor_api (of-object HTML (Gtk)) (c-name gtk_html_set_editor_api) (return-type none) (parameter (type-and-name GtkHTMLEditorAPI* api)) (parameter (type-and-name gpointer data)) ) ; parent iframe setting (method gtk_html_set_iframe_parent (of-object HTML (Gtk)) (c-name gtk_html_set_iframe_parent) (return-type none) (parameter (type-and-name GtkWidget* parent)) (parameter (type-and-name GtkHTMLObject* frame)) ) ;; Debugging (method gtk_html_enable_debug (of-object HTML (Gtk)) (c-name gtk_html_enable_debug) (return-type none) (parameter (type-and-name gboolean debug)) ) ;; Behaviour (method allow_selection (of-object HTML (Gtk)) (c-name gtk_html_allow_selection) (parameter (type-and-name gboolean allow)) (return-type none) ) (method select_word (of-object HTML (Gtk)) (c-name gtk_html_select_word) (return-type none) ) (method select_line (of-object HTML (Gtk)) (c-name gtk_html_select_line) (return-type none) ) (method select_paragraph (of-object HTML (Gtk)) (c-name gtk_html_select_paragraph) (return-type none) ) (method select_paragraph_extended (of-object HTML (Gtk)) (c-name gtk_html_select_paragraph_extended) (return-type none) ) (method select_all (of-object HTML (Gtk)) (c-name gtk_html_select_all) (return-type none) ) (method request_paste (of-object HTML (Gtk)) (c-name gtk_html_request_paste) (return-type none) (parameter (type-and-name GdkAtom selection)) (parameter (type-and-name gint type)) (parameter (type-and-name gint32 time)) ) ;; Loading (method begin (of-object HTML (Gtk)) (c-name gtk_html_begin) (return-type GtkHTMLStream*) ) (method begin_content (of-object HTML (Gtk)) (c-name gtk_html_begin_content) (return-type GtkHTMLStream*) (parameter (type-and-name const-gchar* content_type)) ) (method write (of-object HTML (Gtk)) (c-name gtk_html_write) (return-type none) (parameter (type-and-name GtkHTMLStream* handle)) (parameter (type-and-name const-gchar* buffer)) (parameter (type-and-name size_t size)) ) (method end (of-object HTML (Gtk)) (c-name gtk_html_end) (return-type none) (parameter (type-and-name GtkHTMLStream* handle)) (parameter (type-and-name GtkHTMLStreamStatus status)) ) (method load_empty (of-object HTML (Gtk)) (c-name gtk_html_load_empty) (return-type none) ) (method load_from_string (of-object HTML (Gtk)) (c-name gtk_html_load_from_string) (return-type none) (parameter (type-and-name gchar* text)) (parameter (type-and-name gint text_length)) ) ;; saving (method save (of-object HTML (Gtk)) (c-name gtk_html_save) (return-type gboolean) (parameter (type-and-name GtkHTMLSaveReceiverFn receiver )) (parameter (type-and-name gpointer data)) ) (method connect_url_request (of-object HTML (Gtk)) (c-name gtk_html_connect_url_request) (return-type guint) (parameter (type-and-name const-gchar* name)) (parameter (type-and-name GtkSignalFunc func)) (parameter (type-and-name gpointer func_data)) ) (method export (of-object HTML (Gtk)) (c-name gtk_html_export) (return-type gboolean) (parameter (type-and-name const-char* type)) (parameter (type-and-name GtkHTMLSaveReceiverFn receiver )) (parameter (type-and-name gpointer data)) ) ;; editable support (method set_editable (of-object HTML (Gtk)) (c-name gtk_html_set_editable) (return-type none) (parameter (type-and-name gboolean editable)) ) (method get_editable (of-object HTML (Gtk)) (c-name gtk_html_get_editable) (return-type gboolean) ) ;; printing support (method print_with_header_footer (of-object HTML (Gtk)) (c-name gtk_html_print_with_header_footer) (return-type none) (parameter (type-and-name GnomePrintContext* print_context)) (parameter (type-and-name gdouble header_height)) (parameter (type-and-name gdouble footer_height)) (parameter (type-and-name GtkHTMLPrintCallback header_print)) (parameter (type-and-name GtkHTMLPrintCallback footer_print)) (parameter (type-and-name gpointer user_data)) ) (method print (of-object HTML (Gtk)) (c-name gtk_html_print) (return-type none) (parameter (type-and-name GnomePrintContext* print_context)) ) ;; Title (method get_title (of-object HTML (Gtk)) (c-name gtk_html_get_title) (return-type static_string) ) ;; Anchors (method jump_to_anchor (of-object HTML (Gtk)) (c-name gtk_html_jump_to_anchor) (return-type gboolean) (parameter (type-and-name string anchor)) ) ;; editing functions (method get_paragraph_style (of-object HTML (Gtk)) (c-name gtk_html_get_paragraph_style) (return-type GtkHTMLParagraphStyle) ) (method set_paragraph_style (of-object HTML (Gtk)) (c-name gtk_html_set_paragraph_style) (return-type none) (parameter (type-and-name GtkHTMLParagraphStyle style)) ) (method set_indent (of-object HTML (Gtk)) (c-name gtk_html_set_indent) (return-type none) (parameter (type-and-name gint level)) ) (method set_indent_by_delta (of-object HTML (Gtk)) (c-name gtk_html_set_indent_by_delta) (return-type none) (parameter (type-and-name gint delta)) ) (method set_font_style (of-object HTML (Gtk)) (c-name gtk_html_set_font_style) (return-type none) (parameter (type-and-name GtkHTMLFontStyle and_mask)) (parameter (type-and-name GtkHTMLFontStyle or_mask)) ) (method set_color (of-object HTML (Gtk)) (c-name gtk_html_set_color) (return-type none) (parameter (type-and-name HTMLColor* color)) ) (method toggle_font_style (of-object HTML (Gtk)) (c-name gtk_html_toggle_font_style) (return-type none) (parameter (type-and-name GtkHTMLFontStyle style)) ) (method get_paragraph_alignment (of-object HTML (Gtk)) (c-name gtk_html_get_paragraph_alignment) (return-type GtkHTMLParagraphAlignment) ) (method set_paragraph_alignment (of-object HTML (Gtk)) (c-name gtk_html_set_paragraph_alignment) (return-type none) (parameter (type-and-name GtkHTMLParagraphAlignment alignment)) ) (method cut (of-object HTML (Gtk)) (c-name gtk_html_cut) (return-type none) ) (method copy (of-object HTML (Gtk)) (c-name gtk_html_copy) (return-type none) ) (method paste (of-object HTML (Gtk)) (c-name gtk_html_paste) (return-type none) ) (method undo (of-object HTML (Gtk)) (c-name gtk_html_undo) (return-type none) ) (method redo (of-object HTML (Gtk)) (c-name gtk_html_redo) (return-type none) ) (method insert_html (of-object HTML (Gtk)) (c-name gtk_html_insert_html) (return-type none) (parameter (type-and-name const-gchar* html_src)) ) ;;misc (method set_default_background_color (of-object HTML (Gtk)) (c-name gtk_html_set_default_background_color) (return-type none) (parameter (type-and-name GdkColor c)) ) (method set_default_content_type (of-object HTML (Gtk)) (c-name gtk_html_set_default_content_type) (return-type none) (parameter (type-and-name string content_type)) ) (method get_object_by_id (of-object HTML (Gtk)) (c-name gtk_html_get_object_by_id) (return-type none) (parameter (type-and-name const-gchar* id)) ) (method command (of-object HTML (Gtk)) (c-name gtk_html_command) (return-type none) (parameter (type-and-name const-gchar* command_name)) ) (method edit_make_cursor_visible (of-object HTML (Gtk)) (c-name gtk_html_edit_make_cursor_visible) (return-type none) ) ;; gboolean gtk_html_build_with_gconf (void); (method set_magnification (of-object HTML (Gtk)) (c-name gtk_html_set_magnification) (return-type none) (parameter (type-and-name gdouble magnification)) ) (method zoom_in (of-object HTML (Gtk)) (c-name gtk_html_zoom_in) (return-type none) ) (method zoom_out (of-object HTML (Gtk)) (c-name gtk_html_zoom_out) (return-type none) ) (method zoom_reset (of-object HTML (Gtk)) (c-name gtk_html_zoom_reset) (return-type none) ) (method update_styles (of-object HTML (Gtk)) (c-name gtk_html_update_styles) (return-type none) ) ;; Extra - non standard direct call methods! (method get_font_style (of-object HTML (Gtk)) (c-name gtk_html_get_font_style) (return-type GdkFontStyle) ) (method get_font_color (of-object HTML (Gtk)) (c-name gtk_html_get_font_color) (return-type GdkColor) ) ; links ! (method insert_link (of-object HTML (Gtk)) (parameter (type-and-name const-gchar* url)) (parameter (type-and-name const-gchar* target)) (c-name gtk_html_insert_link) (return-type None) ) (method get_url (of-object HTML (Gtk)) (c-name gtk_html_get_url) (return-type static_string) ) (method get_target (of-object HTML (Gtk)) (c-name gtk_html_get_target) (return-type static_string) ) ;; GtkHTMLEmbedded (object HTMLEmbedded (in-module Gtk) (parent Bin (Gtk)) (c-name GtkHTMLEmbedded) ) (function gtk_html_embedded_new (c-name gtk_html_embedded_new) (is-constructor-of GtkHTMLEmbedded) (return-type GtkBin*) (parameter (type-and-name string classid)) (parameter (type-and-name string name)) (parameter (type-and-name string type)) (parameter (type-and-name string data)) (parameter (type-and-name int width)) (parameter (type-and-name int height)) ) ;(function gtk_html_embedded_set_parameter ; none ; ((GtkHTMLEmbedded ge) ; (string param) ; (string value))) ;; get_parameter handled in a manual C wrapper ;(function gtk_html_embedded_set_descent ; none ; ((GtkHtmlEmbedded ge) ; (int descent))) Index: php-gtk/ext/gtkhtml/gtkhtml.overrides +++ php-gtk/ext/gtkhtml/gtkhtml.overrides %% headers #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-embedded.h> #include <gtkhtml/gtkhtml-embedded.h> #include <gtkhtml/htmlengine-edit-fontstyle.h> #include <gtkhtml/htmlengine-edit-cut-and-paste.h> #include <gtkhtml/htmlcolor.h> #include <gtkhtml/htmltypes.h> #include "ext/gtk+/php_gtk+.h" #include "ext/gtkhtml/php_gtkhtml.h" int le_gtkhtmlstream; /* Hack to make the enums work */ typedef enum { GTK_TYPE_HTMLPARAGRAPH_STYLE, GTK_TYPE_HTMLPARAGRAPH_ALIGNMENT, GTK_TYPE_HTMLFONT_STYLE } GtkHTMLFundamentalType; static void php_gtkhtmlstream_destruct(zend_rsrc_list_entry *rsrc TSRMLS_DC); %% constants REGISTER_LONG_CONSTANT("GTK_HTML_STREAM_OK", GTK_HTML_STREAM_OK, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("GTK_HTML_STREAM_ERROR", GTK_HTML_STREAM_ERROR, CONST_CS | CONST_PERSISTENT); le_gtkhtmlstream = zend_register_list_destructors_ex(php_gtkhtmlstream_destruct, NULL, "GtkHTMLStream", module_number); %% ignore-glob *_get_type %% override gtk_html_begin static void php_gtkhtmlstream_destruct(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_gtkhtmlstream_s *pgs= (php_gtkhtmlstream_s *) rsrc->ptr; /* should this also free the gtkhtmlstream object? */ //gtk_html_stream_close (pgs->gs,GTK_HTML_STREAM_ERROR); efree(pgs); } PHP_FUNCTION(gtk_html_begin) { char *content_type; php_gtkhtmlstream_s *pgs = NULL; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; pgs = (php_gtkhtmlstream_s *) emalloc(sizeof(php_gtkhtmlstream_s)); pgs->gs = gtk_html_begin(GTK_HTML(PHP_GTK_GET(this_ptr))); ZEND_REGISTER_RESOURCE(return_value, pgs, le_gtkhtmlstream); pgs->id = Z_LVAL_P(return_value); } %% override gtk_html_begin_content PHP_FUNCTION(gtk_html_begin_content) { char *content_type; php_gtkhtmlstream_s *pgs = NULL; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s", &content_type)) return; pgs = (php_gtkhtmlstream_s *) emalloc(sizeof(php_gtkhtmlstream_s)); pgs->gs = gtk_html_begin_content(GTK_HTML(PHP_GTK_GET(this_ptr)), content_type); ZEND_REGISTER_RESOURCE(return_value, pgs, le_gtkhtmlstream); pgs->id = Z_LVAL_P(return_value); } %% override gtk_html_write PHP_FUNCTION(gtk_html_write) { zval **arg1, **arg2, **arg3=NULL; int ret, type,i; int num_bytes; int issock=0; int socketd=0; char *string; void *what; php_gtkhtmlstream_s *pgs; switch (ZEND_NUM_ARGS()) { case 2: if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) { RETURN_FALSE; } convert_to_string_ex(arg2); num_bytes = Z_STRLEN_PP(arg2); break; case 3: if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3)==FAILURE) { RETURN_FALSE; } convert_to_string_ex(arg2); convert_to_long_ex(arg3); num_bytes = MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2)); /* num_bytes = Z_LVAL_PP(arg3); */ break; default: WRONG_PARAM_COUNT; /* NOTREACHED */ break; } what = zend_fetch_resource(arg1 TSRMLS_CC, -1, "GtkHTMLStream", &type, 1, le_gtkhtmlstream); ZEND_VERIFY_RESOURCE(what); pgs = (php_gtkhtmlstream_s *) what; if (!arg3 && PG(magic_quotes_runtime)) { zval_copy_ctor(*arg2); php_stripslashes(Z_STRVAL_PP(arg2), &num_bytes TSRMLS_CC); } /* php_error(E_WARNING, "write using %p (size %d) ", pgs->gs, num_bytes); */ // spec says (size_t) size /* string = Z_STRVAL_PP(arg2); for (i=0;i<num_bytes;i++) { php_error(E_WARNING, "OUT: %p %2x ", pgs->gs, string[i]); } */ gtk_html_write(GTK_HTML(PHP_GTK_GET(this_ptr)), pgs->gs, Z_STRVAL_PP(arg2), num_bytes); RETURN_NULL(); } %% override gtk_html_end PHP_FUNCTION(gtk_html_end) { GtkHTMLStreamStatus status; zval *php_status = NULL; zval *gs_zval; php_gtkhtmlstream_s *pgs; int resource_type; char *buffer; long size; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "rV", &gs_zval, &php_status)) return; if (php_status) { status = (GtkHTMLStreamStatus) php_status; } pgs = (php_gtkhtmlstream_s *) zend_list_find(Z_RESVAL_P(gs_zval), &resource_type); if (!pgs || resource_type != le_gtkhtmlstream) { php_error(E_WARNING,"html_end needs a valid htmlstream resource"); return; } gtk_html_end(GTK_HTML(PHP_GTK_GET(this_ptr)), pgs->gs, status); zend_list_delete(Z_RESVAL_P(gs_zval)); RETURN_NULL(); } %% override gtk_html_save static void php_gtk_html_save_callback(HTMLEngine *engine, gchar *string, guint string_len, zval* callback_data) { zval *retval = NULL; zval **callback = NULL, **extra = NULL; zval **callback_filename = NULL, **callback_lineno = NULL; zval ***args, *params; char *callback_name; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&callback); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&callback_lineno); if (!php_gtk_is_callable(*callback, 0, &callback_name)) { php_error(E_WARNING, "Unable to call html save callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(s)", string); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *callback, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) zval_ptr_dtor(&retval); efree(args); zval_ptr_dtor(&params); } PHP_FUNCTION(gtk_html_save) { zval *callback = NULL; zval *extra; zval *data; char *callback_filename; uint callback_lineno; if (ZEND_NUM_ARGS() < 1) { php_error(E_WARNING, "%s() requires at least 1 arguments, %d given", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!php_gtk_parse_args(1, "V", &callback)) return; callback_filename = zend_get_executed_filename(TSRMLS_C); callback_lineno = zend_get_executed_lineno(TSRMLS_C); extra = php_gtk_func_args_as_hash(ZEND_NUM_ARGS(), 1, ZEND_NUM_ARGS()); data = php_gtk_build_value("(VNsi)", callback, extra, callback_filename, callback_lineno); RETURN_BOOL(gtk_html_save(GTK_HTML(PHP_GTK_GET(this_ptr)), (GtkHTMLSaveReceiverFn) php_gtk_html_save_callback, data)); } %% override gtk_html_export PHP_FUNCTION(gtk_html_export) { zval *callback = NULL; zval *extra; zval *data; char *callback_filename; char *type; uint callback_lineno; if (ZEND_NUM_ARGS() < 1) { php_error(E_WARNING, "%s() requires at least 1 arguments, %d given", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!php_gtk_parse_args(1, "sV", &type,&callback)) return; callback_filename = zend_get_executed_filename(TSRMLS_C); callback_lineno = zend_get_executed_lineno(TSRMLS_C); extra = php_gtk_func_args_as_hash(ZEND_NUM_ARGS(), 2, ZEND_NUM_ARGS()); data = php_gtk_build_value("(VNsi)", callback, extra, callback_filename, callback_lineno); RETURN_BOOL(gtk_html_export(GTK_HTML(PHP_GTK_GET(this_ptr)), type, (GtkHTMLSaveReceiverFn) php_gtk_html_save_callback, data)); } %% override gtk_html_connect_url_request static void php_gtk_html_url_request_callback (GtkHTML *html, const char *url, GtkHTMLStream *gs, zval* callback_data) { php_gtkhtmlstream_s *pgs; zval *myresource = NULL; zval *retval = NULL; zval **callback = NULL, **extra = NULL; zval **callback_filename = NULL, **callback_lineno = NULL; zval ***args, *params; char *callback_name; long gs_id; TSRMLS_FETCH(); /* php_error(E_WARNING, "url request recieved %p as handle ", gs); */ zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&callback); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&callback_lineno); if (!php_gtk_is_callable(*callback, 0, &callback_name)) { php_error(E_WARNING, "Unable to call url_request callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(s)", url); /* php_error(E_WARNING, "Using RESORUCE id %p ",gs_id); */ pgs = (php_gtkhtmlstream_s *) emalloc(sizeof(php_gtkhtmlstream_s)); pgs->gs = gs; MAKE_STD_ZVAL(myresource); gs_id = zend_list_insert(pgs, le_gtkhtmlstream); pgs->id = gs_id; ZVAL_RESOURCE(myresource, gs_id); zend_hash_next_index_insert(Z_ARRVAL_P(params), &myresource, sizeof(zval *), NULL); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *callback, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) zval_ptr_dtor(&retval); efree(args); zval_ptr_dtor(&params); } PHP_FUNCTION(gtk_html_connect_url_request) { zval *callback = NULL; zval *extra; zval *data; char *callback_filename; uint callback_lineno; if (ZEND_NUM_ARGS() < 1) { php_error(E_WARNING, "%s() requires at least 1 arguments, %d given", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!php_gtk_parse_args(1, "V", &callback)) return; callback_filename = zend_get_executed_filename(TSRMLS_C); callback_lineno = zend_get_executed_lineno(TSRMLS_C); extra = php_gtk_func_args_as_hash(ZEND_NUM_ARGS(), 1, ZEND_NUM_ARGS()); data = php_gtk_build_value("(VNsi)", callback, extra, callback_filename, callback_lineno); RETURN_LONG(gtk_signal_connect (GTK_OBJECT(GTK_HTML(PHP_GTK_GET(this_ptr))), "url_requested", GTK_SIGNAL_FUNC (php_gtk_html_url_request_callback), data)); } %% override gtk_html_set_editor_api gboolean gtk_htmleditorapi_check_word(GtkHTML *html, const gchar *word, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; gboolean gtk_retval = 0; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_check_word, 0, &callback_name)) { php_error(E_WARNING, "Unable to call check_word callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return gtk_retval; } params = php_gtk_build_value("(s)", word); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_check_word, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { if (zval_is_true(retval)) gtk_retval =1; zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); return gtk_retval; } void gtk_htmleditorapi_suggestion_request(GtkHTML *html, const gchar *word, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_suggestion_request, 0, &callback_name)) { php_error(E_WARNING, "Unable to call suggestion_request callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(s)", word); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_suggestion_request, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); } void gtk_htmleditorapi_add_to_session(GtkHTML *html, const gchar *word, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_add_to_session, 0, &callback_name)) { php_error(E_WARNING, "Unable to call add_to_session callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(s)", word); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_add_to_session, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); } void gtk_htmleditorapi_add_to_personal(GtkHTML *html, const gchar *word, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_add_to_personal, 0, &callback_name)) { php_error(E_WARNING, "Unable to call add_to_personal callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(s)", word); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_add_to_personal, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); } gboolean gtk_htmleditorapi_command(GtkHTML *html, GtkHTMLCommandType com_type, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; gboolean gtk_retval = 0; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_command, 0, &callback_name)) { php_error(E_WARNING, "Unable to call command callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } params = php_gtk_build_value("(i)", (int) com_type); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_command, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { if (zval_is_true(retval)) gtk_retval =1; zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); return gtk_retval; } GtkArg *gtk_htmleditorapi_event(GtkHTML *html, GtkHTMLEditorEventType event_type, GtkArg **gtkargs, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; GtkArg *gtk_retval = NULL; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_event, 0, &callback_name)) { php_error(E_WARNING, "Unable to call event callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } switch (event_type) { case GTK_HTML_EDITOR_EVENT_COMMAND_BEFORE: case GTK_HTML_EDITOR_EVENT_COMMAND_AFTER: case GTK_HTML_EDITOR_EVENT_IMAGE_URL: params = php_gtk_build_value("(is)", (int) event_type,(const gchar *) gtkargs[0]); break; case GTK_HTML_EDITOR_EVENT_DELETE: params = php_gtk_build_value("(ii)",(int) event_type, 0); break; default: g_warning ("Unsupported event.\n"); } if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_event, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); if (retval) { if (zval_is_true(retval)) convert_to_string(retval); *GTK_RETLOC_STRING(*gtk_retval) = g_strdup(Z_STRVAL_P(retval)); zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); return gtk_retval; } GtkWidget *gtk_htmleditorapi_create_input_line(GtkHTML *html, gpointer data ) { zval* callback_data= (zval *) data; zval *retval = NULL; zval **extra = NULL; zval ***args, *params; char *callback_name; GtkWidget *gtk_retval = NULL; zval **cb_check_word = NULL; zval **cb_suggestion_request = NULL; zval **cb_add_to_session = NULL; zval **cb_add_to_personal = NULL; zval **cb_command = NULL; zval **cb_event = NULL; zval **cb_create_input_line = NULL; zval **callback_filename = NULL; zval **callback_lineno = NULL; TSRMLS_FETCH(); zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&cb_check_word); zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&cb_suggestion_request); zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void **)&cb_add_to_session); zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&cb_add_to_personal); zend_hash_index_find(Z_ARRVAL_P(callback_data), 4, (void **)&cb_command); zend_hash_index_find(Z_ARRVAL_P(callback_data), 5, (void **)&cb_event); zend_hash_index_find(Z_ARRVAL_P(callback_data), 6, (void **)&cb_create_input_line); zend_hash_index_find(Z_ARRVAL_P(callback_data), 7, (void **)&extra); zend_hash_index_find(Z_ARRVAL_P(callback_data), 8, (void **)&callback_filename); zend_hash_index_find(Z_ARRVAL_P(callback_data), 9, (void **)&callback_lineno); if (!php_gtk_is_callable(*cb_create_input_line, 0, &callback_name)) { php_error(E_WARNING, "Unable to call create_input_line callback '%s' specified in %s on line %d", callback_name, Z_STRVAL_PP(callback_filename), Z_LVAL_PP(callback_lineno)); efree(callback_name); return; } // how should this start empty... params = php_gtk_build_value("(i)", 0); if (extra) php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); args = php_gtk_hash_as_array(params); call_user_function_ex(EG(function_table), NULL, *cb_command, &retval, zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); /* this should get an object as a return value */ if (retval) { zval_ptr_dtor(&retval); } zval_ptr_dtor(&params); efree(args); return gtk_retval; } PHP_FUNCTION(gtk_html_set_editor_api) { zval *cb_check_word = NULL; zval *cb_suggestion_request = NULL; zval *cb_add_to_session = NULL; zval *cb_add_to_personal = NULL; zval *cb_command = NULL; zval *cb_event = NULL; zval *cb_create_input_line = NULL; zval *extra; zval *data; char *callback_filename; uint callback_lineno; GtkHTMLEditorAPI *editorapi; if (ZEND_NUM_ARGS() < 7) { php_error(E_WARNING, "%s() requires at least 7 argument, %d given", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!php_gtk_parse_args(1, "VVVVVVV", &cb_check_word, &cb_suggestion_request, &cb_add_to_session, &cb_add_to_personal, &cb_command, &cb_event, &cb_create_input_line )) return; callback_filename = zend_get_executed_filename(TSRMLS_C); callback_lineno = zend_get_executed_lineno(TSRMLS_C); extra = php_gtk_func_args_as_hash(ZEND_NUM_ARGS(), 7, ZEND_NUM_ARGS()); editorapi = (GtkHTMLEditorAPI *) emalloc(sizeof(GtkHTMLEditorAPI *)); editorapi->check_word = gtk_htmleditorapi_check_word; editorapi->suggestion_request = gtk_htmleditorapi_suggestion_request; editorapi->add_to_session = gtk_htmleditorapi_add_to_session; editorapi->add_to_personal = gtk_htmleditorapi_add_to_personal; editorapi->command = gtk_htmleditorapi_command; editorapi->event = gtk_htmleditorapi_event; editorapi->create_input_line = gtk_htmleditorapi_create_input_line; data = php_gtk_build_value("(VVVVVVVNsi)", cb_check_word, cb_suggestion_request, cb_add_to_session, cb_add_to_personal, cb_command, cb_event, cb_create_input_line, extra, callback_filename, callback_lineno); gtk_html_set_editor_api(GTK_HTML(PHP_GTK_GET(this_ptr)), editorapi, data); RETURN_NULL(); } %%override gtk_html_set_color PHP_FUNCTION(gtk_html_set_color) { gushort r,g,b; HTMLColor *hcolor = NULL; GdkColor color; gchar *color_spec; NOT_STATIC_METHOD(); switch (ZEND_NUM_ARGS()) { case 1: if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s", &color_spec)) { php_error(E_WARNING, "%s() should recieve either string #rrggbb or r,g,b", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!gdk_color_parse(color_spec, &color)) { php_error(E_WARNING, "%s() could not parse color spec '%s'", get_active_function_name(TSRMLS_C), color_spec); return; } hcolor = (HTMLColor *) html_color_new_from_gdk_color(&color); break; case 3: if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "hhh", &r,&g,&b)) { php_error(E_WARNING, "%s() should recieve either string #rrggbb or r,g,b", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } hcolor = (HTMLColor *) html_color_new_from_rgb(r, g, b); break; default: WRONG_PARAM_COUNT; /* NOTREACHED */ break; } gtk_html_set_color(GTK_HTML(PHP_GTK_GET(this_ptr)), hcolor); RETURN_NULL(); } %%override gtk_html_set_default_background_color PHP_FUNCTION(gtk_html_set_default_background_color) { gushort r,g,b; GdkColor color; GdkColor lcolor; gchar *color_spec; NOT_STATIC_METHOD(); switch (ZEND_NUM_ARGS()) { case 1: if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s", &color_spec)) { php_error(E_WARNING, "%s() should recieve either string #rrggbb or r,g,b", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } if (!gdk_color_parse(color_spec, &color)) { php_error(E_WARNING, "%s() could not parse color spec '%s'", get_active_function_name(TSRMLS_C), color_spec); return; } break; case 3: if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "hhh", &color.red,&color.green,&color.blue)) { php_error(E_WARNING, "%s() should recieve either string #rrggbb or r,g,b", get_active_function_name(TSRMLS_C), ZEND_NUM_ARGS()); return; } break; default: WRONG_PARAM_COUNT; /* NOTREACHED */ break; } gtk_html_set_default_background_color(GTK_HTML(PHP_GTK_GET(this_ptr)), &color); RETURN_NULL(); } %%override gtk_html_get_font_style /* some more cool stuff - direct access! */ PHP_FUNCTION(gtk_html_get_font_style) { GtkHTMLFontStyle php_retval; GdkColor *result_obj; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; php_retval = html_engine_get_font_style(GTK_HTML(PHP_GTK_GET(this_ptr))->engine); RETURN_LONG((long) php_retval); } %%override gtk_html_get_font_color PHP_FUNCTION(gtk_html_get_font_color) { HTMLColor *hcolor = NULL; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; hcolor = html_engine_get_color(GTK_HTML(PHP_GTK_GET(this_ptr))->engine); *return_value = *php_gdk_color_new(&hcolor->color); } %%override gtk_html_insert_link PHP_FUNCTION(gtk_html_insert_link) { gchar *url = NULL; gchar *target = NULL; int urllen=0; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "s#s", &url, &urllen, &target)) return; if (urllen > 0) { html_engine_insert_link(GTK_HTML(PHP_GTK_GET(this_ptr))->engine, url, target); } else { html_engine_insert_link(GTK_HTML(PHP_GTK_GET(this_ptr))->engine, NULL,NULL); } RETURN_NULL(); } %%override gtk_html_get_url PHP_FUNCTION(gtk_html_get_url) { gchar *ret=NULL; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; /* if (html_engine_is_selection_active ( GTK_HTML(PHP_GTK_GET(this_ptr))->engine)) */ ret = html_engine_get_url( GTK_HTML(PHP_GTK_GET(this_ptr))->engine); if (ret) { RETURN_STRING((char *)ret, 1); } else { RETURN_NULL(); } } %%override gtk_html_get_target PHP_FUNCTION(gtk_html_get_target) { gchar *ret=NULL; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; /* if (html_engine_is_selection_active ( GTK_HTML(PHP_GTK_GET(this_ptr))->engine)) */ ret = html_engine_get_target( GTK_HTML(PHP_GTK_GET(this_ptr))->engine ); if (ret) { RETURN_STRING((char *)ret, 1); } else { RETURN_NULL(); } } Index: php-gtk/ext/gtkhtml/gtkhtml.php +++ php-gtk/ext/gtkhtml/gtkhtml.php <? if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { echo "SORRY NOT SUPPORTED YET"; exit; } else { dl('php_gtk.so'); dl('curl.so'); } $loadurl = "http://gtk.php.net/"; function test_save() { global $gtkhtml; //$gtkhtml->save("save_callback"); } function save_callback($string) { echo $string; } function my_url_request ($url,$stream) { global $gtkhtml,$host; $fn = $url; if (substr($fn,0,4) == "http") { $host = ereg_replace("http://([^/]+)/.*","\\1",$url); $path = ereg_replace("http://[^/]+(/.*)","\\1",$url); } else { $path=$url; $url = "http://" . $host . $url; } $fs = 128; // if you do this, this call will become reentrant - hence be carefull with // the global variables // while (gtk::events_pending()) gtk::main_iteration(); if (function_exists("curl_init")) { // The easy way echo "GET $url"; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $string = curl_exec($ch); $s = curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD); curl_close($ch); if ($string) $gtkhtml->write($stream, $string,$s); $gtkhtml->end($stream,GTK_HTML_STREAM_OK); return; } // the slightly more portable way - but images bugger up // this is a bit flakey but should work for the example // it just downloads files... echo "GET $url"; $fh =fopen($url,"r"); $b=0; $found_start=0; if ($fh) while (!feof($fh)) { $d = fgets($fh,1024); if ($d) $gtkhtml->write($stream, $d,strlen($d)); while (gtk::events_pending()) gtk::main_iteration(); } fclose ($fh); while (gtk::events_pending()) gtk::main_iteration(); $gtkhtml->end($stream,GTK_HTML_STREAM_OK); } function loadit() { global $gtkhtml,$base,$loadurl; //while (gtk::events_pending()) gtk::main_iteration(); $base = $loadurl; $html_sh = $gtkhtml->begin(); my_url_request ($base,$html_sh); } /* * Create a window, and connect realize to the loadit function */ $window = &new GtkWindow(); $window->connect_after('show', 'loadit'); $window->set_border_width(10); $window->set_usize(500,300); $vbox = &new GtkVbox(); /* * You must add the html widget to a scrolled window */ $sw = &new gtkscrolledwindow(); $gtkhtml = &new gtkhtml(); echo "about to load!"; /* * the core image handler callback - connect_url_request */ $gtkhtml->connect_url_request('my_url_request'); /* * Some of the other callbacks available */ //$gtkhbml->connect('title-changed', "myevent", 'titlechanged'); //$gtkhtml->connect('load-done', "myevent",'load-done'); $gtkhtml->connect('on-url', "test_save"); //$gtkhtml->connect('set-base', "myevent",'on_set_base'); $gtkhtml->connect('redirect', myevent,'on_redirect'); //$gtkhtml->connect('object-requested', "myevent",'on_redirect'); echo serialize($gtkhtml); $sw->add($gtkhtml); $vbox->add($sw); $vbox->show(); $window->add($vbox); $gtkhtml->show(); $sw->show(); /* /* * Show the window and all its child widgets. */ $window->show(); /* Run the main loop. */ Gtk::main(); ?> Index: php-gtk/ext/gtkhtml/php_gtkhtml.c +++ php-gtk/ext/gtkhtml/php_gtkhtml.c /* * PHP-GTK-HTML - The PHP language bindings for GTKHTML * * Copyright (C) 2001 Alan Knowles <alan_k@hklc.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "php_gtk.h" #include "php_gtkhtml.h" #include "SAPI.h" #include <gtk/gtk.h> #ifdef GTKHTML_HAVE_GCONF #include <gconf/gconf.h> #endif #if HAVE_HTML #ifdef PHP_GTK_COMPILE_DL_GTKHTML PHP_GTK_GET_EXTENSION(gtkhtml) #endif PHP_GTK_XINIT_FUNCTION(gtkhtml) { #ifdef GTKHTML_HAVE_GCONF GConfError *gconf_error; char **argv; argv = (char **)g_new(char *, 1); argv[0] = g_strdup(SG(request_info).path_translated); /* printf("argv0 %s", argv[0]); */ if (!gconf_init(1, argv, &gconf_error)) gconf_error_destroy(gconf_error); gconf_error = NULL; #endif gdk_rgb_init (); gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); gtk_widget_set_default_visual (gdk_rgb_get_visual ()); php_gtkhtml_register_constants(module_number TSRMLS_CC); php_gtkhtml_register_classes(); return SUCCESS; } php_gtk_ext_entry gtkhtml_ext_entry = { "html", PHP_GTK_XINIT(gtkhtml), NULL, }; #endif /* HAVE_HTML */ Index: php-gtk/ext/gtkhtml/php_gtkhtml.h +++ php-gtk/ext/gtkhtml/php_gtkhtml.h /* * PHP-GTK-HTML - The PHP language bindings for GTKHTML * * Copyright (C) 2001 Alan Knowles <alan_k@hklc.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: php_gtkhtml.h,v 1.1 2001/11/28 01:28:33 alan_k Exp $: */ #ifndef PHP_HTML_H #define PHP_HTML_H #include "php_gtk.h" #if HAVE_HTML #include <gtkhtml/gtkhtml.h> int le_gtkhtmlstream; extern php_gtk_ext_entry gtkhtml_ext_entry; #define gtkhtml_ext_ptr &gtkhtml_ext_entry #define php_gtk_ext_gtkhtml_ptr gtkhtml_ext_ptr typedef struct { GtkHTMLStream *gs; long id; } php_gtkhtmlstream_s; #else #define gtkhtml_ext_ptr NULL #define php_gtk_ext_gtkhtml_ptr gtkhtml_ext_ptr #endif /* HAVE_HTML */ #endif /* PHP_HTML_H */
« previous php.gtk.cvs (#339) next »