Reference Manual

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

# textview.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 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
    00024
    00025 #ifndef INTI_GTK_TEXT_VIEW_H
    00026 #define INTI_GTK_TEXT_VIEW_H
    00027
    00028 #ifndef INTI_GTK_CONTAINER_H
    00029 #include <inti/gtk/container.h>
    00030 #endif
    00031
    00032 #ifndef INTI_GTK_TEXT_BUFFER_H
    00033 #include <inti/gtk/textbuffer.h>
    00034 #endif
    00035
    00036 #ifndef GTK_TEXT_VIEW_H
    00037 #include <gtk/gtktextview.h>
    00038 #endif
    00039
    00040 namespace Inti {
    00041
    00042 namespace Pango {
    00043 class TabArray;
    00044 }
    00045
    00046 namespace Gtk {
    00047
    00048 class Menu;
    00049 class TextViewClass;
    00050
    00055
    00056 enum TextWindowType
    00057 {
    00058         TEXT_WINDOW_PRIVATE = GTK_TEXT_WINDOW_PRIVATE,
    00059         TEXT_WINDOW_WIDGET = GTK_TEXT_WINDOW_WIDGET,
    00060         TEXT_WINDOW_TEXT = GTK_TEXT_WINDOW_TEXT,
    00061         TEXT_WINDOW_LEFT = GTK_TEXT_WINDOW_LEFT,
    00062         TEXT_WINDOW_RIGHT = GTK_TEXT_WINDOW_RIGHT,
    00063         TEXT_WINDOW_TOP = GTK_TEXT_WINDOW_TOP,
    00064         TEXT_WINDOW_BOTTOM = GTK_TEXT_WINDOW_BOTTOM
    00065 };
    00066
    00076
    00077 class TextView : public Container
    00078 {
    00079         friend class G::Object;
    00080         friend class TextViewClass;
    00081
    00082         TextView(const TextView&);
    00083         TextView& operator=(const TextView&);
    00084
    00085 protected:
    00088
    00089         explicit TextView(GtkTextView *text_view, bool reference = false);
    00096
    00100
    00101         virtual void on_set_scroll_adjustments(Adjustment *hadjustment, Adjustment *vadjustment);
    00105
    00106         virtual void on_populate_popup(Menu& menu);
    00109
    00110         virtual void on_set_anchor();
    00112
    00113         virtual void on_insert_at_cursor(const String& str);
    00116
    00118 //  Properties
    00119
    00120         typedef G::Property<int> PixelsAboveLinesPropertyType;
    00121         typedef G::PropertyProxy<G::Object, PixelsAboveLinesPropertyType> PixelsAboveLinesPropertyProxy;
    00122         static const PixelsAboveLinesPropertyType pixels_above_lines_property;
    00123
    00124         typedef G::Property<int> PixelsBelowLinesPropertyType;
    00125         typedef G::PropertyProxy<G::Object, PixelsBelowLinesPropertyType> PixelsBelowLinesPropertyProxy;
    00126         static const PixelsBelowLinesPropertyType pixels_below_lines_property;
    00127
    00128         typedef G::Property<int> PixelsInsideWrapPropertyType;
    00129         typedef G::PropertyProxy<G::Object, PixelsInsideWrapPropertyType> PixelsInsideWrapPropertyProxy;
    00130         static const PixelsInsideWrapPropertyType pixels_inside_wrap_property;
    00131
    00132         typedef G::Property<bool> EditablePropertyType;
    00133         typedef G::PropertyProxy<G::Object, EditablePropertyType> EditablePropertyProxy;
    00134         static const EditablePropertyType editable_property;
    00135
    00136         typedef G::Property<bool> WrapModePropertyType;
    00137         typedef G::PropertyProxy<G::Object, WrapModePropertyType> WrapModePropertyProxy;
    00138         static const WrapModePropertyType wrap_mode_property;
    00139
    00140         typedef G::Property<Justification, int> JustificationPropertyType;
    00141         typedef G::PropertyProxy<G::Object, JustificationPropertyType> JustificationPropertyProxy;
    00142         static const JustificationPropertyType justification_property;
    00143
    00144         typedef G::Property<int> LeftMarginPropertyType;
    00145         typedef G::PropertyProxy<G::Object, LeftMarginPropertyType> LeftMarginPropertyProxy;
    00146         static const LeftMarginPropertyType left_margin_property;
    00147
    00148         typedef G::Property<int> RightMarginPropertyType;
    00149         typedef G::PropertyProxy<G::Object, RightMarginPropertyType> RightMarginPropertyProxy;
    00150         static const RightMarginPropertyType right_margin_property;
    00151
    00152         typedef G::Property<int> IndentPropertyType;
    00153         typedef G::PropertyProxy<G::Object, IndentPropertyType> IndentPropertyProxy;
    00154         static const IndentPropertyType indent_property;
    00155
    00156         typedef G::Property<Pointer<Pango::TabArray> > TabsPropertyType;
    00157         typedef G::PropertyProxy<G::Object, TabsPropertyType> TabsPropertyProxy;
    00158         static const TabsPropertyType tabs_property;
    00159
    00160         typedef G::Property<bool> CursorVisiblePropertyType;
    00161         typedef G::PropertyProxy<G::Object, CursorVisiblePropertyType> CursorVisiblePropertyProxy;
    00162         static const CursorVisiblePropertyType cursor_visible_property;
    00163
    00164 //  Signals
    00165
    00166         typedef G::Signal2<void, GtkAdjustment*, GtkAdjustment*> SetScrollAdjustmentsSignalType;
    00167         typedef G::SignalProxy<TypeInstance, SetScrollAdjustmentsSignalType> SetScrollAdjustmentsSignalProxy;
    00168         static const SetScrollAdjustmentsSignalType set_scroll_adjustments_signal;
    00169
    00170         typedef G::Signal1<void, GtkMenu*> PopulatePopupSignalType;
    00171         typedef G::SignalProxy<TypeInstance, PopulatePopupSignalType> PopulatePopupSignalProxy;
    00172         static const PopulatePopupSignalType populate_popup_signal;
    00173
    00174         typedef G::Signal0<void> SetAnchorSignalType;
    00175         typedef G::SignalProxy<TypeInstance, SetAnchorSignalType> SetAnchorSignalProxy;
    00176         static const SetAnchorSignalType set_anchor_signal;
    00177
    00178         typedef G::Signal1<void, const char*> InsertAtCursorSignalType;
    00179         typedef G::SignalProxy<TypeInstance, InsertAtCursorSignalType> InsertAtCursorSignalProxy;
    00180         static const InsertAtCursorSignalType insert_at_cursor_signal;
    00181
    00182 public:
    00185
    00186         TextView();
    00190
    00191         explicit TextView(TextBuffer& buffer);
    00197
    00198         virtual ~TextView();
    00200
    00204
    00205         GtkTextView* gtk_text_view() const { return (GtkTextView*)instance; }
    00207
    00208         GtkTextViewClass* gtk_text_view_class() const;
    00210
    00211         operator GtkTextView* () const;
    00213
    00214         TextBuffer* get_buffer() const;
    00217
    00218         void get_visible_rect(Gdk::Rectangle& visible_rect);
    00224
    00225         Gdk::Rectangle get_visible_rect() const;
    00228
    00229         bool get_cursor_visible() const;
    00232
    00233         void get_iter_location(const TextIter& iter, Gdk::Rectangle& location);
    00240
    00241         Gdk::Rectangle get_iter_location(const TextIter& iter) const;
    00247
    00248         TextIter get_iter_at_location(int x, int y) const;
    00257
    00258         void get_line_yrange(const TextIter& iter, int *y, int *height) const;
    00267
    00268         int get_line_y(const TextIter& iter) const;
    00272
    00273         int get_line_height(const TextIter& iter) const;
    00277
    00278         void get_line_at_y(TextIter& target_iter, int y, int *line_top) const;
    00287
    00288         TextIter get_line_at_y(int y) const;
    00294
    00295         Gdk::Window* get_window(TextWindowType window_type) const;
    00304
    00305         TextWindowType get_window_type(const Gdk::Window& window) const;
    00312
    00313         int get_border_window_size(TextWindowType type) const;
    00317
    00318         WrapMode get_wrap_mode() const;
    00321
    00322         bool get_editable() const;
    00327
    00328         int get_pixels_above_lines() const;
    00331
    00332         int get_pixels_below_lines() const;
    00335
    00336         int get_pixels_inside_wrap() const;
    00339
    00340         Justification get_justification() const;
    00343
    00344         int get_left_margin() const;
    00347
    00348         int get_right_margin() const;
    00351
    00352         int get_indent() const;
    00357
    00358         Pointer<Pango::TabArray> get_tabs() const;
    00364
    00365         Pointer<TextAttributes> get_default_attributes() const;
    00372
    00376
    00377         void set_buffer(TextBuffer *buffer);
    00384
    00385         bool scroll_to_iter(const TextIter& iter, double within_margin, bool use_align, double xalign, double yalign);
    00404
    00405         void scroll_to_mark(const TextMark& mark, double within_margin, bool use_align, double xalign, double yalign);
    00418
    00419         void scroll_mark_onscreen(const TextMark& mark);
    00423
    00424         bool move_mark_onscreen(const TextMark& mark);
    00428
    00429         bool place_cursor_onscreen();
    00432
    00433         void set_cursor_visible(bool setting);
    00439
    00440         void buffer_to_window_coords(TextWindowType window_type, int buffer_x, int buffer_y, int *window_x, int *window_y);
    00450
    00451         void window_to_buffer_coords(TextWindowType window_type, int window_x, int window_y, int *buffer_x, int *buffer_y);
    00461
    00462         void set_border_window_size(TextWindowType window_type, int size);
    00472
    00473         bool forward_display_line(TextIter& iter);
    00484
    00485         bool backward_display_line(TextIter& iter);
    00496
    00497         bool forward_display_line_end(TextIter& iter);
    00508
    00509         bool backward_display_line_start(TextIter& iter);
    00520
    00521         bool starts_display_line(const TextIter& iter);
    00526
    00527         bool move_visually(TextIter& iter, int count);
    00533
    00534         void add_child_at_anchor(Widget& child, TextChildAnchor& anchor);
    00538
    00539         void add_child_in_window(Widget& child, TextWindowType which_window, int xpos, int ypos);
    00557
    00558         void move_child(const Widget& child, int xpos, int ypos);
    00563
    00564         void set_wrap_mode(WrapMode wrap_mode);
    00567
    00568         void set_editable(bool setting);
    00572
    00573         void set_pixels_above_lines(int pixels_above_lines);
    00578
    00579         void set_pixels_below_lines(int pixels_below_lines);
    00584
    00585         void set_pixels_inside_wrap(int pixels_inside_wrap);
    00591
    00592         void set_justification(Justification justification);
    00597
    00598         void set_left_margin(int left_margin);
    00603
    00604         void set_right_margin(int right_margin);
    00609
    00610         void set_indent(int indent);
    00615
    00616         void set_tabs(const Pango::TabArray& tabs);
    00621
    00625
    00626         const PixelsAboveLinesPropertyProxy prop_pixels_above_lines()
    00627         {
    00628                 return PixelsAboveLinesPropertyProxy(this, &pixels_above_lines_property);
    00629         }
    00631
    00632         const PixelsBelowLinesPropertyProxy prop_pixels_below_lines()
    00633         {
    00634                 return PixelsBelowLinesPropertyProxy(this, &pixels_below_lines_property);
    00635         }
    00637
    00638         const PixelsInsideWrapPropertyProxy prop_pixels_inside_wrap()
    00639         {
    00640                 return PixelsInsideWrapPropertyProxy(this, &pixels_inside_wrap_property);
    00641         }
    00643
    00644         const EditablePropertyProxy prop_editable()
    00645         {
    00646                 return EditablePropertyProxy(this, &editable_property);
    00647         }
    00649
    00650         const WrapModePropertyProxy prop_wrap_mode()
    00651         {
    00652                 return WrapModePropertyProxy(this, &wrap_mode_property);
    00653         }
    00655
    00656         const JustificationPropertyProxy prop_justification()
    00657         {
    00658                 return JustificationPropertyProxy(this, &justification_property);
    00659         }
    00661
    00662         const LeftMarginPropertyProxy prop_left_margin()
    00663         {
    00664                 return LeftMarginPropertyProxy(this, &left_margin_property);
    00665         }
    00667
    00668         const RightMarginPropertyProxy prop_right_margin()
    00669         {
    00670                 return RightMarginPropertyProxy(this, &right_margin_property);
    00671         }
    00673
    00674         const IndentPropertyProxy prop_indent()
    00675         {
    00676                 return IndentPropertyProxy(this, &indent_property);
    00677         }
    00679
    00680         const TabsPropertyProxy prop_tabs()
    00681         {
    00682                 return TabsPropertyProxy(this, &tabs_property);
    00683         }
    00685
    00686         const CursorVisiblePropertyProxy prop_cursor_visible()
    00687         {
    00688                 return CursorVisiblePropertyProxy(this, &cursor_visible_property);
    00689         }
    00691
    00695
    00696         const SetScrollAdjustmentsSignalProxy sig_set_scroll_adjustments()
    00697         {
    00698                 return SetScrollAdjustmentsSignalProxy(this, &set_scroll_adjustments_signal);
    00699         }
    00702
    00703         const PopulatePopupSignalProxy sig_populate_popup()
    00704         {
    00705                 return PopulatePopupSignalProxy(this, &populate_popup_signal);
    00706         }
    00708
    00709         const SetAnchorSignalProxy sig_set_anchor()
    00710         {
    00711                 return SetAnchorSignalProxy(this, &set_anchor_signal);
    00712         }
    00715
    00716         const InsertAtCursorSignalProxy sig_insert_at_cursor()
    00717         {
    00718                 return InsertAtCursorSignalProxy(this, &insert_at_cursor_signal);
    00719         }
    00722
    00724 };
    00725
    00726 } // namespace Gtk
    00727
    00728 } // namespace Inti
    00729
    00730 #endif // INTI_GTK_TEXT_VIEW_H
    00731
    00732

Main Page - Footer