| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- 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,
- M2LayoutManager, M2LayoutMeasureFunc, M2LayoutAllocateFunc,
- M2SnapshotPaintable, M2SnapshotDrawFunc,
- m2_gtk_widget_new, m2_paintable_new,
- m2_snapshot_paintable_new,
- m2_list_model_new, m2_list_model_items_changed,
- m2_layout_manager_new, m2_layout_allocate_child;
- 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;
- M2LayoutManager = ADDRESS;
- (* PROCEDURE (widget: ADDRESS; orientation: INTEGER; for_size: INTEGER;
- VAR minimum, natural: INTEGER; user: ADDRESS) *)
- M2LayoutMeasureFunc = ADDRESS;
- (* PROCEDURE (widget: ADDRESS; width, height, baseline: INTEGER;
- user: ADDRESS) *)
- M2LayoutAllocateFunc = ADDRESS;
- M2SnapshotPaintable = ADDRESS;
- (* PROCEDURE (snapshot: ADDRESS; width, height: INTEGER; user: ADDRESS) *)
- M2SnapshotDrawFunc = 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;
- (* GdkPaintable *m2_snapshot_paintable_new(M2SnapshotDrawFunc draw, int width,
- int height, gpointer user_data,
- GDestroyNotify destroy) *)
- PROCEDURE m2_snapshot_paintable_new (draw: M2SnapshotDrawFunc;
- width, height: INTEGER;
- user_data: ADDRESS;
- destroy: ADDRESS) : M2SnapshotPaintable;
- (* 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);
- (* GtkLayoutManager *m2_layout_manager_new(M2LayoutMeasureFunc measure,
- M2LayoutAllocateFunc allocate,
- gpointer user_data,
- GDestroyNotify destroy) *)
- PROCEDURE m2_layout_manager_new (measure: M2LayoutMeasureFunc;
- allocate: M2LayoutAllocateFunc;
- user_data: ADDRESS;
- destroy: ADDRESS) : M2LayoutManager;
- (* void m2_layout_allocate_child(GtkWidget *child, int x, int y,
- int width, int height) *)
- PROCEDURE m2_layout_allocate_child (child: ADDRESS; x, y, width, height: INTEGER);
- END M2GtkShim.
|