File: ZTextOption.rst

package info (click to toggle)
tuiwidgets 0.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,940 kB
  • sloc: cpp: 54,583; python: 495; sh: 83; makefile: 8
file content (133 lines) | stat: -rw-r--r-- 5,322 bytes parent folder | download | duplicates (3)
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
.. _ZTextOption:

ZTextOption
===========

.. cpp:class:: Tui::ZTextOption

   This class is copyable. It does define comparison operators for equality.

   This class contains options for use with :cpp:class:`Tui::ZTextLayout`.

   **Enums**

   .. rst-class:: tw-invisible
   .. cpp:type:: Flags = QFlags<Tui::ZTextOption::Flag>

   .. cpp:enum:: Flag

      .. cpp:enumerator:: ShowTabsAndSpaces

         Display tabs and spaces using characters ``→`` and ``·`` respectivly.

         Additionally the application can select a text style different from normal text to display these characters.

      .. cpp:enumerator:: ShowTabsAndSpacesWithColors

         Display tabs and trailing spaces using special colors.

         The choice of colors is done either by setting fixed colors in ZTextOption for these or by setting
         color mapping functions that return the used color based on the text style of the normal text.

   .. cpp:enum:: TabType

      .. cpp:enumerator:: LeftTab

         Left aligned tab.

         The text follows the tab stop position.

   .. cpp:enum:: WrapMode

      .. cpp:enumerator:: NoWrap

         Do not wrap lines.

      .. cpp:enumerator:: WordWrap

         Wrap lines between words.

      .. cpp:enumerator:: WrapAnywhere

         Wrap lines anywhere, even breaking words apart.

   **Types**

   .. cpp:class:: Tab

      Describes a tab stop.

      .. cpp:function:: Tab(int pos, Tui::ZTextOption::TabType tabType)

         Sets the position of the tab stop to ``pos`` and the type of the tab stop to ``tabType``.

      .. cpp:member:: int position = 0

         The position of the tab stop in cells.

      .. cpp:member:: Tui::ZTextOption::TabType type = LeftTab

         The type of the tab stop.

         Currently only left aligned tabs are supported.

   **Functions**

   .. cpp:function:: Tui::ZTextOption::Flags flags() const
   .. cpp:function:: void setFlags(Tui::ZTextOption::Flags flags)

      See :cpp:type:`Tui::ZTextOption::Flags` for possible flag values.

   .. cpp:function:: int tabStopDistance() const
   .. cpp:function:: void setTabStopDistance(int tabStopDistance)

      Definies tab positions beyond tabs explicitly specified using :cpp:func:`setTabs <void setTabs(const QList<Tui::ZTextOption::Tab> &tabStops)>`
      or :cpp:func:`setTabArray <void setTabArray(const QList<int> &tabStops)>`.

      Tab stops definied by this are only active after the last individually placed tab stop and are in columns
      ``i * tabStopDistance`` (for i > 0).

      Values of ``tabStopDistance`` less than 1 are invalid and replaced by the value 1.

      Defaults to 8.

   .. cpp:function:: QList<Tui::ZTextOption::Tab> tabs() const
   .. cpp:function:: void setTabs(const QList<Tui::ZTextOption::Tab> &tabStops)

      Set explicit tab stops ``tabStops``.

      On return the tab stops are always sorted.

   .. cpp:function:: QList<int> tabArray() const
   .. cpp:function:: void setTabArray(const QList<int> &tabStops)

      Set explicit left aligned tab stops at the columns in ``tabStops``.

      On return the tab stops are always sorted.

   .. cpp:function:: WrapMode wrapMode() const
   .. cpp:function:: void setWrapMode(WrapMode mode)

      Selects which line wrapping mode is used.

      See :cpp:type:`Tui::ZTextOption::WrapMode` for possible values.

   .. cpp:function:: void setTrailingWhitespaceColor(std::function<Tui::ZTextStyle(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)

      Sets the function used in :cpp:func:`mapTrailingWhitespaceColor <Tui::ZTextStyle mapTrailingWhitespaceColor(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const>`

   .. cpp:function:: Tui::ZTextStyle mapTrailingWhitespaceColor(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const

      Apply the mapping function set by :cpp:func:`setTrailingWhitespaceColor <void setTrailingWhitespaceColor(std::function<Tui::ZTextStyle(const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)>`.

      If the mapping function was not yet set returns :cpp:expr:`range ? range->format() : formatingChars`.

   .. cpp:function::  void setTabColor(std::function<Tui::ZTextStyle(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)

      Sets the function used in :cpp:func:`mapTabColor <Tui::ZTextStyle mapTabColor(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const>`

   .. cpp:function:: Tui::ZTextStyle mapTabColor(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange *range) const

      Apply the mapping function set by :cpp:func:`setTabColor <void setTabColor(std::function<Tui::ZTextStyle(int pos, int size, int hidden, const Tui::ZTextStyle &baseStyle, const Tui::ZTextStyle &formatingChars, const Tui::ZFormatRange*)> colorMapper)>`.

      If the mapping function was not yet set returns :cpp:expr:`range ? range->format() : formatingChars`.