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

# layout.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 200-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
    00027
    00028 #ifndef INTI_PANGO_LAYOUT_H
    00029 #define INTI_PANGO_LAYOUT_H
    00030
    00031 #ifndef INTI_PANGO_ATTRIBUTES_H
    00032 #include <inti/pango/attributes.h>
    00033 #endif
    00034
    00035 #ifndef INTI_PANGO_CONTEXT_H
    00036 #include <inti/pango/context.h>
    00037 #endif
    00038
    00039 #ifndef INTI_PANGO_ITEM_H
    00040 #include <inti/pango/item.h>
    00041 #endif
    00042
    00043 #ifndef INTI_PANGO_TABS_H
    00044 #include <inti/pango/tabs.h>
    00045 #endif
    00046
    00047 #ifndef __PANGO_LAYOUT_H__
    00048 #include <pango/pango-layout.h>
    00049 #endif
    00050
    00051 #ifndef _CPP_UTILITY
    00052 #include <utility>
    00053 #endif
    00054
    00055 namespace Inti {
    00056
    00057 namespace Gdk {
    00058 class Region;
    00059 }
    00060
    00061 namespace Pango {
    00062
    00063 class LogAttr;
    00064 class GlyphString;
    00065
    00070
    00071 enum Alignment
    00072 {
    00073         ALIGN_LEFT = PANGO_ALIGN_LEFT,
    00074         ALIGN_CENTER = PANGO_ALIGN_CENTER,
    00075         ALIGN_RIGHT = PANGO_ALIGN_RIGHT
    00076 };
    00077
    00080
    00081 enum WrapMode
    00082 {
    00083         WRAP_WORD = PANGO_WRAP_WORD,
    00085
    00086         WRAP_CHAR = PANGO_WRAP_CHAR,
    00088
    00089         WRAP_WORD_CHAR = PANGO_WRAP_WORD_CHAR
    00092 };
    00093
    00101
    00102 class LayoutRun
    00103 {
    00104         PangoLayoutRun run_;
    00105
    00106 public:
    00109
    00110         PangoLayoutRun* pango_layout_run() const { return const_cast<PangoLayoutRun*>(&run_); }
    00112
    00113         Pointer<Item> item() const;
    00115
    00116         Pointer<GlyphString> glyphs() const;
    00118
    00120 };
    00121
    00130
    00131 class LayoutLine : public ReferencedObject
    00132 {
    00133         PangoLayoutLine *layout_line_;
    00134
    00135 public:
    00138
    00139         explicit LayoutLine(PangoLayoutLine *layout_line);
    00142
    00143         LayoutLine(const LayoutLine& src);
    00146
    00147         ~LayoutLine();
    00149
    00150         LayoutLine& operator=(const LayoutLine& src);
    00153
    00157
    00158         PangoLayoutLine* pango_layout_line() const { return layout_line_; }
    00160
    00161         operator PangoLayoutLine* () const;
    00163
    00164         int start_index() const;
    00166
    00167         int length() const;
    00169
    00170         std::vector<std::pair<int, int> > get_x_ranges(int start_index, int end_index) const;
    00206
    00207         void get_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00216
    00217         void get_pixel_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00228
    00229         Pointer<Gdk::Region> get_clip_region(int x_origin, int y_origin, const std::vector<std::pair<int, int> >& index_ranges) const;
    00248
    00252
    00253         bool x_to_index(int x_pos, int *index, int *trailing);
    00265
    00266         int index_to_x(int index, bool trailing);
    00271
    00273 };
    00274
    00279
    00280 class LayoutIter : public ReferencedObject
    00281 {
    00282         LayoutIter(const LayoutIter&);
    00283         LayoutIter& operator=(const LayoutIter&);
    00284
    00285         PangoLayoutIter *iter_;
    00286
    00287 public:
    00290
    00291         explicit LayoutIter(PangoLayoutIter *iter);
    00297
    00298         ~LayoutIter();
    00300
    00304
    00305         PangoLayoutIter* pango_layout_iter() const { return (PangoLayoutIter*)iter_; }
    00307
    00308         operator PangoLayoutIter* () const;
    00310
    00311         int get_index() const;
    00318
    00319         LayoutRun* get_run() const;
    00326
    00327         Pointer<LayoutLine> get_line() const;
    00329
    00330         bool at_last_line() const;
    00332
    00333         void get_char_extents(Rectangle& logical_rect) const;
    00341
    00342         Rectangle get_char_extents() const;
    00345
    00346         void get_cluster_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00351
    00352         void get_run_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00357
    00358         void get_line_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00368
    00369         void get_line_yrange(int *y0, int *y1) const;
    00379
    00380         void get_layout_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00387
    00388         int get_baseline() const;
    00392
    00396
    00397         bool next_char();
    00402
    00403         bool next_cluster();
    00408
    00409         bool next_run();
    00414
    00415         bool next_line();
    00420
    00422 };
    00423
    00449
    00450 class Layout : public G::Object
    00451 {
    00452         friend class G::Object;
    00453
    00454         Layout(const Layout&);
    00455         Layout& operator=(const Layout&);
    00456
    00457 protected:
    00460
    00461         explicit Layout(PangoLayout *layout, bool reference = true);
    00468
    00470
    00471 public:
    00474
    00475         explicit Layout(const Context& context);
    00479
    00480         virtual ~Layout();
    00482
    00486
    00487         PangoLayout* pango_layout() const { return (PangoLayout*)instance; }
    00489
    00490         PangoLayoutClass* pango_layout_class() const;
    00492
    00493         operator PangoLayout* () const;
    00495
    00496         Context* get_context() const;
    00500
    00501         Pointer<AttrList> get_attributes() const;
    00503
    00504         String get_text() const;
    00507
    00508         int get_width() const;
    00511
    00512         WrapMode get_wrap() const;
    00514
    00515         int get_indent() const;
    00517
    00518         int get_spacing() const;
    00520
    00521         bool get_justify() const;
    00524
    00525         Alignment get_alignment() const;
    00529
    00530         Pointer<TabArray> get_tabs() const;
    00536
    00537         bool get_single_paragraph_mode() const;
    00540
    00541         bool get_logical_attributes(std::vector<LogAttr>& attrs) const;
    00547
    00548         void get_cursor_pos(int index, Rectangle *strong_pos, Rectangle *weak_pos) const;
    00560
    00561         void get_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00571
    00572         void get_pixel_extents(Rectangle *ink_rect, Rectangle *logical_rect) const;
    00581
    00582         void get_size(int *width, int *height) const;
    00589
    00590         void get_pixel_size(int *width, int *height) const;
    00597
    00598         int get_line_count() const;
    00601
    00602         Pointer<LayoutLine> get_line(int line) const;
    00608
    00609         bool get_lines(std::vector<Pointer<LayoutLine> >& lines) const;
    00615
    00616         Pointer<LayoutIter> get_iter() const;
    00619
    00620         Pointer<Gdk::Region> get_clip_region(int x_origin, int y_origin, const std::vector<std::pair<int, int> >& index_ranges) const;
    00651
    00655
    00656         void set_attributes(AttrList& attrs);
    00659
    00660         void set_text(const String& text);
    00663
    00664         void set_markup(const String& markup);
    00671
    00672         void set_markup(const String& markup, gunichar accel_marker, gunichar *accel_char);
    00686
    00687         void set_font_description(const FontDescription *desc);
    00693
    00694         void set_width(int width);
    00697
    00698         void set_wrap(WrapMode wrap);
    00704
    00705         void set_indent(int indent);
    00712
    00713         void set_spacing(int spacing);
    00716
    00717         void set_justify(bool justify);
    00724
    00725         void set_alignment(Alignment alignment);
    00729
    00730         void set_tabs(TabArray *tabs);
    00738
    00739         void set_single_paragraph_mode(bool setting);
    00746
    00747         void context_changed();
    00751
    00752         void index_to_pos(int index, Rectangle& pos);
    00762
    00763         void move_cursor_visually(bool strong, int old_index, int old_trailing, int direction, int *new_index, int *new_trailing);
    00794
    00795         bool xy_to_index(int x, int y, int *index, int *trailing);
    00811
    00813 };
    00814
    00815 } // namespace Pango
    00816
    00817 } // namespace Inti
    00818
    00819 #endif // INTI_PANGO_LAYOUT_H
    00820

Main Page - Footer