Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

textiter.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti 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  
00023 
00024 #ifndef INTI_GTK_TEXT_ITER_H
00025 #define INTI_GTK_TEXT_ITER_H
00026 
00027 #ifndef INTI_G_BOXED_H
00028 #include <inti/glib/boxed.h>
00029 #endif
00030 
00031 #ifndef INTI_SLOT_H
00032 #include <inti/slot.h>
00033 #endif
00034 
00035 #ifndef INTI_UTF_STRING_H
00036 #include <inti/utf-string.h>
00037 #endif
00038 
00039 #ifndef GTK_TEXT_ITER_H
00040 #include <gtk/gtktextiter.h>
00041 #endif
00042 
00043 #ifndef _CPP_VECTOR
00044 #include <vector>
00045 #endif
00046 
00047 namespace Inti {
00048 
00049 namespace G {
00050 class Unichar;
00051 }
00052 
00053 namespace Gdk {
00054 class Pixbuf;
00055 }
00056 
00057 namespace Gtk {
00058 
00059 class TextAttributes;
00060 class TextBuffer;
00061 class TextChildAnchor;
00062 class TextMark;
00063 class TextTag;
00064 
00068 
00069 enum TextSearchFlags
00070 {
00071         TEXT_SEARCH_VISIBLE_ONLY = 1 << 0 /* GTK_TEXT_SEARCH_VISIBLE_ONLY */,
00074 
00075         TEXT_SEARCH_TEXT_ONLY = 1 << 1 /* GTK_TEXT_SEARCH_TEXT_ONLY */
00077 };
00078 
00080 
00081 typedef unsigned int TextSearchFlagsField;
00082 
00096 
00097 class TextIter : public G::Boxed
00098 {
00099 public:
00100         typedef Slot1<bool, G::Unichar> TextCharPredicate;
00109 
00112 
00113         TextIter();
00115         
00116         explicit TextIter(GtkTextIter *iter);
00124 
00125         TextIter(GtkTextIter *iter, bool copy);
00135 
00136         TextIter(const TextIter& src);
00139 
00140         ~TextIter();
00142 
00143         TextIter& operator=(const TextIter& src);
00146 
00150 
00151         GtkTextIter* gtk_text_iter() const { return (GtkTextIter*)boxed_; }
00153 
00154         operator GtkTextIter* () const;
00156 
00157         TextBuffer* get_buffer() const;
00159 
00160         int get_offset() const;
00164 
00165         int get_line() const;
00168 
00169         int get_line_offset() const;
00174 
00175         int get_line_index() const;
00181 
00182         int get_visible_line_offset() const;
00186 
00187         int get_visible_line_index() const;
00191 
00192         G::Unichar get_char() const;
00201 
00202         G::Unichar operator*() const;
00211 
00212         Gdk::Pixbuf* get_pixbuf() const;
00215         
00216         bool get_marks(std::vector<TextMark*>& marks) const;
00224         
00225         TextChildAnchor* get_child_anchor() const;
00228         
00229         bool get_toggled_tags(std::vector<TextTag*>& tags, bool toggled_on) const;
00239 
00240         bool begins_tag(const TextTag *tag = 0) const;
00249 
00250         bool ends_tag(const TextTag *tag = 0) const;
00258 
00259         bool toggles_tag(const TextTag *tag = 0) const;
00264 
00265         bool has_tag(const TextTag& tag) const;
00269 
00270         bool get_tags(std::vector<TextTag*>& tags) const;
00277 
00278         bool editable(bool default_setting) const;
00292 
00293         bool can_insert(bool default_editability) const;
00302 
00303         bool starts_word() const;
00309 
00310         bool ends_word() const;
00316 
00317         bool inside_word() const;
00324 
00325         bool starts_sentence() const;
00331 
00332         bool ends_sentence() const;
00338 
00339         bool inside_sentence() const;
00346 
00347         bool starts_line() const;
00353 
00354         bool ends_line() const;
00364 
00365         bool is_cursor_position() const;
00369 
00370         int get_chars_in_line() const;
00373 
00374         int get_bytes_in_line() const;
00377 
00378         bool get_attributes(TextAttributes& values) const;
00390 
00391         PangoLanguage* get_language() const;
00398 
00399         bool is_end() const;
00405 
00406         bool is_start() const;
00410 
00411         bool equal(const TextIter& other) const;
00419 
00420         int compare(const TextIter& other) const;
00428 
00429         bool in_range(const TextIter& start, const TextIter& end);
00435 
00436         bool operator==(const TextIter& other) const;
00439 
00440         bool operator!=(const TextIter& other) const;
00443 
00444         bool operator<(const TextIter& other) const;
00447 
00448         bool operator>(const TextIter& other) const;
00451 
00452         bool operator<=(const TextIter& other) const;
00455 
00456         bool operator>=(const TextIter& other) const;
00459 
00461 
00462         static String get_slice(const TextIter& start, const TextIter& end);
00474 
00475         static String get_text(const TextIter& start, const TextIter& end);
00484 
00485         static String get_visible_slice(const TextIter& start, const TextIter& end);
00493 
00494         static String get_visible_text(const TextIter& start, const TextIter& end);
00502 
00503         static void order(const TextIter& first, const TextIter& second);
00512 
00515 
00516         bool forward_char();
00524 
00525         bool backward_char();
00531         
00532         bool forward_chars(int count);
00541 
00542         bool backward_chars(int count);
00551         
00552         bool forward_line();
00559 
00560         bool backward_line();
00569 
00570         bool forward_lines(int count);
00580 
00581         bool backward_lines(int count);
00591 
00592         bool forward_word_end();
00599 
00600         bool backward_word_start();
00607 
00608         bool forward_word_ends(int count);
00612 
00613         bool backward_word_starts(int count);
00617 
00618         bool forward_sentence_end();
00625 
00626         bool backward_sentence_start();
00633 
00634         bool forward_sentence_ends(int count);
00640 
00641         bool backward_sentence_starts(int count);
00647 
00648         bool forward_cursor_position();
00660 
00661         bool backward_cursor_position();
00664 
00665         bool forward_cursor_positions(int count);
00669 
00670         bool backward_cursor_positions(int count);
00674         
00675         void set_offset(int char_offset);
00680 
00681         void set_line(int line_number);
00687 
00688         void set_line_offset(int char_on_line);
00695 
00696         void set_line_index(int byte_on_line);
00702 
00703         void set_visible_line_offset(int char_on_line);
00707 
00708         void set_visible_line_index(int byte_on_line);
00712 
00713         void forward_to_end();
00717 
00718         bool forward_to_line_end();
00728 
00729         bool forward_to_tag_toggle(const TextTag *tag = 0);
00739         
00740         bool backward_to_tag_toggle(const TextTag *tag = 0);
00750 
00751         bool forward_find_char(const TextCharPredicate *predicate, const TextIter *limit = 0);
00760 
00761         bool backward_find_char(const TextCharPredicate *predicate, const TextIter *limit = 0);
00766 
00767         bool forward_search(const char *str, const TextIter *limit = 0);
00768         bool forward_search(const String& str, const TextIter *limit = 0);
00779 
00780         bool forward_search(const char *str, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00781         bool forward_search(const String& str, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00795 
00796         bool forward_search(const char *str, TextSearchFlagsField flags, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00797         bool forward_search(const String& str, TextSearchFlagsField flags, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00816 
00817         bool backward_search(const char * str, const TextIter *limit = 0);
00818         bool backward_search(const String& str, const TextIter *limit = 0);
00827 
00828         bool backward_search(const char * str, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00829         bool backward_search(const String& str, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00840         
00841         bool backward_search(const char *str, TextSearchFlagsField flags, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00842         bool backward_search(const String& str, TextSearchFlagsField flags, TextIter *match_start, TextIter *match_end, const TextIter *limit = 0);
00850         
00851         TextIter operator+(int chars) const;
00856 
00857         TextIter operator-(int chars) const;
00862 
00863         TextIter& operator+=(int chars);
00867 
00868         TextIter& operator-=(int chars);
00872 
00873         TextIter& operator++();
00875 
00876         TextIter& operator--();
00878 
00879         TextIter operator++(int);
00881 
00882         TextIter operator--(int);
00884 
00886 };
00887 
00888 } // namespace Gtk
00889 
00890 } // namespace Inti
00891 
00892 #endif // INTI_GTK_TEXT_ITER_H
00893 
Main Page - Footer


Generated on Sun Sep 14 20:08:04 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002