1 /* $Id: entry.hg,v 1.12 2006/06/13 17:16:26 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gtkmm/widget.h>
23 #include <gtkmm/editable.h>
24 #include <gtkmm/menu.h>
25 #include <gtkmm/celleditable.h>
26 #include <gtkmm/entrycompletion.h>
27 #include <gtkmm/adjustment.h>
30 _PINCLUDE(gtkmm/private/widget_p.h)
35 //TODO: This is used in Range too, so put it somewhere more appropriate:
36 typedef GtkBorder Border;
38 /** A single line text entry field.
40 * The Gtk::Entry widget is a single line text entry widget. A fairly large
41 * set of key bindings are supported by default. If the entered text is
42 * longer than the allocation of the widget, the widget will scroll so that
43 * the cursor position is visible.
52 _CLASS_GTKOBJECT(Entry,GtkEntry,GTK_ENTRY,Gtk::Widget,GtkWidget)
53 _IGNORE(gtk_entry_new_with_max_length , gtk_entry_append_text, gtk_entry_prepend_text, gtk_entry_set_position,
54 gtk_entry_select_region, gtk_entry_set_editable)
55 _IMPLEMENTS_INTERFACE(Editable)
56 _IMPLEMENTS_INTERFACE(CellEditable)
62 _WRAP_METHOD(void set_visibility(bool visible = true), gtk_entry_set_visibility)
63 _WRAP_METHOD(bool get_visibility() const, gtk_entry_get_visibility)
64 _WRAP_METHOD(void set_invisible_char(gunichar ch), gtk_entry_set_invisible_char)
65 _WRAP_METHOD(gunichar get_invisible_char() const, gtk_entry_get_invisible_char)
66 _WRAP_METHOD(void set_has_frame(bool setting = true), gtk_entry_set_has_frame)
67 _WRAP_METHOD(bool get_has_frame() const, gtk_entry_get_has_frame)
69 _WRAP_METHOD(void set_inner_border(const Border& border), gtk_entry_set_inner_border)
70 _WRAP_METHOD(Border get_inner_border() const, gtk_entry_get_inner_border)
72 _WRAP_METHOD(void set_max_length(int max), gtk_entry_set_max_length)
73 _WRAP_METHOD(int get_max_length() const, gtk_entry_get_max_length)
74 _WRAP_METHOD(void set_activates_default(bool setting = true), gtk_entry_set_activates_default)
75 _WRAP_METHOD(gboolean get_activates_default() const, gtk_entry_get_activates_default)
76 _WRAP_METHOD(void set_width_chars(int n_chars), gtk_entry_set_width_chars)
77 _WRAP_METHOD(int get_width_chars() const, gtk_entry_get_width_chars)
78 _WRAP_METHOD(void set_text(const Glib::ustring &text), gtk_entry_set_text)
79 _WRAP_METHOD(Glib::ustring get_text() const, gtk_entry_get_text)
80 _WRAP_METHOD(Glib::RefPtr<Pango::Layout> get_layout(), gtk_entry_get_layout, refreturn)
81 _WRAP_METHOD(Glib::RefPtr<const Pango::Layout> get_layout() const, gtk_entry_get_layout, refreturn, constversion)
82 _WRAP_METHOD(void get_layout_offsets(int& x, int& y), gtk_entry_get_layout_offsets)
84 _WRAP_METHOD(int layout_index_to_text_index(int layout_index) const, gtk_entry_layout_index_to_text_index)
85 _WRAP_METHOD(int text_index_to_layout_index(int text_index) const, gtk_entry_text_index_to_layout_index)
87 _WRAP_METHOD(void set_cursor_hadjustment (Adjustment& adjustment), gtk_entry_set_cursor_hadjustment)
88 _WRAP_METHOD(Adjustment* get_cursor_hadjustment(), gtk_entry_get_cursor_hadjustment, refreturn)
89 _WRAP_METHOD(const Adjustment* get_cursor_hadjustment() const, gtk_entry_get_cursor_hadjustment, refreturn, constversion)
91 _WRAP_METHOD(void set_alignment(float xalign), gtk_entry_set_alignment)
92 _WRAP_METHOD(void set_alignment(AlignmentEnum xalign), gtk_entry_set_alignment)
93 _WRAP_METHOD(float get_alignment() const, gtk_entry_get_alignment)
95 _WRAP_METHOD(void set_completion(const Glib::RefPtr<EntryCompletion>& completion), gtk_entry_set_completion)
96 _WRAP_METHOD(Glib::RefPtr<EntryCompletion> get_completion(), gtk_entry_get_completion, refreturn)
97 _WRAP_METHOD(Glib::RefPtr<const EntryCompletion> get_completion() const, gtk_entry_get_completion, refreturn, constversion)
99 _MEMBER_GET(text_length, text_length, guint16, guint16)
101 _WRAP_SIGNAL(void populate_popup(Menu* menu), "populate_popup")
102 _WRAP_SIGNAL(void insert_at_cursor(const Glib::ustring& str), "insert_at_cursor")
104 //Key-binding signals:
106 //This is a keybinding signal, but it is allowed:
107 // http://mail.gnome.org/archives/gtk-devel-list/2003-January/msg00108.html
108 // "activate is probably about the only exception"
109 _WRAP_SIGNAL(void activate(), "activate")
111 _IGNORE_SIGNAL("move_cursor")
112 _IGNORE_SIGNAL("delete_from_cursor")
113 _IGNORE_SIGNAL("cut_clipboard")
114 _IGNORE_SIGNAL("copy_clipboard")
115 _IGNORE_SIGNAL("paste_clipboard")
116 _IGNORE_SIGNAL("toggle_overwrite")
117 _IGNORE_SIGNAL("backspace")
119 _WRAP_PROPERTY("cursor-position", int)
120 _WRAP_PROPERTY("selection-bound", int)
121 _WRAP_PROPERTY("editable", bool)
122 _WRAP_PROPERTY("max-length", int)
123 _WRAP_PROPERTY("visibility", bool)
124 _WRAP_PROPERTY("has-frame", bool)
125 _WRAP_PROPERTY("invisible-char", gunichar)
126 _WRAP_PROPERTY("activates-default", bool)
127 _WRAP_PROPERTY("width-chars", int)
128 _WRAP_PROPERTY("scroll-offset", int)
129 _WRAP_PROPERTY("text", Glib::ustring)
130 _WRAP_PROPERTY("xalign", float)
131 _WRAP_PROPERTY("truncate-multiline", bool)
134 } /* namespace Gtk */