| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- DEFINITION MODULE FOR "C" M2GtkShim ;
- (*
- m2-GTK4 - C shim for GObject subclassing.
- GNU Modula-2 cannot register a GObject subclass or override vfuncs.
- This module exposes two C-implemented helper types whose snapshot
- vfunc hands a Cairo context to a Modula-2 callback, so custom drawing
- is possible without leaving Modula-2 (and reusing the Cairo binding).
- Provided by lib/m2gtkshim.c:
- M2Widget a GtkWidget subclass. The draw callback is
- PROCEDURE (widget: ADDRESS; cr: ADDRESS;
- width, height: INTEGER; user: ADDRESS);
- Set its size with GtkWidget.gtk_widget_set_size_request.
- M2Paintable a GdkPaintable implementation. The draw callback is
- PROCEDURE (cr: ADDRESS; width, height: INTEGER;
- user: ADDRESS);
- Give it to a GtkPicture or GtkImage.
- user_data is passed through; the optional destroy procedure runs when
- the object is finalized.
- *)
- FROM SYSTEM IMPORT ADDRESS;
- EXPORT UNQUALIFIED
- M2Widget, M2WidgetDrawFunc,
- M2Paintable, M2PaintableDrawFunc,
- m2_gtk_widget_new, m2_paintable_new;
- TYPE
- M2Widget = ADDRESS;
- M2WidgetDrawFunc = ADDRESS;
- M2Paintable = ADDRESS;
- M2PaintableDrawFunc = ADDRESS;
- (* GtkWidget *m2_gtk_widget_new(M2WidgetDrawFunc draw, gpointer user_data,
- GDestroyNotify destroy) *)
- PROCEDURE m2_gtk_widget_new (draw: M2WidgetDrawFunc; user_data: ADDRESS;
- destroy: ADDRESS) : M2Widget;
- (* GdkPaintable *m2_paintable_new(M2PaintableDrawFunc draw, int width,
- int height, gpointer user_data,
- GDestroyNotify destroy) *)
- PROCEDURE m2_paintable_new (draw: M2PaintableDrawFunc; width, height: INTEGER;
- user_data: ADDRESS; destroy: ADDRESS) : M2Paintable;
- END M2GtkShim.
|