summaryrefslogtreecommitdiff
path: root/gtk/gtktexthandleprivate.h
diff options
context:
space:
mode:
authorCarlos Garnacho <carlos@lanedo.com>2012-07-11 15:51:43 +0200
committerMatthias Clasen <mclasen@redhat.com>2012-09-03 00:19:03 -0400
commit1f7e375c33c77209181f6b3d3720c1f72c652153 (patch)
tree212b74934fa4f2f41c2163b57e7a25d35c5430a6 /gtk/gtktexthandleprivate.h
parent8c632417c48982ddd4054c4c054fcd39964f3fac (diff)
downloadgtk+-1f7e375c33c77209181f6b3d3720c1f72c652153.tar.gz
Add GtkTextHandle
This is a helper object to allow text widgets to implement text selection on touch devices. It allows for both cursor placement and text selection, displaying draggable handles on/around the cursor and selection bound positions. Currently, this is private to GTK+, and only available to GtkEntry and GtkTextView.
Diffstat (limited to 'gtk/gtktexthandleprivate.h')
-rw-r--r--gtk/gtktexthandleprivate.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/gtk/gtktexthandleprivate.h b/gtk/gtktexthandleprivate.h
new file mode 100644
index 0000000000..220ee68297
--- /dev/null
+++ b/gtk/gtktexthandleprivate.h
@@ -0,0 +1,90 @@
+/* GTK - The GIMP Toolkit
+ * Copyright © 2012 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_TEXT_HANDLE_PRIVATE_H__
+#define __GTK_TEXT_HANDLE_PRIVATE_H__
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TEXT_HANDLE (_gtk_text_handle_get_type ())
+#define GTK_TEXT_HANDLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_TEXT_HANDLE, GtkTextHandle))
+#define GTK_TEXT_HANDLE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_TEXT_HANDLE, GtkTextHandleClass))
+#define GTK_IS_TEXT_HANDLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_TEXT_HANDLE))
+#define GTK_IS_TEXT_HANDLE_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE ((o), GTK_TYPE_TEXT_HANDLE))
+#define GTK_TEXT_HANDLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_TEXT_HANDLE, GtkTextHandleClass))
+
+typedef struct _GtkTextHandle GtkTextHandle;
+typedef struct _GtkTextHandleClass GtkTextHandleClass;
+
+typedef enum
+{
+ GTK_TEXT_HANDLE_POSITION_CURSOR,
+ GTK_TEXT_HANDLE_POSITION_SELECTION_START,
+ GTK_TEXT_HANDLE_POSITION_SELECTION_END = GTK_TEXT_HANDLE_POSITION_CURSOR
+} GtkTextHandlePosition;
+
+typedef enum
+{
+ GTK_TEXT_HANDLE_MODE_NONE,
+ GTK_TEXT_HANDLE_MODE_CURSOR,
+ GTK_TEXT_HANDLE_MODE_SELECTION
+} GtkTextHandleMode;
+
+struct _GtkTextHandle
+{
+ GObject parent_instance;
+ gpointer priv;
+};
+
+struct _GtkTextHandleClass
+{
+ GObjectClass parent_class;
+
+ void (* handle_dragged) (GtkTextHandle *handle,
+ GtkTextHandlePosition pos,
+ gint x,
+ gint y);
+ void (* drag_finished) (GtkTextHandle *handle,
+ GtkTextHandlePosition pos);
+};
+
+GType _gtk_text_handle_get_type (void) G_GNUC_CONST;
+
+GtkTextHandle * _gtk_text_handle_new (GtkWidget *parent);
+
+void _gtk_text_handle_set_mode (GtkTextHandle *handle,
+ GtkTextHandleMode mode);
+GtkTextHandleMode
+ _gtk_text_handle_get_mode (GtkTextHandle *handle);
+void _gtk_text_handle_set_position (GtkTextHandle *handle,
+ GtkTextHandlePosition pos,
+ GdkRectangle *rect);
+void _gtk_text_handle_set_visible (GtkTextHandle *handle,
+ GtkTextHandlePosition pos,
+ gboolean visible);
+
+void _gtk_text_handle_set_relative_to (GtkTextHandle *handle,
+ GdkWindow *window);
+
+gboolean _gtk_text_handle_get_is_dragged (GtkTextHandle *handle,
+ GtkTextHandlePosition pos);
+
+G_END_DECLS
+
+#endif /* __GTK_TEXT_HANDLE_PRIVATE_H__ */