gtkeditable.h 3.61 KB
Newer Older
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
/* GTK - The GIMP Toolkit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef __GTK_EDITABLE_H__
#define __GTK_EDITABLE_H__


#include <gdk/gdk.h>
#include <gtk/gtkwidget.h>


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


#define GTK_EDITABLE(obj)          GTK_CHECK_CAST (obj, gtk_editable_get_type (), GtkEditable)
#define GTK_EDITABLE_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_editable_get_type (), GtkEditableClass)
#define GTK_IS_EDITABLE(obj)       GTK_CHECK_TYPE (obj, gtk_editable_get_type ())


typedef struct _GtkEditable       GtkEditable;
typedef struct _GtkEditableClass  GtkEditableClass;

39
typedef void (*GtkTextFunction) (GtkEditable  *editable, guint32 time);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

struct _GtkEditable
{
  GtkWidget widget;

  guint   current_pos;

  guint   selection_start_pos;
  guint   selection_end_pos;
  guint   has_selection : 1;
  guint   editable : 1;
  GdkIC   ic;

  gchar *clipboard_text;
};

struct _GtkEditableClass
{
  GtkWidgetClass parent_class;

  void (* insert_text)  (GtkEditable    *editable,
			 const gchar    *text,
62 63
			 gint            length,
			 gint           *position);
64
  void (* delete_text)  (GtkEditable    *editable,
65 66
			 gint            start_pos,
			 gint            end_pos);
67
  void (* update_text)  (GtkEditable    *editable,
68 69
			 gint            start_pos,
			 gint            end_pos);
70
  gchar* (* get_chars)  (GtkEditable    *editable,
71 72
			 gint            start_pos,
			 gint            end_pos);
73
  void (* set_selection)(GtkEditable    *editable,
74 75
			 gint            start_pos,
			 gint            end_pos);
Owen Taylor's avatar
Owen Taylor committed
76
  void (* activate)     (GtkEditable    *editable);
77 78 79 80 81
  void (* changed)      (GtkEditable    *editable);
};

guint      gtk_editable_get_type       (void);
void       gtk_editable_select_region  (GtkEditable      *editable,
82 83
					gint              start,
					gint              end);
84 85
void       gtk_editable_insert_text   (GtkEditable       *editable,
					const gchar      *new_text,
86 87
					gint              new_text_length,
					gint             *position);
88
void       gtk_editable_delete_text    (GtkEditable      *editable,
89 90
					gint              start_pos,
					gint              end_pos);
91
gchar *    gtk_editable_get_chars      (GtkEditable      *editable,
92 93
					gint              start_pos,
					gint              end_pos);
94 95
void       gtk_editable_cut_clipboard  (GtkEditable      *editable,
					guint32           time);
96
void       gtk_editable_copy_clipboard (GtkEditable      *editable, 
97
					guint32           time);
98
void       gtk_editable_paste_clipboard (GtkEditable     *editable, 
99
					 guint32          time);
100 101 102 103 104 105 106 107 108 109 110 111 112 113
void       gtk_editable_claim_selection (GtkEditable     *editable, 
					 gboolean         claim, 
					 guint32          time);
void       gtk_editable_delete_selection (GtkEditable    *editable);

void       gtk_editable_changed         (GtkEditable    *editable);


#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __GTK_EDITABLE_H__ */