GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

textbuffer.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00025 00026 #ifndef GFC_GTK_TEXT_BUFFER_HH 00027 #define GFC_GTK_TEXT_BUFFER_HH 00028 00029 #ifndef GFC_GTK_TEXT_ITER_HH 00030 #include <gfc/gtk/textiter.hh> 00031 #endif 00032 00033 #ifndef GFC_GTK_TEXT_TAG_HH 00034 #include <gfc/gtk/texttag.hh> 00035 #endif 00036 00037 #ifndef GTK_TEXT_BUFFER_H 00038 #include <gtk/gtktextbuffer.h> 00039 #endif 00040 00041 #ifndef _CPP_VECTOR 00042 #include <vector> 00043 #endif 00044 00045 namespace GFC { 00046 00047 namespace Gdk { 00048 class Pixbuf; 00049 } 00050 00051 namespace Gtk { 00052 00053 class Clipboard; 00054 class Widget; 00055 00076 00077 class TextMark : public G::Object 00078 { 00079 friend class G::Object; 00080 00081 TextMark(const TextMark&); 00082 TextMark& operator=(const TextMark&); 00083 00084 protected: 00087 00088 explicit TextMark(GtkTextMark *mark, bool owns_reference = false); 00095 00097 00098 public: 00101 00102 virtual ~TextMark(); 00104 00108 00109 GtkTextMark* gtk_text_mark() const; 00111 00112 operator GtkTextMark* () const; 00114 00115 bool get_visible() const; 00117 00118 String get_name() const; 00120 00121 bool get_deleted() const; 00124 00125 TextBuffer* get_buffer() const; 00127 00128 bool get_left_gravity() const; 00130 00134 00135 void set_visible(bool setting); 00143 00145 }; 00146 00153 00154 class TextChildAnchor : public G::Object 00155 { 00156 friend class G::Object; 00157 00158 TextChildAnchor(const TextChildAnchor&); 00159 TextChildAnchor& operator=(const TextChildAnchor&); 00160 00161 protected: 00164 00165 explicit TextChildAnchor(GtkTextChildAnchor *anchor, bool owns_reference = true); 00172 00174 00175 public: 00178 00179 TextChildAnchor(); 00184 00185 virtual ~TextChildAnchor(); 00187 00191 00192 GtkTextChildAnchor* gtk_text_child_anchor() const; 00194 00195 operator GtkTextChildAnchor* () const; 00197 00198 bool get_widgets(std::vector<Widget*>& widgets) const; 00202 00203 bool get_deleted() const; 00210 00212 }; 00213 00245 00246 class TextBuffer : public G::Object 00247 { 00248 friend class G::Object; 00249 00250 TextBuffer(const TextBuffer&); 00251 TextBuffer& operator=(const TextBuffer&); 00252 00253 protected: 00256 00257 explicit TextBuffer(GtkTextBuffer *buffer, bool owns_reference = true); 00264 00268 00269 typedef G::Signal<void, TextIter&, const String&> InsertTextSignalType; 00270 typedef G::SignalProxy<TypeInstance, InsertTextSignalType> InsertTextSignalProxy; 00271 static const InsertTextSignalType insert_text_signal; 00278 00279 typedef G::Signal<void, TextIter&, Gdk::Pixbuf&> InsertPixbufSignalType; 00280 typedef G::SignalProxy<TypeInstance, InsertPixbufSignalType> InsertPixbufSignalProxy; 00281 static const InsertPixbufSignalType insert_pixbuf_signal; 00288 00289 typedef G::Signal<void, TextIter&, TextChildAnchor&> InsertChildAnchorSignalType; 00290 typedef G::SignalProxy<TypeInstance, InsertChildAnchorSignalType> InsertChildAnchorSignalProxy; 00291 static const InsertChildAnchorSignalType insert_child_anchor_signal; 00298 00299 typedef G::Signal<void, TextIter&, TextIter&> DeleteRangeSignalType; 00300 typedef G::SignalProxy<TypeInstance, DeleteRangeSignalType> DeleteRangeSignalProxy; 00301 static const DeleteRangeSignalType delete_range_signal; 00308 00309 typedef G::Signal<void> ChangedSignalType; 00310 typedef G::SignalProxy<TypeInstance, ChangedSignalType> ChangedSignalProxy; 00311 static const ChangedSignalType changed_signal; 00316 00317 typedef G::Signal<void> ModifiedChangedSignalType; 00318 typedef G::SignalProxy<TypeInstance, ModifiedChangedSignalType> ModifiedChangedSignalProxy; 00319 static const ModifiedChangedSignalType modified_changed_signal; 00324 00325 typedef G::Signal<void, const TextIter&, TextMark&> MarkSetSignalType; 00326 typedef G::SignalProxy<TypeInstance, MarkSetSignalType> MarkSetSignalProxy; 00327 static const MarkSetSignalType mark_set_signal; 00334 00335 typedef G::Signal<void, TextMark&> MarkDeletedSignalType; 00336 typedef G::SignalProxy<TypeInstance, MarkDeletedSignalType> MarkDeletedSignalProxy; 00337 static const MarkDeletedSignalType mark_deleted_signal; 00343 00344 typedef G::Signal<void, TextTag&, const TextIter&, const TextIter&> ApplyTagSignalType; 00345 typedef G::SignalProxy<TypeInstance, ApplyTagSignalType> ApplyTagSignalProxy; 00346 static const ApplyTagSignalType apply_tag_signal; 00354 00355 typedef G::Signal<void, TextTag&, const TextIter&, const TextIter&> RemoveTagSignalType; 00356 typedef G::SignalProxy<TypeInstance, RemoveTagSignalType> RemoveTagSignalProxy; 00357 static const RemoveTagSignalType remove_tag_signal; 00365 00366 typedef G::Signal<void> BeginUserActionSignalType; 00367 typedef G::SignalProxy<TypeInstance, BeginUserActionSignalType> BeginUserActionSignalProxy; 00368 static const BeginUserActionSignalType begin_user_action_signal; 00373 00374 typedef G::Signal<void> EndUserActionSignalType; 00375 typedef G::SignalProxy<TypeInstance, EndUserActionSignalType> EndUserActionSignalProxy; 00376 static const EndUserActionSignalType end_user_action_signal; 00381 00383 00384 public: 00387 00388 explicit TextBuffer(TextTagTable *table = 0); 00391 00392 virtual ~TextBuffer(); 00394 00398 00399 GtkTextBuffer* gtk_text_buffer() const; 00401 00402 operator GtkTextBuffer* () const; 00404 00405 int get_line_count() const; 00410 00411 int get_char_count() const; 00418 00419 TextTagTable* get_tag_table() const; 00422 00423 String get_text(const TextIter& start, const TextIter& end, bool include_hidden_chars = false) const; 00434 00435 String get_slice(const TextIter& start, const TextIter& end, bool include_hidden_chars = false) const; 00448 00449 TextMark* get_mark(const char *name) const; 00450 TextMark* get_mark(const String& name) const; 00454 00455 TextMark* get_insert() const; 00461 00462 TextMark* get_selection_bound() const; 00472 00473 TextIter get_iter_at_line_offset(int line_number, int char_offset) const; 00481 00482 TextIter get_iter_at_line_index(int line_number, int byte_index) const; 00491 00492 TextIter get_iter_at_offset(int char_offset) const; 00501 00502 TextIter get_iter_at_line(int line_number) const; 00506 00507 TextIter get_start_iter() const; 00512 00513 TextIter get_end_iter() const; 00520 00521 void get_bounds(TextIter& start, TextIter& end) const; 00526 00527 TextIter get_iter_at_mark(TextMark& mark) const; 00531 00532 TextIter get_iter_at_child_anchor(TextChildAnchor& anchor) const; 00536 00537 bool get_modified() const; 00543 00544 bool get_selection_bounds(TextIter *start = 0, TextIter *end = 0) const; 00554 00558 00559 void begin_user_action(); 00573 00574 void end_user_action(); 00576 00577 void set_text(const char *text, int length = -1); 00581 00582 void set_text(const String& text); 00585 00586 void insert(TextIter& iter, const char *text, int length = -1); 00597 00598 void insert(TextIter& iter, const String& text); 00607 00608 void insert_at_cursor(const char *text, int length = -1); 00612 00613 void insert_at_cursor(const String& text); 00616 00617 bool insert_interactive(TextIter& iter, const char *text, int length, bool default_editable); 00630 00631 bool insert_interactive(TextIter& iter, const String& text, bool default_editable); 00643 00644 bool insert_interactive_at_cursor(const char *text, int length, bool default_editable); 00654 00655 bool insert_interactive_at_cursor(const String& text, bool default_editable); 00664 00665 void insert_range(TextIter& iter, const TextIter& start, const TextIter& end); 00676 00677 bool insert_range_interactive(TextIter& iter, const TextIter& start, const TextIter& end, bool default_editable); 00688 00689 void insert_with_tag(TextIter& iter, const char *text, int length, TextTag& tag); 00698 00699 void insert_with_tag(TextIter& iter, const String& text, TextTag&tag); 00707 00708 void insert_with_tags(TextIter& iter, const char *text, int length, const std::vector<TextTag*>& tags); 00717 00718 void insert_with_tags(TextIter& iter, const String& text, const std::vector<TextTag*>& tags); 00726 00727 void insert_with_tag_by_name(TextIter& iter, const char *text, int length, const char *tag_name); 00733 00734 void insert_with_tag_by_name(TextIter& iter, const String& text, const char *tag_name); 00739 00740 void insert_with_tags_by_name(TextIter& iter, const char *text, int length, const std::vector<String>& tag_names); 00746 00747 void insert_with_tags_by_name(TextIter& iter, const String& text, const std::vector<String>& tag_names); 00752 00753 void delete_range(TextIter& start, TextIter& end); 00763 00764 bool delete_range_interactive(TextIter& start, TextIter& end, bool default_editable); 00774 00775 void insert_pixbuf(TextIter& iter, Gdk::Pixbuf& pixbuf); 00785 00786 void insert_child_anchor(TextIter& iter, TextChildAnchor& anchor); 00798 00799 TextChildAnchor* create_child_anchor(TextIter& iter); 00807 00808 TextMark* create_mark(const char *mark_name, const TextIter& where, bool left_gravity); 00809 TextMark* create_mark(const String& mark_name, const TextIter& where, bool left_gravity); 00826 00827 void move_mark(TextMark& mark, const TextIter& where); 00833 00834 void move_mark_by_name(const char *name, const TextIter& where); 00835 void move_mark_by_name(const String& name, const TextIter& where); 00840 00841 void delete_mark(TextMark& mark); 00851 00852 void delete_mark_by_name(const char *name); 00853 void delete_mark_by_name(const String& name); 00856 00857 void place_cursor(const TextIter& where); 00865 00866 void select_range(const TextIter& insert, const TextIter& bound); 00875 00876 void apply_tag(TextTag& tag, const TextIter& start, const TextIter& end); 00884 00885 void apply_tag_by_name(const char *name, const TextIter& start, const TextIter& end); 00886 void apply_tag_by_name(const String& name, const TextIter& start, const TextIter& end); 00892 00893 void remove_tag(TextTag& tag, const TextIter& start, const TextIter& end); 00901 00902 void remove_tag_by_name(const char *name, const TextIter& start, const TextIter& end); 00903 void remove_tag_by_name(const String& name, const TextIter& start, const TextIter& end); 00909 00910 void remove_all_tags(const TextIter& start, const TextIter& end); 00918 00919 TextTag* create_tag(); 00926 00927 TextTag* create_tag(const char *tag_name); 00928 TextTag* create_tag(const String& tag_name); 00938 00939 void set_modified(bool setting); 00946 00947 void add_selection_clipboard(Clipboard& clipboard); 00954 00955 void remove_selection_clipboard(Clipboard& clipboard); 00958 00959 void cut_clipboard(Clipboard& clipboard, bool default_editable); 00963 00964 void copy_clipboard(Clipboard& clipboard); 00967 00968 void paste_clipboard(Clipboard& clipboard, TextIter *override_location, bool default_editable); 00976 00977 bool delete_selection(bool interactive, bool default_editable); 00986 00990 00991 const InsertTextSignalProxy sig_insert_text(); 00993 00994 const InsertPixbufSignalProxy sig_insert_pixbuf(); 00996 00997 const InsertChildAnchorSignalProxy sig_insert_child_anchor(); 00999 01000 const DeleteRangeSignalProxy sig_delete_range(); 01003 01004 const ChangedSignalProxy sig_changed(); 01007 01008 const ModifiedChangedSignalProxy sig_modified_changed(); 01011 01012 const MarkSetSignalProxy sig_mark_set(); 01014 01015 const MarkDeletedSignalProxy sig_mark_deleted(); 01017 01018 const ApplyTagSignalProxy sig_apply_tag(); 01021 01022 const RemoveTagSignalProxy sig_remove_tag(); 01025 01026 const BeginUserActionSignalProxy sig_begin_user_action(); 01029 01030 const EndUserActionSignalProxy sig_end_user_action(); 01033 01035 }; 01036 01037 } // namespace Gtk 01038 01039 } // namespace GFC 01040 01041 #include <gfc/gtk/inline/textbuffer.inl> 01042 01043 #endif // GFC_GTK_TEXT_BUFFER_HH 01044

Generated on Tue Aug 24 00:34:32 2004 for GFC-UI by doxygen 1.3.8