summaryrefslogtreecommitdiff
path: root/gtk/gtktexthandleprivate.h
blob: 220ee68297edb460030cff339b06a813d8bc50e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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__ */