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

layout.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 00027 00028 #ifndef GFC_PANGO_LAYOUT_HH 00029 #define GFC_PANGO_LAYOUT_HH 00030 00031 #ifndef GFC_PANGO_ATTRIBUTES_HH 00032 #include <gfc/pango/attributes.hh> 00033 #endif 00034 00035 #ifndef GFC_PANGO_CONTEXT_HH 00036 #include <gfc/pango/context.hh> 00037 #endif 00038 00039 #ifndef GFC_PANGO_ITEM_HH 00040 #include <gfc/pango/item.hh> 00041 #endif 00042 00043 #ifndef GFC_PANGO_TABS_HH 00044 #include <gfc/pango/tabs.hh> 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 GFC { 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; 00112 00113 Pointer<Item> item() const; 00115 00116 Pointer<GlyphString> glyphs() const; 00118 00120 }; 00121 00130 00131 class LayoutLine : public GFC::Object 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; 00160 00161 operator PangoLayoutLine* () const; 00163 00164 int start_index() const; 00166 00167 int length() const; 00169 00170 bool is_paragraph_start() const; 00173 00174 std::vector<std::pair<int, int> > get_x_ranges(int start_index, int end_index) const; 00210 00211 void get_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00220 00221 void get_pixel_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00232 00233 Pointer<Gdk::Region> get_clip_region(int x_origin, int y_origin, const std::vector<std::pair<int, int> >& index_ranges) const; 00252 00256 00257 bool x_to_index(int x_pos, int *index, int *trailing); 00269 00270 int index_to_x(int index, bool trailing); 00275 00277 }; 00278 00283 00284 class LayoutIter : public GFC::Object 00285 { 00286 LayoutIter(const LayoutIter&); 00287 LayoutIter& operator=(const LayoutIter&); 00288 00289 PangoLayoutIter *iter_; 00290 00291 public: 00294 00295 explicit LayoutIter(PangoLayoutIter *iter); 00301 00302 ~LayoutIter(); 00304 00308 00309 PangoLayoutIter* pango_layout_iter() const; 00311 00312 operator PangoLayoutIter* () const; 00314 00315 int get_index() const; 00322 00323 LayoutRun* get_run() const; 00330 00331 Pointer<LayoutLine> get_line() const; 00333 00334 bool at_last_line() const; 00336 00337 void get_char_extents(Rectangle& logical_rect) const; 00345 00346 Rectangle get_char_extents() const; 00349 00350 void get_cluster_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00355 00356 void get_run_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00361 00362 void get_line_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00372 00373 void get_line_yrange(int *y0, int *y1) const; 00383 00384 void get_layout_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00391 00392 int get_baseline() const; 00396 00400 00401 bool next_char(); 00406 00407 bool next_cluster(); 00412 00413 bool next_run(); 00418 00419 bool next_line(); 00424 00426 }; 00427 00453 00454 class Layout : public G::Object 00455 { 00456 friend class G::Object; 00457 00458 Layout(const Layout&); 00459 Layout& operator=(const Layout&); 00460 00461 protected: 00464 00465 explicit Layout(PangoLayout *layout, bool owns_reference = true); 00472 00474 00475 public: 00478 00479 explicit Layout(const Context& context); 00483 00484 virtual ~Layout(); 00486 00490 00491 PangoLayout* pango_layout() const; 00493 00494 operator PangoLayout* () const; 00496 00497 Context* get_context() const; 00501 00502 Pointer<AttrList> get_attributes() const; 00504 00505 String get_text() const; 00508 00509 int get_width() const; 00512 00513 WrapMode get_wrap() const; 00515 00516 int get_indent() const; 00518 00519 int get_spacing() const; 00521 00522 bool get_justify() const; 00525 00526 bool get_auto_dir() const; 00530 00531 Alignment get_alignment() const; 00535 00536 Pointer<TabArray> get_tabs() const; 00542 00543 bool get_single_paragraph_mode() const; 00546 00547 bool get_logical_attributes(std::vector<LogAttr>& attrs) const; 00553 00554 void get_cursor_pos(int index, Rectangle *strong_pos, Rectangle *weak_pos) const; 00566 00567 void get_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00577 00578 void get_pixel_extents(Rectangle *ink_rect, Rectangle *logical_rect) const; 00587 00588 void get_size(int *width, int *height) const; 00595 00596 void get_pixel_size(int *width, int *height) const; 00603 00604 int get_line_count() const; 00607 00608 Pointer<LayoutLine> get_line(int line) const; 00614 00615 bool get_lines(std::vector<Pointer<LayoutLine> >& lines) const; 00621 00622 Pointer<LayoutIter> get_iter() const; 00625 00626 Pointer<Gdk::Region> get_clip_region(int x_origin, int y_origin, const std::vector<std::pair<int, int> >& index_ranges) const; 00657 00661 00662 void set_attributes(AttrList& attrs); 00665 00666 void set_text(const char *text); 00667 void set_text(const String& text); 00670 00671 void set_markup(const char *markup); 00672 void set_markup(const String& markup); 00679 00680 void set_markup(const char *markup, gunichar accel_marker, gunichar *accel_char); 00681 void set_markup(const String& markup, gunichar accel_marker, gunichar *accel_char); 00695 00696 void set_font_description(const FontDescription *desc); 00702 00703 void set_width(int width); 00706 00707 void set_wrap(WrapMode wrap); 00713 00714 void set_indent(int indent); 00721 00722 void set_spacing(int spacing); 00725 00726 void set_justify(bool justify); 00733 00734 void set_auto_dir(bool auto_dir); 00752 00753 void set_alignment(Alignment alignment); 00757 00758 void set_tabs(TabArray *tabs); 00766 00767 void set_single_paragraph_mode(bool setting); 00774 00775 void context_changed(); 00779 00780 void index_to_pos(int index, Rectangle& pos); 00790 00791 void move_cursor_visually(bool strong, int old_index, int old_trailing, int direction, int *new_index, int *new_trailing); 00822 00823 bool xy_to_index(int x, int y, int *index, int *trailing); 00839 00841 }; 00842 00843 } // namespace Pango 00844 00845 } // namespace GFC 00846 00847 #include <gfc/pango/inline/layout.inl> 00848 00849 #endif // GFC_PANGO_LAYOUT_HH 00850

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