/usr/include/pangomm-1.4/pangomm/layout.h is in libpangomm-1.4-dev 2.34.0-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | // -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _PANGOMM_LAYOUT_H
#define _PANGOMM_LAYOUT_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
/* $Id: layout.hg,v 1.9 2006/06/08 20:39:39 murrayc Exp $ */
/* layout.h
*
* Copyright(C) 1998-1999 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/slisthandle.h>
#include <pangomm/font.h>
#include <pangomm/fontdescription.h>
#include <pangomm/context.h>
#include <pangomm/attrlist.h>
#include <pangomm/tabarray.h>
#include <pangomm/layoutline.h>
#include <pangomm/layoutiter.h>
#include <pango/pango-layout.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _PangoLayout PangoLayout;
typedef struct _PangoLayoutClass PangoLayoutClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Pango
{ class Layout_Class; } // namespace Pango
namespace Pango
{
/** @addtogroup pangommEnums pangomm Enums and Flags */
/**
*
* @ingroup pangommEnums
*/
enum Alignment
{
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT
};
} // namespace Pango
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Pango::Alignment> : public Glib::Value_Enum<Pango::Alignment>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Pango
{
/**
*
* @ingroup pangommEnums
*/
enum WrapMode
{
WRAP_WORD,
WRAP_CHAR,
WRAP_WORD_CHAR
};
} // namespace Pango
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Pango::WrapMode> : public Glib::Value_Enum<Pango::WrapMode>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Pango
{
/**
*
* @ingroup pangommEnums
*/
enum EllipsizeMode
{
ELLIPSIZE_NONE,
ELLIPSIZE_START,
ELLIPSIZE_MIDDLE,
ELLIPSIZE_END
};
} // namespace Pango
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Pango::EllipsizeMode> : public Glib::Value_Enum<Pango::EllipsizeMode>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Pango
{
/** A Pango::Layout represents an entire paragraph of text.
* It is initialized with a Pango::Context, UTF-8 string and set of attributes for that string.
* Once that is done, the set of formatted lines can be extracted from the object,
* the layout can be rendered, and conversion between logical character positions
* within the layout's text, and the physical position of the resulting glyphs can be made.
*/
class Layout : public Glib::Object
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef Layout CppObjectType;
typedef Layout_Class CppClassType;
typedef PangoLayout BaseObjectType;
typedef PangoLayoutClass BaseClassType;
private: friend class Layout_Class;
static CppClassType layout_class_;
private:
// noncopyable
Layout(const Layout&);
Layout& operator=(const Layout&);
protected:
explicit Layout(const Glib::ConstructParams& construct_params);
explicit Layout(PangoLayout* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
virtual ~Layout();
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
PangoLayout* gobj() { return reinterpret_cast<PangoLayout*>(gobject_); }
///Provides access to the underlying C GObject.
const PangoLayout* gobj() const { return reinterpret_cast<PangoLayout*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
PangoLayout* gobj_copy();
private:
protected:
explicit Layout(const Glib::RefPtr<Context>& context);
public:
static Glib::RefPtr<Layout> create(const Glib::RefPtr<Context>& context);
/** Creates a layout object set up to match the current transformation
* and target surface of the Cairo context. This layout can then be
* used for text measurement with functions like
* get_size() or drawing with methods like show_in_cairo_contet().
* If you change the transformation or target surface for @a context,
* you need to call update_from_cairo_context()
*
* This is the most convenient way to use Cairo with Pango.
* However it is slightly inefficient since it creates a separate
* Pango Context object for each layout. This might matter in an
* application that is laying out large amounts of text.
*
* @param context A Cairo context.
* @result The newly created Pango Layout.
*/
static Glib::RefPtr<Layout> create(const Cairo::RefPtr<Cairo::Context>& context);
/** Updates the private Pango Context of a Pango Layout created with
* create(const Cairo::RefPtr<Cairo::Context>&) to match the current transformation
* and target surface of a Cairo Context.
*
* @param context A Cairo context.
*/
void update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
/** Does a deep copy-by-value of the @a src layout. The attribute list,
* tab array, and text from the original layout are all copied by
* value.
* @return The newly allocated Pango::Layout, with a reference
* count of one, which should be freed with
* Glib::object_unref().
*/
Glib::RefPtr<Layout> copy();
/** Retrieves the Pango::Context used for this layout.
* @return The Pango::Context for the layout. This does not
* have an additional refcount added, so if you want to keep
* a copy of this around, you must reference it yourself.
*/
Glib::RefPtr<Context> get_context() const;
/** Sets the text attributes for a layout object.
* References @a attrs, so the caller can unref its reference.
* @param attrs A Pango::AttrList, can be <tt>0</tt>.
*/
void set_attributes(AttrList& attrs);
/** Gets the attribute list for the layout, if any.
* @return A Pango::AttrList.
*/
AttrList get_attributes() const;
/** Set the text of the layout.
* @param text The text for the layout.
*/
void set_text(const Glib::ustring& text);
/** Gets the text in the layout. The returned text should not
* be freed or modified.
* @return The text in the @a layout.
*/
Glib::ustring get_text() const;
/** Sets the layout text and attribute list from marked-up text (see markup format).
* Replaces the current text and attribute list.
* @param markup Some marked-up text.
*/
void set_markup(const Glib::ustring& markup);
/** Sets the layout text and attribute list from marked-up text (see markup format).
* Replaces the current text and attribute list.
*
* If @a accel_marker is nonzero, the given character will mark the character following
* it as an accelerator. For example, the accel marker might be an ampersand or
* underscore. All characters marked as an accelerator will receive a
* Pango::UNDERLINE_LOW attribute, and the first character so marked will be returned
* in @a accel_char. Two @a accel_marker characters following each other produce a
* single literal @a accel_marker character.
* @param markup Some marked-up text.
* @param accel_marker Marker for accelerators in the text.
* @param accel_char Return location for any located accelerators.
*/
void set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char);
/** Set the default font description for the layout. If no font
* description is set on the layout, the font description from
* the layout's context is used.
* @param desc The new pango font description.
*/
void set_font_description(const FontDescription& desc);
void unset_font_description();
/** Gets the font description for the layout, if any.
*
* @newin{1,8}
* @return A pointer to the layout's font description,
* or <tt>0</tt> if the font description from the layout's
* context is inherited. This value is owned by the layout
* and must not be modified or freed.
*/
FontDescription get_font_description() const;
/** Sets the width to which the lines of the Pango::Layout should wrap or
* ellipsized. The default value is -1: no width set.
* @param width The desired width in Pango units, or -1 to indicate that no
* wrapping or ellipsization should be performed.
*/
void set_width(int width);
/** Gets the width to which the lines of the Pango::Layout should wrap.
* @return The width in Pango units, or -1 if no width set.
*/
int get_width() const;
/** Sets the height to which the Pango::Layout should be ellipsized at. There
* are two different behaviors, based on whether @a height is positive or
* negative.
*
* If @a height is positive, it will be the maximum height of the layout. Only
* lines would be shown that would fit, and if there is any text omitted,
* an ellipsis added. At least one line is included in each paragraph regardless
* of how small the height value is. A value of zero will render exactly one
* line for the entire layout.
*
* If @a height is negative, it will be the (negative of) maximum number of lines per
* paragraph. That is, the total number of lines shown may well be more than
* this value if the layout contains multiple paragraphs of text.
* The default value of -1 means that first line of each paragraph is ellipsized.
* This behvaior may be changed in the future to act per layout instead of per
* paragraph. File a bug against pango at http://bugzilla.gnome.org/ if your
* code relies on this behavior.
*
* Height setting only has effect if a positive width is set on
* @a layout and ellipsization mode of @a layout is not Pango::ELLIPSIZE_NONE.
* The behavior is undefined if a height other than -1 is set and
* ellipsization mode is set to Pango::ELLIPSIZE_NONE, and may change in the
* future.
*
* @newin{1,20}
* @param height The desired height of the layout in Pango units if positive,
* or desired number of lines if negative.
*/
void set_height(int height);
/** Gets the height of layout used for ellipsization. See
* set_height() for details.
*
* @newin{1,20}
* @return The height, in Pango units if positive, or
* number of lines if negative.
*/
int get_height() const;
/** Sets the wrap mode; the wrap mode only has effect if a width
* is set on the layout with set_width().
* To turn off wrapping, set the width to -1.
* @param wrap The wrap mode.
*/
void set_wrap(WrapMode wrap);
/** Gets the wrap mode for the layout.
*
* Use is_wrapped() to query whether any paragraphs
* were actually wrapped.
* @return Active wrap mode.
*/
WrapMode get_wrap() const;
/** Queries whether the layout had to wrap any paragraphs.
*
* This returns <tt>true</tt> if a positive width is set on @a layout,
* ellipsization mode of @a layout is set to Pango::ELLIPSIZE_NONE,
* and there are paragraphs exceeding the layout width that have
* to be wrapped.
*
* @newin{1,16}
* @return <tt>true</tt> if any paragraphs had to be wrapped, <tt>false</tt>
* otherwise.
*/
bool is_wrapped() const;
/** Sets the width in Pango units to indent each paragraph. A negative value
* of @a indent will produce a hanging indentation. That is, the first line will
* have the full width, and subsequent lines will be indented by the
* absolute value of @a indent.
*
* The indent setting is ignored if layout alignment is set to
* Pango::ALIGN_CENTER.
* @param indent The amount by which to indent.
*/
void set_indent(int indent);
/** Gets the paragraph indent width in Pango units. A negative value
* indicates a hanging indentation.
* @return The indent in Pango units.
*/
int get_indent() const;
/** Sets the amount of spacing in Pango unit between the lines of the
* layout.
* @param spacing The amount of spacing.
*/
void set_spacing(int spacing);
/** Gets the amount of spacing between the lines of the layout.
* @return The spacing in Pango units.
*/
int get_spacing() const;
/** Sets whether each complete line should be stretched to
* fill the entire width of the layout. This stretching is typically
* done by adding whitespace, but for some scripts (such as Arabic),
* the justification may be done in more complex ways, like extending
* the characters.
*
* Note that this setting is not implemented and so is ignored in Pango
* older than 1.18.
* @param justify Whether the lines in the layout should be justified.
*/
void set_justify(bool justify = true);
/** Gets whether each complete line should be stretched to fill the entire
* width of the layout.
* @return The justify.
*/
bool get_justify() const;
/** Gets whether to calculate the bidirectional base direction
* for the layout according to the contents of the layout.
* See set_auto_dir().
*
* @newin{1,4}
* @return <tt>true</tt> if the bidirectional base direction
* is computed from the layout's contents, <tt>false</tt> otherwise.
*/
bool get_auto_dir() const;
/** Sets whether to calculate the bidirectional base direction
* for the layout according to the contents of the layout;
* when this flag is on (the default), then paragraphs in
* @a layout that begin with strong right-to-left characters
* (Arabic and Hebrew principally), will have right-to-left
* layout, paragraphs with letters from other scripts will
* have left-to-right layout. Paragraphs with only neutral
* characters get their direction from the surrounding paragraphs.
*
* When <tt>false</tt>, the choice between left-to-right and
* right-to-left layout is done according to the base direction
* of the layout's Pango::Context. (See Pango::Context::set_base_dir()).
*
* When the auto-computed direction of a paragraph differs from the
* base direction of the context, the interpretation of
* Pango::ALIGN_LEFT and Pango::ALIGN_RIGHT are swapped.
*
* @newin{1,4}
* @param auto_dir If <tt>true</tt>, compute the bidirectional base direction
* from the layout's contents.
*/
void set_auto_dir(bool auto_dir = true);
/** Sets the alignment for the layout: how partial lines are
* positioned within the horizontal space available.
* @param alignment The alignment.
*/
void set_alignment(Alignment alignment);
/** Gets the alignment for the layout: how partial lines are
* positioned within the horizontal space available.
* @return The alignment.
*/
Alignment get_alignment() const;
/** Sets the tabs to use for @a layout, overriding the default tabs
* (by default, tabs are every 8 spaces). If @a tabs is <tt>0</tt>, the default
* tabs are reinstated. @a tabs is copied into the layout; you must
* free your copy of @a tabs yourself.
* @param tabs A Pango::TabArray, or <tt>0</tt>.
*/
void set_tabs(TabArray& tabs);
/** Get the current Pango::TabArray used by this layout. If no
* Pango::TabArray has been set, then the default tabs are in use
* and an invalid instance is returned. Default tabs are every 8 spaces.
* @return A copy of the tabs for this layout.
*/
TabArray get_tabs() const;
/** If @a setting is <tt>true</tt>, do not treat newlines and similar characters
* as paragraph separators; instead, keep all text in a single paragraph,
* and display a glyph for paragraph separator characters. Used when
* you want to allow editing of newlines on a single text line.
* @param setting New setting.
*/
void set_single_paragraph_mode(bool setting = true);
/** Obtains the value set by set_single_paragraph_mode().
* @return <tt>true</tt> if the layout does not break paragraphs at
* paragraph separator characters, <tt>false</tt> otherwise.
*/
bool get_single_paragraph_mode() const;
/** Sets the type of ellipsization being performed for @a layout.
* Depending on the ellipsization mode @a ellipsize text is
* removed from the start, middle, or end of text so they
* fit within the width and height of layout set with
* set_width() and set_height().
*
* If the layout contains characters such as newlines that
* force it to be layed out in multiple paragraphs, then whether
* each paragraph is ellipsized separately or the entire layout
* is ellipsized as a whole depends on the set height of the layout.
* See set_height() for details.
*
* @newin{1,6}
* @param ellipsize The new ellipsization mode for @a layout.
*/
void set_ellipsize(EllipsizeMode ellipsize);
/** Gets the type of ellipsization being performed for @a layout.
* See set_ellipsize()
*
* @newin{1,6}
* @return The current ellipsization mode for @a layout.
*
* Use is_ellipsized() to query whether any paragraphs
* were actually ellipsized.
*/
EllipsizeMode get_ellipsize() const;
/** Queries whether the layout had to ellipsize any paragraphs.
*
* This returns <tt>true</tt> if the ellipsization mode for @a layout
* is not Pango::ELLIPSIZE_NONE, a positive width is set on @a layout,
* and there are paragraphs exceeding that width that have to be
* ellipsized.
*
* @newin{1,16}
* @return <tt>true</tt> if any paragraphs had to be ellipsized, <tt>false</tt>
* otherwise.
*/
bool is_ellipsized() const;
/** Counts the number unknown glyphs in @a layout. That is, zero if
* glyphs for all characters in the layout text were found, or more
* than zero otherwise.
*
* This function can be used to determine if there are any fonts
* available to render all characters in a certain string, or when
* used in combination with Pango::ATTR_FALLBACK, to check if a
* certain font supports all the characters in the string.
*
* @newin{1,16}
* @return The number of unknown glyphs in @a layout.
*/
int get_unknown_glyphs_count() const;
/** Forces recomputation of any state in the Pango::Layout that
* might depend on the layout's context. This function should
* be called if you make changes to the context subsequent
* to creating the layout.
*/
void context_changed();
/** Retrieve an array of logical attributes for each character in the layout.
* @return An array of logical attributes.
*/
Glib::ArrayHandle<LogAttr> get_log_attrs() const;
/** Convert from an index within the layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle.
* Note that @a x in the returned rectangle is always the leading edge of the grapheme
* and @a x + @a width the trailing edge of the grapheme.
* If the directionality of the grapheme is right-to-left, then @a width will be negative.
* @param index Byte index within layout.
* @return The position of the grapheme.
*/
Rectangle index_to_pos(int index) const;
/** Converts from byte @a index within the @a layout to line and X position.
* (X position is measured from the left edge of the line)
* @param index The byte index of a grapheme within the layout.
* @param trailing An integer indicating the edge of the grapheme to retrieve the
* position of. If 0, the trailing edge of the grapheme, if > 0,
* the leading of the grapheme.
* @param line Location to store resulting line index. (which will
* between 0 and pango_layout_get_line_count(layout) - 1).
* @param x_pos Location to store resulting position within line
* (Pango::SCALE units per device unit).
*/
void index_to_line_x(int index_, bool trailing, int& line, int& x_pos) const;
/** Given an index within a layout, determines the positions that of the
* strong and weak cursors if the insertion point is at that
* index. The position of each cursor is stored as a zero-width
* rectangle. The strong cursor location is the location where
* characters of the directionality equal to the base direction of the
* layout are inserted. The weak cursor location is the location
* where characters of the directionality opposite to the base
* direction of the layout are inserted.
* @param index The byte index of the cursor.
* @param strong_pos Location to store the strong cursor position (may be <tt>0</tt>).
* @param weak_pos Location to store the weak cursor position (may be <tt>0</tt>).
*/
void get_cursor_pos(int index, Rectangle& strong_pos, Rectangle& weak_pos) const;
/** Given an index within the layout, determine the positions that of the strong cursors if the insertion point is at that index.
* @param index The byte index of the cursor.
* @return The strong cursor position.
*/
Rectangle get_cursor_strong_pos(int index) const;
/** Given an index within the layout, determine the positions that of the weak cursors if the insertion point is at that index.
* @param index The byte index of the cursor.
* @return The weak cursor position.
*/
Rectangle get_cursor_weak_pos(int index) const;
/** Computes a new cursor position from an old position and
* a count of positions to move visually. If @a direction is positive,
* then the new strong cursor position will be one position
* to the right of the old cursor position. If @a direction is negative,
* then the new strong cursor position will be one position
* to the left of the old cursor position.
*
* In the presence of bidirectional text, the correspondence
* between logical and visual order will depend on the direction
* of the current run, and there may be jumps when the cursor
* is moved off of the end of a run.
*
* Motion here is in cursor positions, not in characters, so a
* single call to move_cursor_visually() may move the
* cursor over multiple characters when multiple characters combine
* to form a single grapheme.
* @param strong Whether the moving cursor is the strong cursor or the
* weak cursor. The strong cursor is the cursor corresponding
* to text insertion in the base direction for the layout.
* @param old_index The byte index of the grapheme for the old index.
* @param old_trailing If 0, the cursor was at the trailing edge of the
* grapheme indicated by @a old_index, if > 0, the cursor
* was at the leading edge.
* @param direction Direction to move cursor. A negative
* value indicates motion to the left.
* @param new_index Location to store the new cursor byte index. A value of -1
* indicates that the cursor has been moved off the beginning
* of the layout. A value of MAXINT indicates that
* the cursor has been moved off the end of the layout.
* @param new_trailing Number of characters to move forward from the location returned
* for @a new_index to get the position where the cursor should
* be displayed. This allows distinguishing the position at
* the beginning of one line from the position at the end
* of the preceding line. @a new_index is always on the line
* where the cursor should be displayed.
*/
void move_cursor_visually(bool strong, int old_index, int old_trailing, int direction, int& new_index, int& new_trailing) const;
/** Converts from X and Y position within a layout to the byte
* index to the character at that logical position. If the
* Y position is not inside the layout, the closest position is chosen
* (the position will be clamped inside the layout). If the
* X position is not within the layout, then the start or the
* end of the line is chosen as described for pango_layout_x_to_index().
* If either the X or Y positions were not inside the layout, then the
* function returns <tt>false</tt>; on an exact hit, it returns <tt>true</tt>.
* @param x The X offset (in Pango units)
* from the left edge of the layout.
* @param y The Y offset (in Pango units)
* from the top edge of the layout.
* @param index Location to store calculated byte index.
* @param trailing Location to store a integer indicating where
* in the grapheme the user clicked. It will either
* be zero, or the number of characters in the
* grapheme. 0 represents the trailing edge of the grapheme.
* @return <tt>true</tt> if the coordinates were inside text, <tt>false</tt> otherwise.
*/
bool xy_to_index(int x, int y, int& index, int& trailing) const;
/** Compute the logical and ink extents of @a layout. Logical extents
* are usually what you want for positioning things. The extents
* are given in layout coordinates; layout coordinates begin at the
* top left corner of the layout.
* @param ink_rect Rectangle used to store the extents of the layout as drawn.
* @param logical_rect Rectangle used to store the logical extents of the layout.
*/
void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
/** Compute the ink extents of layout.
* @return The extents of the layout as drawn.
*/
Rectangle get_ink_extents() const;
/** Compute the logical extents of layout.
* @return The logical extents of the layout.
*/
Rectangle get_logical_extents() const;
/** Compute the logical and ink extents of @a layout in device units.
* See get_extents(); this function just calls
* get_extents() and then converts the extents to
* pixels using the Pango::SCALE factor.
* @param ink_rect Rectangle used to store the extents of the layout as drawn.
* @param logical_rect Rectangle used to store the logical extents of the
* layout.
*/
void get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
/** Compute the ink extents of the layout in device units.
* @return The extents of the layout as drawn.
*/
Rectangle get_pixel_ink_extents() const;
/** Compute the logical extents of the layout in device units.
* @return The logical extents of the layout.
*/
Rectangle get_pixel_logical_extents() const;
/** Determines the logical width and height of a Pango::Layout
* in Pango units (device units scaled by Pango::SCALE). This
* is simply a convenience function around get_extents().
* @param width Location to store the logical width, or <tt>0</tt>.
* @param height Location to store the logical height, or <tt>0</tt>.
*/
void get_size(int& width, int& height) const;
/** Determines the logical width and height of a Pango::Layout
* in device units. (get_size() returns the width
* and height scaled by Pango::SCALE.) This
* is simply a convenience function around
* get_pixel_extents().
* @param width Location to store the logical width, or <tt>0</tt>.
* @param height Location to store the logical height, or <tt>0</tt>.
*/
void get_pixel_size(int& width, int& height) const;
/** Gets the Y position of baseline of the first line in @a layout.
*
* @newin{1,22}
* @return Baseline of first line, from top of @a layout.
*/
int get_baseline() const;
/** Retrieves the count of lines for the @a layout.
* @return The line count.
*/
int get_line_count() const;
//Note that the const version uses a different (faster) C function:
/** Retrieves a particular line from a Pango::Layout.
*
* Use the faster get_line_readonly() if you do not plan
* to modify the contents of the line (glyphs, glyph widths, etc.).
* @param line The index of a line, which must be between 0 and
* <tt>pango_layout_get_line_count(layout) - 1</tt>, inclusive.
* @return The requested Pango::LayoutLine, or <tt>0</tt> if the
* index is out of range. This layout line can
* be ref'ed and retained, but will become invalid
* if changes are made to the Pango::Layout.
*/
Glib::RefPtr<LayoutLine> get_line(int line);
/** Retrieves a particular line from a Pango::Layout.
*
* This is a faster alternative to get_line(),
* but the user is not expected
* to modify the contents of the line (glyphs, glyph widths, etc.).
*
* @newin{1,16}
* @param line The index of a line, which must be between 0 and
* <tt>pango_layout_get_line_count(layout) - 1</tt>, inclusive.
* @return The requested Pango::LayoutLine, or <tt>0</tt> if the
* index is out of range. This layout line can
* be ref'ed and retained, but will become invalid
* if changes are made to the Pango::Layout.
* No changes should be made to the line.
*/
Glib::RefPtr<const LayoutLine> get_line(int line) const;
//Note that the const version uses a different (faster) C function:
/** Returns the lines of the @a layout as a list.
*
* Use the faster get_lines_readonly() if you do not plan
* to modify the contents of the lines (glyphs, glyph widths, etc.).
* @return A SList containing
* the lines in the layout. This points to internal data of the Pango::Layout
* and must be used with care. It will become invalid on any change to the layout's
* text or properties.
*/
SListHandle_LayoutLine get_lines();
/** Returns the lines of the @a layout as a list.
*
* This is a faster alternative to get_lines(),
* but the user is not expected
* to modify the contents of the lines (glyphs, glyph widths, etc.).
*
* @newin{1,16}
* @return A SList containing
* the lines in the layout. This points to internal data of the Pango::Layout and
* must be used with care. It will become invalid on any change to the layout's
* text or properties. No changes should be made to the lines.
*/
SListHandle_ConstLayoutLine get_lines() const;
#ifndef PANGOMM_DISABLE_DEPRECATED
/** Gets an iterator to iterate over the visual extents of the layout.
* @param iter Location to store the iterator.
*
* @deprecated Use the get_iter() that returns the LayoutIter instead of
* using an output parameter.
*/
void get_iter(LayoutIter& iter);
#endif // PANGOMM_DISABLE_DEPRECATED
/** Gets an iterator to iterate over the visual extents of the layout.
* @result The iterator.
*
* @newin{2,28}
*/
LayoutIter get_iter();
/** Adds the text in this LayoutLine to the current path in the
* specified Cairo @a context. The origin of the glyphs (the left edge
* of the line) will be at the current point of the cairo context.
*
* @param context A Cairo context.
*/
void add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
/** Draws a Layout in the specified Cairo @a context. The top-left
* corner of the Layout will be drawn at the current point of the
* cairo context.
*
* @param context A Cairo context.
*
* @newin{2,16}
*/
void show_in_cairo_context(const Cairo::RefPtr<Cairo::Context>& context);
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
};
} /* namespace Pango */
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Pango::Layout
*/
Glib::RefPtr<Pango::Layout> wrap(PangoLayout* object, bool take_copy = false);
}
#endif /* _PANGOMM_LAYOUT_H */
|