Re: Re: GtkHTML next set of questions...
| From: | Steph | Date: | Tue, 09 Oct 2001 23:15:49 +0000 |
| Subject: | Re: Re: GtkHTML next set of questions... | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-90@lists.php.net to get a copy of this message | ||
I hate to quote over, but where *are* you registering le_ gtkhtmlstream?
----- Original Message -----
From: "Alan Knowles" <alan_k@hklc.com>
To: <php-gtk-dev@lists.php.net>
Sent: Tuesday, October 09, 2001 5:05 PM
Subject: [PHP-GTK-DEV] Re: GtkHTML next set of questions...
gtk_html_begin,write and end now all work thanks to the note below....
I am now looking at the callback signals for gtkhtml..
gtkhtml is supposed to work something like this..
create the gtkhtml object.
connect url_requested to a function 'x'
call gtk_html_begin, get the stream
put the html into with gtk_html_write.
call gtk_html_end.
meanwhile.. if there is an image tag, a 'url_requested' call back is supposted to be
emited.
this signal is emitted with
the object(Gtkhtml), the URL, a new HTMLStream
as the parameters
by adding a g_message prior to the call in htmlimage.c (from gtkhtml) I know that it is calling
gtk_signal_emit_by_name with url_requested - but I'm not quite sure where php is picking up
the callback..
as it does not appear to be doing anything - even emit warnings saying I dont know how to handle
this..
clues would be good... :)
thx
alan
since I know php-gtk wont know how to deal with the HTMLStream comming in,
>----- Original Message -----
> From: Markus Fischer <mfischer@guru.josefine.at>
> To: Alan Knowles <alan_k@hklc.com>
> Sent: Mon, 8 Oct 2001 04:19:54 +0200
> Subject: Re: [PHP-GTK-DEV] using resources... for GtkHTMLStream
>
> Sorry I completely ignored this one in the first place as I was
> to busy. I'm not a Zend guru myself.
>
> parse_args returns a zval* to your resource; not the resource
> directly:
>
> Try the following:
>
> zval *resource;
> int resource_type;
>
> if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "rsi", &resource, &buffer,
> &size))
> return;
>
> gs = zend_list_find(Z_RESVAL_P(resource), &resource_type);
> if (!gs || resource_type != le_gtkhtmlstream) {
> php_error(...
> return;
> }
>
>
> On Sat, Oct 06, 2001 at 05:15:33PM -0000, Alan Knowles wrote :
> > The two functions below illustrate the issue - gtk_html_begin
> > returns a struct, GtkHTMLStream gtk_html_write uses this as one
> > of it's inputs to determine where to send the data..
> >
> > I have attempted to wrap the return value into a PHP Resource
> > and defined a simple struct to wrap the real one..
> >
> > however I dont seem to be able to get the address back out of
> > the struct.. (or am even sure that I am setting it
> > correctly)...
> >
> > suggestions, other good (simple) examples of code doing
> > something similar would be helpfull..
> >
> > regards
> >
> > alan
> >
> > typedef struct {
> > GtkHTMLStream *htmlstream;
> > long id;
> > } php_gtkhtmlstream;
> >
> > static int le_gtkhtmlstream;
> >
> > PHP_FUNCTION(gtk_html_begin)
> > {
> > zval **res_value;
> > php_gtkhtmlstream *gs;
> >
> > NOT_STATIC_METHOD();
> >
> > if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
> > return;
> > gs = (php_gtkhtmlstream *)emalloc(sizeof(php_gtkhtmlstream));
> > gs->htmlstream = gtk_html_begin(GTK_HTML(PHP_GTK_GET(this_ptr)));
> > gs->id=1;
> > res_value = zend_list_insert(gs, le_gtkhtmlstream);
> >
> > RETURN_RESOURCE(res_value);
> >
> >
> > }
> >
> >
> >
> > PHP_FUNCTION(gtk_html_write)
> > {
> > php_gtkhtmlstream *gs;
> > char *buffer;
> > long size;
> >
> > NOT_STATIC_METHOD();
> >
> > if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "rsi", &gs, &buffer,
> > &size))
> > return;
> > gtk_html_write(GTK_HTML(PHP_GTK_GET(this_ptr)),
> > (GtkHTMLStream *)gs->htmlstream, buffer, (size_t) size);
> >
> > RETURN_NULL();
> > }
>
> --
> Markus Fischer, http://guru.josefine.at/~mfischer/
> EMail: mfischer@guru.josefine.at
> PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
> PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
> -All your scripts are belong to Zend-
>
>
--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, e-mail: php-gtk-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-gtk-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net