1 // -*- c++ -*- 2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY! 3 #ifndef _GTKMM_ENTRYBUFFER_H 4 #define _GTKMM_ENTRYBUFFER_H 5 6 #include <gtkmmconfig.h> 7 8 9 #include <glibmm/ustring.h> 10 #include <sigc++/sigc++.h> 11 12 /* $Id: entrybuffer.hg,v 1.20 2006/11/20 09:19:49 murrayc Exp $ */ 13 14 /* Copyright(C) 1998-2002 The gtkmm Development Team 15 * 16 * This library is free software; you can redistribute it and/or 17 * modify it under the terms of the GNU Lesser General Public 18 * License as published by the Free Software Foundation; either 19 * version 2.1 of the License, or(at your option) any later version. 20 * 21 * This library is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * Lesser General Public License for more details. 25 * 26 * You should have received a copy of the GNU Lesser General Public 27 * License along with this library; if not, write to the Free 28 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 29 */ 30 31 // This is for including the config header before any code (such as 32 // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated: 33 34 35 #include <gtkmm/object.h> 36 #include <gtkmmconfig.h> 37 #include <utility> 38 39 40 #ifndef DOXYGEN_SHOULD_SKIP_THIS 41 typedef struct _GtkEntryBuffer GtkEntryBuffer; 42 typedef struct _GtkEntryBufferClass GtkEntryBufferClass; 43 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 44 45 46 #ifndef DOXYGEN_SHOULD_SKIP_THIS 47 namespace Gtk 48 { class EntryBuffer_Class; } // namespace Gtk 49 #endif //DOXYGEN_SHOULD_SKIP_THIS 50 51 namespace Gtk 52 { 53 54 /** A Text buffer for the Entry widget. 55 * 56 * The EntryBuffer class contains the actual text displayed in an Entry widget. 57 * 58 * A single EntryBuffer object can be shared by multiple Entry 59 * widgets which will then share the same text content, but not the cursor 60 * position, visibility attributes, icon etc. 61 * 62 * EntryBuffer may be derived from. Such a derived class might allow 63 * text to be stored in an alternate location, such as non-pageable memory, 64 * useful in the case of important passwords. Or a derived class could 65 * integrate with an application's concept of undo/redo. 66 * 67 * @@newin{2,20} 68 */ 69 70 class EntryBuffer : public Glib::Object 71 { 72 73 #ifndef DOXYGEN_SHOULD_SKIP_THIS 74 75 public: 76 typedef EntryBuffer CppObjectType; 77 typedef EntryBuffer_Class CppClassType; 78 typedef GtkEntryBuffer BaseObjectType; 79 typedef GtkEntryBufferClass BaseClassType; 80 81 private: friend class EntryBuffer_Class; 82 static CppClassType entrybuffer_class_; 83 84 private: 85 // noncopyable 86 EntryBuffer(const EntryBuffer&); 87 EntryBuffer& operator=(const EntryBuffer&); 88 89 protected: 90 explicit EntryBuffer(const Glib::ConstructParams& construct_params); 91 explicit EntryBuffer(GtkEntryBuffer* castitem); 92 93 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 94 95 public: 96 virtual ~EntryBuffer(); 97 98 /** Get the GType for this class, for use with the underlying GObject type system. 99 */ 100 static GType get_type() G_GNUC_CONST; 101 102 #ifndef DOXYGEN_SHOULD_SKIP_THIS 103 104 105 static GType get_base_type() G_GNUC_CONST; 106 #endif 107 108 ///Provides access to the underlying C GObject. gobj()109 GtkEntryBuffer* gobj() { return reinterpret_cast<GtkEntryBuffer*>(gobject_); } 110 111 ///Provides access to the underlying C GObject. gobj()112 const GtkEntryBuffer* gobj() const { return reinterpret_cast<GtkEntryBuffer*>(gobject_); } 113 114 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 115 GtkEntryBuffer* gobj_copy(); 116 117 private: 118 119 protected: 120 121 /** Create a new EntryBuffer object with no text. 122 */ 123 EntryBuffer(); 124 125 /** Create a new EntryBuffer object. 126 * 127 * @param text Initial buffer text. 128 */ 129 explicit EntryBuffer(const Glib::ustring& text); 130 131 public: 132 /** Create a new EntryBuffer object with no text. 133 */ 134 135 static Glib::RefPtr<EntryBuffer> create(); 136 137 138 /** Create a new EntryBuffer object. 139 * 140 * @param text Initial buffer text. 141 */ 142 143 static Glib::RefPtr<EntryBuffer> create(const Glib::ustring& text); 144 145 146 /** Retrieves the length in bytes of the buffer. 147 * See get_length(). 148 * 149 * @newin{2,18} 150 * 151 * @return The byte length of the buffer. 152 */ 153 gsize get_bytes() const; 154 155 /** Retrieves the length in characters of the buffer. 156 * 157 * @newin{2,18} 158 * 159 * @return The number of characters in the buffer. 160 */ 161 guint get_length() const; 162 163 /** Retrieves the contents of the buffer. 164 * 165 * The memory pointer returned by this call will not change 166 * unless this object emits a signal, or is finalized. 167 * 168 * @newin{2,18} 169 * 170 * @return A pointer to the contents of the widget as a 171 * string. This string points to internally allocated 172 * storage in the buffer and must not be freed, modified or 173 * stored. 174 */ 175 Glib::ustring get_text() const; 176 177 /** Sets the text in the buffer. 178 * This is roughly equivalent to calling delete_text() and insert_text(). 179 * 180 * @param text The text to set in the buffer. 181 */ 182 void set_text(const Glib::ustring& text); 183 184 185 /** Sets the maximum allowed length of the contents of the buffer. If 186 * the current contents are longer than the given length, then they 187 * will be truncated to fit. 188 * 189 * @newin{2,18} 190 * 191 * @param max_length The maximum length of the entry buffer, or 0 for no maximum. 192 * (other than the maximum length of entries.) The value passed in will 193 * be clamped to the range 0-65536. 194 */ 195 void set_max_length(int max_length); 196 197 /** Retrieves the maximum allowed length of the text in 198 * @a buffer. See set_max_length(). 199 * 200 * @newin{2,18} 201 * 202 * @return The maximum allowed number of characters 203 * in Gtk::EntryBuffer, or 0 if there is no maximum. 204 */ 205 int get_max_length() const; 206 207 /** Inserts @a text into the contents of the buffer, at position @a position. 208 * 209 * @param position The position at which to insert text. 210 * @param text The text to insert into the buffer. 211 * @result The number of characters actually inserted. 212 */ 213 guint insert_text(guint position, const Glib::ustring& text); 214 215 216 /** Deletes a sequence of characters from the buffer. @a n_chars characters are 217 * deleted starting at @a position. If @a n_chars is negative, then all characters 218 * until the end of the text are deleted. 219 * 220 * If @a position or @a n_chars are out of bounds, then they are coerced to sane 221 * values. 222 * 223 * Note that the positions are specified in characters, not bytes. 224 * 225 * @newin{2,18} 226 * 227 * @param position Position at which to delete text. 228 * @param n_chars Number of characters to delete. 229 * @return The number of characters deleted. 230 */ 231 guint delete_text(guint position, int n_chars); 232 233 /** Used when deriving from EntryBuffer. 234 * @param position Position at which text was inserted. 235 * @param text Text that was inserted. 236 */ 237 void emit_inserted_text(guint position, const Glib::ustring& text); 238 239 240 /** Used when subclassing Gtk::EntryBuffer 241 * 242 * @newin{2,18} 243 * 244 * @param position Position at which text was deleted. 245 * @param n_chars Number of characters deleted. 246 */ 247 void emit_deleted_text(guint position, guint n_chars); 248 249 250 /** 251 * @par Slot Prototype: 252 * <tt>void on_my_%inserted_text(guint position, const gchar* chars, guint n_chars)</tt> 253 * 254 */ 255 256 Glib::SignalProxy3< void,guint,const gchar*,guint > signal_inserted_text(); 257 258 259 /** 260 * @par Slot Prototype: 261 * <tt>void on_my_%deleted_text(guint position, guint n_chars)</tt> 262 * 263 */ 264 265 Glib::SignalProxy2< void,guint,guint > signal_deleted_text(); 266 267 268 /** The contents of the buffer. 269 * 270 * @return A PropertyProxy that allows you to get or set the value of the property, 271 * or receive notification when the value of the property changes. 272 */ 273 Glib::PropertyProxy< Glib::ustring > property_text() ; 274 275 /** The contents of the buffer. 276 * 277 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 278 * or receive notification when the value of the property changes. 279 */ 280 Glib::PropertyProxy_ReadOnly< Glib::ustring > property_text() const; 281 282 /** Length of the text currently in the buffer. 283 * 284 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 285 * or receive notification when the value of the property changes. 286 */ 287 Glib::PropertyProxy_ReadOnly< guint > property_length() const; 288 289 290 /** Maximum number of characters for this entry. Zero if no maximum. 291 * 292 * @return A PropertyProxy that allows you to get or set the value of the property, 293 * or receive notification when the value of the property changes. 294 */ 295 Glib::PropertyProxy< int > property_max_length() ; 296 297 /** Maximum number of characters for this entry. Zero if no maximum. 298 * 299 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 300 * or receive notification when the value of the property changes. 301 */ 302 Glib::PropertyProxy_ReadOnly< int > property_max_length() const; 303 304 305 public: 306 307 public: 308 //C++ methods used to invoke GTK+ virtual functions: 309 310 protected: 311 //GTK+ Virtual Functions (override these to change behaviour): 312 313 //Default Signal Handlers:: 314 /// This is a default handler for the signal signal_inserted_text(). 315 virtual void on_inserted_text(guint position, const gchar* chars, guint n_chars); 316 /// This is a default handler for the signal signal_deleted_text(). 317 virtual void on_deleted_text(guint position, guint n_chars); 318 319 320 }; 321 322 } // namespace Gtk 323 324 325 namespace Glib 326 { 327 /** A Glib::wrap() method for this object. 328 * 329 * @param object The C instance. 330 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 331 * @result A C++ instance that wraps this C instance. 332 * 333 * @relates Gtk::EntryBuffer 334 */ 335 Glib::RefPtr<Gtk::EntryBuffer> wrap(GtkEntryBuffer* object, bool take_copy = false); 336 } 337 338 339 #endif /* _GTKMM_ENTRYBUFFER_H */ 340 341