1 /* GTK - The GIMP Toolkit
2  * Copyright © 2012 Carlos Garnacho <carlosg@gnome.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GTK_TEXT_HANDLE_PRIVATE_H__
19 #define __GTK_TEXT_HANDLE_PRIVATE_H__
20 
21 #include <gtk/gtkwidget.h>
22 
23 G_BEGIN_DECLS
24 
25 #define GTK_TYPE_TEXT_HANDLE           (_gtk_text_handle_get_type ())
26 #define GTK_TEXT_HANDLE(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_TEXT_HANDLE, GtkTextHandle))
27 #define GTK_TEXT_HANDLE_CLASS(c)       (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_TEXT_HANDLE, GtkTextHandleClass))
28 #define GTK_IS_TEXT_HANDLE(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_TEXT_HANDLE))
29 #define GTK_IS_TEXT_HANDLE_CLASS(o)    (G_TYPE_CHECK_CLASS_TYPE ((o), GTK_TYPE_TEXT_HANDLE))
30 #define GTK_TEXT_HANDLE_GET_CLASS(o)   (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_TEXT_HANDLE, GtkTextHandleClass))
31 
32 typedef struct _GtkTextHandle GtkTextHandle;
33 typedef struct _GtkTextHandleClass GtkTextHandleClass;
34 
35 typedef enum
36 {
37   GTK_TEXT_HANDLE_POSITION_CURSOR,
38   GTK_TEXT_HANDLE_POSITION_SELECTION_START,
39   GTK_TEXT_HANDLE_POSITION_SELECTION_END = GTK_TEXT_HANDLE_POSITION_CURSOR
40 } GtkTextHandlePosition;
41 
42 typedef enum
43 {
44   GTK_TEXT_HANDLE_MODE_NONE,
45   GTK_TEXT_HANDLE_MODE_CURSOR,
46   GTK_TEXT_HANDLE_MODE_SELECTION
47 } GtkTextHandleMode;
48 
49 struct _GtkTextHandle
50 {
51   GObject parent_instance;
52   gpointer priv;
53 };
54 
55 struct _GtkTextHandleClass
56 {
57   GObjectClass parent_class;
58 
59   void (* handle_dragged) (GtkTextHandle         *handle,
60                            GtkTextHandlePosition  pos,
61                            gint                   x,
62                            gint                   y);
63   void (* drag_finished)  (GtkTextHandle         *handle,
64                            GtkTextHandlePosition  pos);
65 };
66 
67 GType           _gtk_text_handle_get_type     (void) G_GNUC_CONST;
68 
69 GtkTextHandle * _gtk_text_handle_new          (GtkWidget             *parent);
70 
71 void            _gtk_text_handle_set_mode     (GtkTextHandle         *handle,
72                                                GtkTextHandleMode      mode);
73 GtkTextHandleMode
74                 _gtk_text_handle_get_mode     (GtkTextHandle         *handle);
75 void            _gtk_text_handle_set_position (GtkTextHandle         *handle,
76                                                GtkTextHandlePosition  pos,
77                                                GdkRectangle          *rect);
78 void            _gtk_text_handle_set_visible  (GtkTextHandle         *handle,
79                                                GtkTextHandlePosition  pos,
80                                                gboolean               visible);
81 
82 gboolean        _gtk_text_handle_get_is_dragged (GtkTextHandle         *handle,
83                                                  GtkTextHandlePosition  pos);
84 void            _gtk_text_handle_set_direction (GtkTextHandle         *handle,
85                                                 GtkTextHandlePosition  pos,
86                                                 GtkTextDirection       dir);
87 
88 G_END_DECLS
89 
90 #endif /* __GTK_TEXT_HANDLE_PRIVATE_H__ */
91