Main Page Widgets Namespaces Book

# Gtk::Editable Class Reference

Base class for text-editing widgets. More...

Inheritance diagram for Gtk::Editable:

[legend]

List of all members.

## Public Member Functions
void | copy_clipboard ()
| Copies the contents of the currently selected content in the editable and puts it on the clipboard.
void | cut_clipboard ()
| Removes the contents of the currently selected content in the editable and puts it on the clipboard.
void | delete_selection ()
| Deletes the currently selected text of the editable.
void | delete_text (int start_pos, int end_pos)
| Deletes the content of the editable between start_pos and end_pos.
Glib::ustring | get_chars (int start_pos, int end_pos) const
| Retreives the content of the editable between start and end.
bool | get_editable () const
| Retrieves whether editable is editable.
int | get_position () const
| Retrieves the current position of the cursor relative to the start of the content of the editable.
bool | get_selection_bounds (int& start_pos, int& end_pos) const
| Retrieves the selection bound of the editable.
const GtkEditable* | gobj () const
| Provides access to the underlying C GObject.
GtkEditable* | gobj ()
| Provides access to the underlying C GObject.
void | insert_text (const Glib::ustring& text, int length, int& position)
| Appends new_text_length characters of new_text to the contents of the widget, at position position.
void | paste_clipboard ()
| Pastes the content of the clipboard to the current position of the cursor in the editable.
void | select_region (int start_pos, int end_pos)
| Selects the text between start and end.
void | set_editable (bool is_editable=true)
| Determines if the user can edit the text in the editable widget or not.
void | set_position (int position)
| Sets the cursor position in the editable to the given value.
Glib::SignalProxy0<void> | signal_changed ()
Glib::SignalProxy2< void, int, int > | signal_delete_text ()
Glib::SignalProxy2< void, const Glib::ustring&, int* > | signal_insert_text ()
virtual | ~Editable ()
## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
## Protected Member Functions
virtual void | delete_text_vfunc (int start_pos, int end_pos)
virtual Glib::ustring | get_chars_vfunc (int start_pos, int end_pos) const
virtual int | get_position_vfunc () const
virtual bool | get_selection_bounds_vfunc (int& start_pos, int& end_pos) const
virtual void | insert_text_vfunc (const Glib::ustring& text, int& position)
virtual void | on_changed ()
virtual void | on_delete_text (int start_pos, int end_pos)
virtual void | on_insert_text (const Glib::ustring& text, int* position)
virtual void | select_region_vfunc (int start_pos, int end_pos)
virtual void | set_position_vfunc (int position)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr<Gtk::Editable> | wrap (GtkEditable* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Base class for text-editing widgets.

The Gtk::Editable class is a base class for widgets for editing text, such as Gtk::Entry. It cannot be instantiated by itself. The editable class contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.

## Constructor& Destructor Documentation

virtual Gtk::Editable::~Editable | ( |  | ) | `[virtual]`

## Member Function Documentation

static void Gtk::Editable::add_interface | ( | GType | gtype_implementer | ) | `[static]`

void Gtk::Editable::copy_clipboard | ( |  | ) |

Copies the contents of the currently selected content in the editable and puts it on the clipboard.

void Gtk::Editable::cut_clipboard | ( |  | ) |

Removes the contents of the currently selected content in the editable and puts it on the clipboard.

void Gtk::Editable::delete_selection | ( |  | ) |

Deletes the currently selected text of the editable.

This call will not do anything if there is no selected text.

void Gtk::Editable::delete_text | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  |

Deletes the content of the editable between start_pos and end_pos.

Note that positions are specified in characters, not bytes.

Parameters:

  | start_pos | Start position.
  | end_pos | End position.

virtual void Gtk::Editable::delete_text_vfunc | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  | `[protected, virtual]`

Glib::ustring Gtk::Editable::get_chars | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  | const

Retreives the content of the editable between start and end.

Note that positions are specified in characters, not bytes.

Parameters:

  | start | Start of text.
  | end | End of text.

Returns:
  A pointer to the contents of the widget as a string. This string is allocated by the Gtk::Editable implementation and should be freed by the caller.

virtual Glib::ustring Gtk::Editable::get_chars_vfunc | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  | const`[protected, virtual]`

bool Gtk::Editable::get_editable | ( |  | ) | const

Retrieves whether editable is editable.

See set_editable().

Returns:
  `true` if editable is editable.

int Gtk::Editable::get_position | ( |  | ) | const

Retrieves the current position of the cursor relative to the start of the content of the editable.

Note that this position is in characters, not in bytes.

Returns:
  The cursor position.

virtual int Gtk::Editable::get_position_vfunc | ( |  | ) | const`[protected, virtual]`

bool Gtk::Editable::get_selection_bounds | ( | int & | start_pos,
|  | int & | end_pos |
| ) |  |  | const

Retrieves the selection bound of the editable.

start_pos will be filled with the start of the selection and end_pos with end. If no text was selected both will be identical and `false` will be returned. Note that positions are specified in characters, not bytes.

Parameters:

  | start_pos | Beginning of selection.
  | end_pos | End of selection.

Returns:
  `true` if an area is selected, `false` otherwise.

virtual bool Gtk::Editable::get_selection_bounds_vfunc | ( | int & | start_pos,
|  | int & | end_pos |
| ) |  |  | const`[protected, virtual]`

const GtkEditable* Gtk::Editable::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented in Gtk::Entry, and Gtk::SpinButton.

GtkEditable* Gtk::Editable::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented in Gtk::Entry, and Gtk::SpinButton.

void Gtk::Editable::insert_text | ( | const Glib::ustring & | text,
|  | int | length,
|  | int & | position |
| ) |  |  |

Appends new_text_length characters of new_text to the contents of the widget, at position position.

Note that this position is in characters, not in bytes.

Parameters:

  | new_text | The text to append.
  | new_text_length | The text to append.
  | position | Position text will be inserted at.

virtual void Gtk::Editable::insert_text_vfunc | ( | const Glib::ustring & | text,
|  | int & | position |
| ) |  |  | `[protected, virtual]`

virtual void Gtk::Editable::on_changed | ( |  | ) | `[protected, virtual]`

virtual void Gtk::Editable::on_delete_text | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  | `[protected, virtual]`

virtual void Gtk::Editable::on_insert_text | ( | const Glib::ustring & | text,
|  | int * | position |
| ) |  |  | `[protected, virtual]`

void Gtk::Editable::paste_clipboard | ( |  | ) |

Pastes the content of the clipboard to the current position of the cursor in the editable.

void Gtk::Editable::select_region | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  |

Selects the text between start and end.

Both start and end are relative to the start of the content. Note that positions are specified in characters, not bytes.

Parameters:

  | start | Start of region.
  | end | End of region.

virtual void Gtk::Editable::select_region_vfunc | ( | int | start_pos,
|  | int | end_pos |
| ) |  |  | `[protected, virtual]`

void Gtk::Editable::set_editable | ( | bool | is_editable = `true` | ) |

Determines if the user can edit the text in the editable widget or not.

Parameters:

  | is_editable | `true` if the user is allowed to edit the text in the widget.

void Gtk::Editable::set_position | ( | int | position | ) |

Sets the cursor position in the editable to the given value.

Parameters:

  | position | The position of the cursor. The cursor is displayed before the character with the given (base 0) index in the editable. The value must be less than or equal to the number of characters in the editable. A value of -1 indicates that the position should be set after the last character of the editable. Note that this position is in characters, not in bytes.

virtual void Gtk::Editable::set_position_vfunc | ( | int | position | ) | `[protected, virtual]`

Glib::SignalProxy0< void > Gtk::Editable::signal_changed | ( |  | ) |

Prototype:
  `void on_my_changed()`

Glib::SignalProxy2< void,int,int > Gtk::Editable::signal_delete_text | ( |  | ) |

Prototype:
  `void on_my_delete_text(int start_pos, int end_pos)`

Glib::SignalProxy2< void,const Glib::ustring&,int* > Gtk::Editable::signal_insert_text | ( |  | ) |

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::Editable> wrap | ( | GtkEditable * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- editable.h