Main Page - Header
Author: The Inti Development Team

Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# editable.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00022
    00023 #ifndef INTI_GTK_EDITABLE_H
    00024 #define INTI_GTK_EDITABLE_H
    00025
    00026 #ifndef INTI_G_TYPE_H
    00027 #include <inti/glib/type.h>
    00028 #endif
    00029
    00030 #ifndef __GTK_EDITABLE_H__
    00031 #include <gtk/gtkeditable.h>
    00032 #endif
    00033
    00034 namespace Inti {
    00035
    00036 namespace Gtk {
    00037
    00038 class EditableClass;
    00039
    00107
    00108 class Editable : public virtual G::TypeInterface
    00109 {
    00110         friend class EditableClass;
    00111
    00112 protected:
    00115
    00116         virtual ~Editable() = 0;
    00118
    00120 //  Override these do_ methods when you want to change the default behaviour of the GtkEditable.
    00121
    00122         virtual void do_insert_text(const char *text, int length, int *position);
    00123
    00124         virtual void do_delete_text(int start_pos, int end_pos);
    00125
    00126         virtual char* do_get_chars(int start_pos, int end_pos);
    00127
    00128         virtual void do_set_selection_bounds(int start_pos, int end_pos);
    00129
    00130         virtual bool do_get_selection_bounds(int *start_pos, int *end_pos);
    00131
    00132         virtual void do_set_position(int position);
    00133
    00134         virtual int do_get_position();
    00135
    00138
    00139         virtual void on_insert_text(const String& text, int *position);
    00149
    00150         virtual void on_delete_text(int start_pos, int end_pos);
    00160
    00161         virtual void on_changed();
    00163
    00165 //  Signals
    00166
    00167         typedef G::Signal3<void, const char*, int, int*> InsertTextSignalType;
    00168         typedef G::SignalProxy<TypeInstance, InsertTextSignalType> InsertTextSignalProxy;
    00169         static const InsertTextSignalType insert_text_signal;
    00170
    00171         typedef G::Signal2<void, int, int> DeleteTextSignalType;
    00172         typedef G::SignalProxy<TypeInstance, DeleteTextSignalType> DeleteTextSignalProxy;
    00173         static const DeleteTextSignalType delete_text_signal;
    00174
    00175         typedef G::Signal0<void> ChangedSignalType;
    00176         typedef G::SignalProxy<TypeInstance, ChangedSignalType> ChangedSignalProxy;
    00177         static const ChangedSignalType changed_signal;
    00178
    00179 public:
    00182
    00183         GtkEditable* gtk_editable() const { return (GtkEditable*)instance; }
    00185
    00186         GtkEditableClass* gtk_editable_class() const;
    00188
    00189         operator GtkEditable* () const;
    00191
    00192         bool get_selection_bounds(int *start, int *end) const;
    00197
    00198         String get_chars(int start_pos, int end_pos) const;
    00207
    00208         int get_position() const;
    00215
    00216         bool get_editable() const;
    00219
    00223
    00224         void select_region(int start, int end);
    00232
    00233         void insert_text(const String& new_text, int& position);
    00240
    00241         void delete_text(int start_pos, int end_pos);
    00249
    00250         void cut_clipboard();
    00253
    00254         void copy_clipboard();
    00256
    00257         void paste_clipboard();
    00260
    00261         void delete_selection();
    00263
    00264         void set_position(int position);
    00272
    00273         void set_editable(bool is_editable);
    00276
    00280
    00281         const InsertTextSignalProxy sig_insert_text()
    00282         {
    00283                 return InsertTextSignalProxy(this, &insert_text_signal);
    00284         }
    00290
    00291         const DeleteTextSignalProxy sig_delete_text()
    00292         {
    00293                 return DeleteTextSignalProxy(this, &delete_text_signal);
    00294         }
    00301
    00302         const ChangedSignalProxy sig_changed()
    00303         {
    00304                 return ChangedSignalProxy(this, &changed_signal);
    00305         }
    00307
    00309 };
    00310
    00311 } // namespace Gtk
    00312
    00313 } // namespace Inti
    00314
    00315 #endif // INTI_GTK_EDITABLE_H
    00316

Main Page - Footer