[Gtk2forpascal-devel] How to add gtkhtml into gtk2forpascal?
Brought to you by:
mgaertner
|
From: <wan...@ya...> - 2002-10-29 02:04:50
|
Hello, every body
I try to add gtkhtml into gtk2forpascal. I just want
a very simple gtkhtml,
so I only some of the files into pascal and combine to
one file. I can
compile the interface successfully, but when I use it
into my program, the
compiler report some bugs:
specified class size for type `GParamChar' is
specified class size for type
`GParamChar' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamUChar'
isspecified class size for type
`GParamUChar' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamBoolean'
specified class size for type
`GParamBoolean' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamInt' is
sspecified class size for type
`GParamInt' is smaller than the parent type's `GParam'
class size
specified class size for type `GParamUInt' is
specified class size for type
`GParamUInt' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamLong' is
specified class size for type
`GParamLong' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamULong'
isspecified class size for type
`GParamULong' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamInt64'
isspecified class size for type
`GParamInt64' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamUInt64'
ispecified class size for type
`GParamUInt64' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamUnichar'
specified class size for type
`GParamUnichar' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamEnum' is
specified class size for type
`GParamEnum' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamFlags'
isspecified class size for type
`GParamFlags' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamFloat'
isspecified class size for type
`GParamFloat' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamDouble'
ispecified class size for type
`GParamDouble' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamString'
ispecified class size for type
`GParamString' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamParam'
isspecified class size for type
`GParamParam' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamBoxed'
isspecified class size for type
`GParamBoxed' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamPointer'
specified class size for type
`GParamPointer' is smaller than the parent type's
`GParam' class size
specified class size for type
`GParamValueArraspecified class size for type
`GParamValueArray' is smaller than the parent type's
`GParam' class size
specified class size for type `GParamObject'
ispecified class size for type
`GParamObject' is smaller than the parent type's
`GParam' class size
An unhandled exception occurred at 0x403A8DEB :
Access violation
0x403A8DEB
0x403AAB95
0x403A717A
0x403A71C0
0x4028219D
0x400F6D7B
0x400F71A6
0x080796AB
0x0804DC70
Can you tell how to modify this program?
Thank you very much.
Yours,
mili
>>>>>>> here is the interface file, gtkhtml.pas
>>>>>>>
unit gtkhtml;
interface
uses
gtk2, glib2, gdk2;
const
gtkhtmllib = 'gtkhtml';
{ I have make a link in /usr/lib to
libgtkhtml.so.20, I am sure
the gtkhtml is encapsulated in this lib because I
used hexedit
to search "gtk_html_get_type" }
{ Pointers to basic pascal types, inserted by h2pas
conversion program.}
type
TGtkHTMLStreamStatus = (GTK_HTML_STREAM_OK,
GTK_HTML_STREAM_ERROR);
PGtkHTMLStream = ^TGtkHTMLStream;
TGtkHTMLStreamTypesFunc = function
(stream:PGtkHTMLStream;
user_data:gpointer):ppgchar;cdecl;
TGtkHTMLStreamCloseFunc = procedure
(stream:PGtkHTMLStream;
status:TGtkHTMLStreamStatus;
user_data:gpointer);cdecl;
TGtkHTMLStreamWriteFunc = procedure
(stream:PGtkHTMLStream; buffer:Pgchar;
size:integer; user_data:gpointer);cdecl;
TGtkHTMLSaveReceiverFn = function
(engine:gpointer; data:Pgchar;
len:integer; user_data:gpointer):gboolean;cdecl;
TGtkHTMLStream = record
write_func : TGtkHTMLStreamWriteFunc;
close_func : TGtkHTMLStreamCloseFunc;
types_func : TGtkHTMLStreamTypesFunc;
user_data : gpointer;
end;//TGtkHTMLStream
PGtkHTML = ^TGtkHTML;
TGtkHTML = record
layout : TGtkLayout;
editor_bindings : PGtkBindingSet;
iframe_parent : PGtkWidget;
editor_data : gpointer;
pointer_url : pgchar;
hand_cursor : PGdkCursor;
arrow_cursor : PGdkCursor;
ibeam_cursor : PGdkCursor;
selection_x1 : gint;
selection_y1 : gint;
flag0 : word;
hadj_connection : guint;
vadj_connection : guint;
binding_handled : gboolean;
end;//TGtkHTML
PGtkHTMLClass = ^TGtkHTMLClass;
TGtkHTMLClass = record
parent_class : TGtkLayoutClass;
end;//TGtkHTMLClass
function GTK_TYPE_HTML : GType;
function GTK_HTML(obj: pointer) : PGtkHTML;
function GTK_HTML_CLASS(klass: pointer) :
PGtkHTMLClass;
function GTK_IS_HTML(obj: pointer) : boolean;
function GTK_IS_HTML_CLASS(klass: pointer) :
boolean;
{ creation }
function gtk_html_get_type:TGtkType;cdecl; external
gtkhtmllib;
procedure gtk_html_construct(html:PGtkWidget);cdecl;
external gtkhtmllib;
function gtk_html_new:PGtkWidget;cdecl; external
gtkhtmllib;
function gtk_html_new_from_string(str:Pgchar;
len:gint):PGtkWidget;cdecl;
external gtkhtmllib;
{ Behavior. }
procedure gtk_html_allow_selection(html:PGtkHTML;
allow:gboolean);cdecl;
external gtkhtmllib;
{ Loading. }
function
gtk_html_begin(html:PGtkHTML):PGtkHTMLStream;cdecl;
external
gtkhtmllib;
function gtk_html_begin_content(html:PGtkHTML;
content_type:Pgchar):PGtkHTMLStream;cdecl; external
gtkhtmllib;
procedure gtk_html_write(html:PGtkHTML;
handle:PGtkHTMLStream;
buffer:Pgchar; size:integer);cdecl; external
gtkhtmllib;
procedure gtk_html_end(html:PGtkHTML;
handle:PGtkHTMLStream;
status:TGtkHTMLStreamStatus);cdecl; external
gtkhtmllib;
procedure gtk_html_load_empty(html:PGtkHTML);cdecl;
external gtkhtmllib;
procedure gtk_html_load_from_string(html:PGtkHTML;
str:Pgchar;
len:gint);cdecl; external gtkhtmllib;
{ Saving. }
function gtk_html_save(html:PGtkHTML;
receiver:TGtkHTMLSaveReceiverFn;
data:gpointer):gboolean;cdecl; external gtkhtmllib;
function gtk_html_export(html:PGtkHTML; _type:Pchar;
receiver:TGtkHTMLSaveReceiverFn;
data:gpointer):gboolean;cdecl; external
gtkhtmllib;
{ Title. }
function
gtk_html_get_title(html:PGtkHTML):pgchar;cdecl;
external
gtkhtmllib;
procedure gtk_html_set_title(html:PGtkHTML;
title:Pchar);cdecl; external
gtkhtmllib;
{ Anchors. }
function gtk_html_jump_to_anchor(html:PGtkHTML;
anchor:Pgchar):gboolean;cdecl; external gtkhtmllib;
procedure gtk_html_copy(html:PGtkHTML);cdecl;
external gtkhtmllib;
{ misc utils }
procedure
gtk_html_set_default_background_color(html:PGtkHTML;
c:PGdkColor);cdecl; external gtkhtmllib;
procedure
gtk_html_set_default_content_type(html:PGtkHTML;
content_type:Pgchar);cdecl; external gtkhtmllib;
function gtk_html_get_object_by_id(html:PGtkHTML;
id:Pgchar):gpointer;cdecl; external gtkhtmllib;
procedure gtk_html_zoom_in(html:PGtkHTML);cdecl;
external gtkhtmllib;
procedure gtk_html_zoom_out(html:PGtkHTML);cdecl;
external gtkhtmllib;
procedure gtk_html_zoom_reset(html:PGtkHTML);cdecl;
external gtkhtmllib;
procedure gtk_html_set_allow_frameset(html:PGtkHTML;
allow:gboolean);cdecl;
external gtkhtmllib;
function
gtk_html_get_allow_frameset(html:PGtkHTML):gboolean;cdecl;
external gtkhtmllib;
procedure gtk_html_images_ref(html:PGtkHTML);cdecl;
external gtkhtmllib;
procedure
gtk_html_images_unref(html:PGtkHTML);cdecl; external
gtkhtmllib;
procedure gtk_html_image_ref(html:PGtkHTML;
url:Pgchar);cdecl; external
gtkhtmllib;
procedure gtk_html_image_unref(html:PGtkHTML;
url:Pgchar);cdecl; external
gtkhtmllib;
procedure gtk_html_image_preload(html:PGtkHTML;
url:Pgchar);cdecl; external
gtkhtmllib;
procedure gtk_html_set_blocking(html:PGtkHTML;
block:gboolean);cdecl;
external gtkhtmllib;
{stream}
function gtk_html_stream_new(html:PGtkHTML;
type_func:TGtkHTMLStreamTypesFunc;
write_func:TGtkHTMLStreamWriteFunc;
close_func:TGtkHTMLStreamCloseFunc;
user_data:gpointer):PGtkHTMLStream;cdecl;
external gtkhtmllib;
procedure
gtk_html_stream_write(stream:PGtkHTMLStream;
buffer:Pgchar;
size:integer);cdecl; external gtkhtmllib;
procedure
gtk_html_stream_destroy(stream:PGtkHTMLStream);cdecl;
external
gtkhtmllib;
procedure
gtk_html_stream_close(stream:PGtkHTMLStream;
status:TGtkHTMLStreamStatus);cdecl; external
gtkhtmllib;
function
gtk_html_stream_get_types(stream:PGtkHTMLStream):ppchar;cdecl;
external gtkhtmllib;
implementation
{$IFNDEF KYLIX}
{ There is a bug in the compiler. If an external
variable is not used, it
will create code, that can be relocated by the
linker.
So, use them in this hidden procedure.
}
procedure CheckUnusedVariable; [Public];
begin
if (gtk_major_version<>0) then ;
if (gtk_minor_version<>0) then ;
if (gtk_micro_version<>0) then ;
if (gtk_binary_age<>0) then ;
if (gtk_interface_age<>0) then ;
if (ord(gtk_text_attr_appearance_type)<>0) then ;
end;
{$ENDIF}
function GTK_TYPE_HTML : GType;
begin
GTK_TYPE_HTML:=gtk_html_get_type;
end;//GTK_TYPE_HTML
function GTK_HTML(obj: pointer) : PGtkHTML;
begin
GTK_HTML:=PGtkHTML(GTK_CHECK_CAST(obj,GTK_TYPE_HTML));
end;//GTK_HTML
function GTK_HTML_CLASS(klass: pointer) :
PGtkHTMLClass;
begin
GTK_HTML_CLASS:=PGtkHTMLClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_HTML));
end;//GTK_HTML_CLASS
function GTK_IS_HTML(obj: pointer) : boolean;
begin
GTK_IS_HTML:=GTK_CHECK_TYPE(obj,GTK_TYPE_HTML);
end;//GTK_IS_HTML
function GTK_IS_HTML_CLASS(klass: pointer) :
boolean;
begin
GTK_IS_HTML_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_HTML);
end;//GTK_IS_HTML_CLASS
end.//unit gtkhtml
<<<<<<<<<< end of file gtkhtml.pas <<<<<<<<<<<
>>>>>>>>>> the test file, test.pp >>>>>>>>>>>>>>>>>>
program test;
{$H+}
uses
glib2, gtk2, gdk2, gtkhtml;
var
window : PGtkWidget;
sw : PGtkWidget;
html : PGtkWidget;
procedure destroy (window: PGtkWidget; data:
gpointer); cdecl;
begin
gtk_main_quit();
end;//destroy
begin
gtk_init(@argc,@argv);
window:=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window,'destroy',TGCallback(@destroy),NULL);
sw:=gtk_scrolled_window_new(NULL,NULL);
gtk_widget_show(sw);
gtk_container_add(PGtkContainer(window),sw);
html:=gtk_html_new();
gtk_widget_show(html);
gtk_scrolled_window_add_with_viewport(PGtkScrolledWindow(sw),html);
gtk_widget_show(window);
gtk_main();
end.//test
<<<<<<<<<< end of file test.pp <<<<<<<<<<<
_________________________________________________________
Do You Yahoo!?
"是IT精英吗?小试牛刀获时尚大奖!"
http://cn.promo.yahoo.com/cgi-bin/udb/u
|