diff options
author | Timm Bäder <mail@baedert.org> | 2017-04-06 19:17:29 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-04-25 20:29:02 +0200 |
commit | 2be675b538e1229ccd2d2771130a3bfe60deda6d (patch) | |
tree | ac61a957de0ce91f01145a03d23fd5ca1d076b7f /gtk/gtkgizmoprivate.h | |
parent | ae1a606c8b959acc6f03240757293b4802b6d638 (diff) | |
download | gtk+-2be675b538e1229ccd2d2771130a3bfe60deda6d.tar.gz |
Add GtkGizmo
GtkGizmo is the easiest possible widget to implement. It does nothing
except give its creator a way to control measure/size-allocate/snapshot,
so it can be used in a variety of use cases.
Diffstat (limited to 'gtk/gtkgizmoprivate.h')
-rw-r--r-- | gtk/gtkgizmoprivate.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gtk/gtkgizmoprivate.h b/gtk/gtkgizmoprivate.h new file mode 100644 index 0000000000..5fb78420c0 --- /dev/null +++ b/gtk/gtkgizmoprivate.h @@ -0,0 +1,58 @@ + +#ifndef __GTK_GIZMO_H__ +#define __GTK_GIZMO_H__ + +#include "gtkwidget.h" +#include "gtkcssgadgetprivate.h" +#include "gtkcsscustomgadgetprivate.h" + +#define GTK_TYPE_GIZMO (gtk_gizmo_get_type ()) +#define GTK_GIZMO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GIZMO, GtkGizmo)) +#define GTK_GIZMO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GIZMO, GtkGizmoClass)) +#define GTK_IS_GIZMO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GIZMO)) +#define GTK_IS_GIZMO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GIZMO)) +#define GTK_GIZMO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GIZMO, GtkGizmoClass)) + +typedef struct _GtkGizmo GtkGizmo; +typedef struct _GtkGizmoClass GtkGizmoClass; + +typedef void (* GtkGizmoMeasureFunc) (GtkGizmo *gizmo, + GtkOrientation orientation, + int for_size, + int *minimum, + int *natural, + int *minimum_baseline, + int *natural_baseline); +typedef void (* GtkGizmoAllocateFunc) (GtkGizmo *gizmo, + const GtkAllocation *allocation, + int baseline, + GtkAllocation *out_clip); +typedef gboolean (* GtkGizmoSnapshotFunc) (GtkGizmo *gizmo, + GtkSnapshot *snapshot); + + +struct _GtkGizmo +{ + GtkWidget parent_instance; + + GtkCssGadget *gadget; + + GtkGizmoMeasureFunc measure_func; + GtkGizmoAllocateFunc allocate_func; + GtkGizmoSnapshotFunc snapshot_func; +}; + +struct _GtkGizmoClass +{ + GtkWidgetClass parent_class; +}; + +GType gtk_gizmo_get_type (void) G_GNUC_CONST; + +GtkWidget *gtk_gizmo_new (const char *css_name, + GtkGizmoMeasureFunc measure_func, + GtkGizmoAllocateFunc allocate_func, + GtkGizmoSnapshotFunc snapshot_func); + + +#endif |