| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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,
- M2ListModel, M2ListModelGetNItemsFunc, M2ListModelGetItemFunc,
- m2_gtk_widget_new, m2_paintable_new,
- m2_list_model_new, m2_list_model_items_changed;
- TYPE
- M2Widget = ADDRESS;
- M2WidgetDrawFunc = ADDRESS;
- M2Paintable = ADDRESS;
- M2PaintableDrawFunc = ADDRESS;
- M2ListModel = ADDRESS;
- (* PROCEDURE (user: ADDRESS) : CARDINAL *)
- M2ListModelGetNItemsFunc = ADDRESS;
- (* PROCEDURE (position: CARDINAL; user: ADDRESS) : ADDRESS
- Must return a new reference (transfer full). *)
- M2ListModelGetItemFunc = 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;
- (* GListModel *m2_list_model_new(M2ListModelGetNItemsFunc get_n_items,
- M2ListModelGetItemFunc get_item,
- GType item_type, gpointer user_data,
- GDestroyNotify destroy) *)
- PROCEDURE m2_list_model_new (get_n_items: M2ListModelGetNItemsFunc;
- get_item: M2ListModelGetItemFunc;
- item_type: LONGCARD; user_data: ADDRESS;
- destroy: ADDRESS) : M2ListModel;
- (* void m2_list_model_items_changed(GListModel *model, guint position,
- guint removed, guint added) *)
- PROCEDURE m2_list_model_items_changed (model: M2ListModel;
- position, removed, added: CARDINAL);
- END M2GtkShim.
|