FreePascal problem. About casting



Hello

I program in freepascal.
I am currently busy trying to write my own widgets.

In the tutorial with the tictactoe unit there is 3 defined "mascros":


#define TICTACTOE(obj)          GTK_CHECK_CAST (obj, tictactoe_get_type (), Tictactoe)
#define TICTACTOE_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, tictactoe_get_type (), TictactoeClass)
#define IS_TICTACTOE(obj)       GTK_CHECK_TYPE (obj, tictactoe_get_type ())

Could some one please help me on converting them to Pascal
Here is what I did:
(Got this from the pascal gtk units)
My widget is named edit (for know)

function is_edit(obj:pointer):boolean;cdecl;
begin
 is_edit :=(obj<>nil) and IS_EDIT_CLASS(PGtkTypeObject(obj)^.klass);
end;
function is_edit_class(klass:pointer):boolean;cdecl;
begin
 is_edit_class := (klass<>nil) and (PGtkTypeClass(klass)^.thetype=edit_get_type);
end;


Thanks for you help!
Heinrich






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]