[gtk+/wip/attachment-parameters: 1/3] gdkattachmentparameters: add GdkAttachmentParameters
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/attachment-parameters: 1/3] gdkattachmentparameters: add GdkAttachmentParameters
- Date: Fri, 18 Sep 2015 21:45:53 +0000 (UTC)
commit 137716405ff8a5c9afaaed72bff398f78923c30a
Author: William Hua <william hua canonical com>
Date: Fri Sep 18 13:40:36 2015 -0400
gdkattachmentparameters: add GdkAttachmentParameters
gdk/Makefile.am | 2 +
gdk/gdk.h | 1 +
gdk/gdkattachmentparameters.c | 64 +++++++++++++++++++++++++++++++++++++++++
gdk/gdkattachmentparameters.h | 62 +++++++++++++++++++++++++++++++++++++++
4 files changed, 129 insertions(+), 0 deletions(-)
---
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index dea10d1..c8b70ff 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -63,6 +63,7 @@ gdk_public_h_sources = \
gdk.h \
gdk-autocleanup.h \
gdkapplaunchcontext.h \
+ gdkattachmentparameters.h \
gdkcairo.h \
gdkcursor.h \
gdkdevice.h \
@@ -126,6 +127,7 @@ gdk_c_sources = \
gdk-private.c \
gdk.c \
gdkapplaunchcontext.c \
+ gdkattachmentparameters.c \
gdkcairo.c \
gdkcursor.c \
gdkdeprecated.c \
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 65246d7..d88bfb9 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -30,6 +30,7 @@
#include <gdk/gdkconfig.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkapplaunchcontext.h>
+#include <gdk/gdkattachmentparameters.h>
#include <gdk/gdkcairo.h>
#include <gdk/gdkcursor.h>
#include <gdk/gdkdevice.h>
diff --git a/gdk/gdkattachmentparameters.c b/gdk/gdkattachmentparameters.c
new file mode 100644
index 0000000..aa08316
--- /dev/null
+++ b/gdk/gdkattachmentparameters.c
@@ -0,0 +1,64 @@
+#include "config.h"
+
+#include "gdkattachmentparameters.h"
+
+struct _GdkAttachmentParameters
+{
+ GdkPoint parent_origin;
+
+ gboolean has_attachment_rectangle;
+ GdkRectangle attachment_rectangle;
+
+ GdkPoint relative_offset;
+
+ GdkAttachmentPadding window_padding;
+
+ gboolean is_right_to_left;
+
+ GList *primary_options;
+ GList *secondary_options;
+
+ GdkAttachmentPositionCallback position_callback;
+};
+
+GdkAttachmentParameters *
+gdk_attachment_parameters_new (void)
+{
+ return g_new0 (GdkAttachmentParameters, 1);
+}
+
+gpointer
+gdk_attachment_parameters_copy (gconstpointer src,
+ gpointer data)
+{
+ GdkAttachmentParameters *copy;
+ const GdkAttachmentParameters *parameters;
+
+ if (!src)
+ return NULL;
+
+ parameters = src;
+
+ copy = g_memdup (parameters, sizeof (*parameters));
+
+ copy->primary_options = g_list_copy (parameters->primary_options);
+ copy->secondary_options = g_list_copy (parameters->secondary_options);
+
+ return copy;
+}
+
+void
+gdk_attachment_parameters_free (gpointer data)
+{
+ GdkAttachmentParameters *parameters;
+
+ if (!data)
+ return;
+
+ parameters = data;
+
+ g_list_free (parameters->secondary_options);
+ g_list_free (parameters->primary_options);
+
+ g_free (parameters);
+}
diff --git a/gdk/gdkattachmentparameters.h b/gdk/gdkattachmentparameters.h
new file mode 100644
index 0000000..29ef3ea
--- /dev/null
+++ b/gdk/gdkattachmentparameters.h
@@ -0,0 +1,62 @@
+#ifndef __GDK_ATTACHMENT_PARAMETERS_H__
+#define __GDK_ATTACHMENT_PARAMETERS_H__
+
+#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdk.h> can be included directly."
+#endif
+
+#include <gdk/gdktypes.h>
+#include <gdk/gdkversionmacros.h>
+
+G_BEGIN_DECLS
+
+enum _GdkAttachmentOptions
+{
+ GDK_ATTACHMENT_ATTACH_TOP_EDGE,
+ GDK_ATTACHMENT_ATTACH_LEFT_EDGE,
+ GDK_ATTACHMENT_ATTACH_RIGHT_EDGE,
+ GDK_ATTACHMENT_ATTACH_BOTTOM_EDGE,
+ GDK_ATTACHMENT_ATTACH_FORWARD_EDGE,
+ GDK_ATTACHMENT_ATTACH_BACKWARD_EDGE,
+ GDK_ATTACHMENT_ALIGN_TOP_EDGES,
+ GDK_ATTACHMENT_ALIGN_LEFT_EDGES,
+ GDK_ATTACHMENT_ALIGN_RIGHT_EDGES,
+ GDK_ATTACHMENT_ALIGN_BOTTOM_EDGES,
+ GDK_ATTACHMENT_ALIGN_FORWARD_EDGES,
+ GDK_ATTACHMENT_ALIGN_BACKWARD_EDGES,
+ GDK_ATTACHMENT_CENTER_HORIZONTALLY,
+ GDK_ATTACHMENT_CENTER_VERTICALLY,
+ GDK_ATTACHMENT_CENTER_ON_TOP_EDGE,
+ GDK_ATTACHMENT_CENTER_ON_LEFT_EDGE,
+ GDK_ATTACHMENT_CENTER_ON_RIGHT_EDGE,
+ GDK_ATTACHMENT_CENTER_ON_BOTTOM_EDGE,
+ GDK_ATTACHMENT_CENTER_ON_FORWARD_EDGE,
+ GDK_ATTACHMENT_CENTER_ON_BACKWARD_EDGE
+};
+
+struct _GdkAttachmentPadding
+{
+ gint top;
+ gint left;
+ gint right;
+ gint bottom;
+};
+
+typedef enum _GdkAttachmentOptions GdkAttachmentOptions;
+typedef struct _GdkAttachmentPadding GdkAttachmentPadding;
+typedef struct _GdkAttachmentParameters GdkAttachmentParameters;
+typedef void (*GdkAttachmentPositionCallback) (const GdkPoint *offset);
+
+GDK_AVAILABLE_IN_3_18
+GdkAttachmentParameters * gdk_attachment_parameters_new (void);
+
+GDK_AVAILABLE_IN_3_18
+gpointer gdk_attachment_parameters_copy (gconstpointer src,
+ gpointer data);
+
+GDK_AVAILABLE_IN_3_18
+void gdk_attachment_parameters_free (gpointer data);
+
+G_END_DECLS
+
+#endif /* __GDK_ATTACHMENT_PARAMETERS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]