summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_textgrid.eo
blob: 51b4583ea4118c51064aafbcad36d746b75b82eb (plain)
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
enum Evas.Textgrid.Palette {
   [[The palette to use for the foreground and background colors.

     @since 1.7]]
   none,     [[No palette is used]]
   standard, [[Standard palette (around 16 colors)]]
   extended, [[Extended palette (at max 256 colors)]]
   last      [[Sentinel value to indicate last enum field during iteration]]
}

enum Evas.Textgrid.Font_Style {
   [[The style to give to each character of the grid.

     @since 1.7]]
   normal = (1 << 0), [[Normal style]]
   bold   = (1 << 1), [[Bold style]]
   italic = (1 << 2)  [[Oblique style]]
}

/* XXX: Actual definition is in C. */
struct Evas.Textgrid.Cell; [[Evas textgrid cell data structure]]

class Evas.Textgrid (Efl.Canvas.Object, Efl.Text.Properties, Efl.Text.Font,
                     Efl.Ui.Base)
{
   [[Evas textgrid class]]
   legacy_prefix: evas_object_textgrid;
   eo_prefix: evas_obj_textgrid;
   methods {
      @property supported_font_styles {
         set {
            [[This function is not implemented yet, do not use.]]
         }
         get {
            [[This function is not implemented yet, do not use.]]
         }
         values {
            styles: Evas.Textgrid.Font_Style; [[EVAS_TEXTGRID_FONT_STYLE_NORMAL]]
         }
      }
      @property size {
         set {
            [[Set the size of the textgrid object.

              This function sets the number of lines $h and the number
              of columns $w for the textgrid object $obj. If
              $w or $h are less than or equal to 0, this
              function does nothing.

              @since 1.7]]
         }
         get {
            [[Get the size of the textgrid object.

              This function retrieves the number of lines in the buffer
              $h and the number of columns in the buffer $w of
              the textgrid object $obj. $w or $h can be
              $null. On error, they are set to 0.

              @since 1.7]]
         }
         values {
            w: int; [[The number of columns (width in cells) of the grid.]]
            h: int; [[The number of rows (height in cells) of the grid.]]
         }
      }
      @property cell_size {
         get {
            [[Retrieve the size of a cell of the given textgrid object in pixels.

              This functions retrieves the width and height, in pixels, of a cell
              of the textgrid object $obj and stores them respectively in the
              buffers $width and $height. Their values depend on the
              monospace font and style used for the textgrid object.
              $width and $height can be $null. On error, they are
              set to 0.

              See also @Efl.Text.Properties.font.set and @.supported_font_styles.set

              @since 1.7]]
         }
         values {
            width: int; [[A pointer to the location to store the cell's width in pixels.]]
            height: int; [[A pointer to the location to store the cell's height in pixels.]]
         }
      }
      update_add {
         [[Indicate for evas that part of a textgrid region (cells) has been updated.

           This function declares to evas that a region of cells was updated by
           code and needs refreshing.

           See also @.cellrow_set,  @.cellrow_get and @.size.set.

         @since 1.7]]
         /* FIXME-doc
          * An application should modify cells like this
          * as an example:
          * @code
          *   Evas_Textgrid_Cell *cells;
          *   int i;
          *   cells = evas_object_textgrid_cellrow_get(obj, row);
          *   for (i = 0; i < width; i++) cells[i].codepoint = 'E';
          *   evas_object_textgrid_cellrow_set(obj, row, cells);
          *   evas_object_textgrid_update_add(obj, 0, row, width, 1);
          * @endcode
          */

         params {
            @in x: int; [[The rect region of cells top-left x (column).]]
            @in y: int; [[The rect region of cells top-left y (row).]]
            @in w: int; [[The rect region size in number of cells (columns).]]
            @in h: int; [[The rect region size in number of cells (rows).]]
         }
      }
      cellrow_set {
         [[Set the string at the given row of the given textgrid object.

           This function returns cells to the textgrid taken by
           evas_object_textgrid_cellrow_get. The row pointer $row should be the
           same row pointer returned by evas_object_textgrid_cellrow_get for the
           same row $y.

           See also @.cellrow_get, @.size.set and @.update_add.

           @since 1.7]]

         params {
            @in y: int; [[The row index of the grid.]]
            @cref row: Evas.Textgrid.Cell; [[The string as a sequence of #Evas_Textgrid_Cell.]]
         }
      }
      cellrow_get @const {
         [[Get the string at the given row of the given textgrid object.

           This function returns a pointer to the first cell of the line $y
           of the textgrid object $obj. If $y is not between 0 and the
           number of lines of the grid - 1, or on error, this function return $null.

           See also @.cellrow_set, @.size.set and @.update_add.

           @since 1.7]]
         return: ptr(Evas.Textgrid.Cell); [[A pointer to the first cell of the given row.]]
         params {
            @in y: int; [[The row index of the grid.]]
         }
      }
      palette_set {
         [[The set color to the given palette at the given index of the given textgrid object.

           This function sets the color for the palette of type $pal at the
           index $idx of the textgrid object $obj. The ARGB components are
           given by $r, $g, $b and $a. This color can be used when
           setting the #Evas_Textgrid_Cell structure. The components must set
           a pre-multiplied color. If pal is #EVAS_TEXTGRID_PALETTE_NONE or
           #EVAS_TEXTGRID_PALETTE_LAST, or if $idx is not between 0 and 255,
           or on error, this function does nothing. The color components are
           clamped between 0 and 255. If $idx is greater than the latest set
           color, the colors between this last index and $idx - 1 are set to
           black (0, 0, 0, 0).

           See also @.palette_get.

           @since 1.7]]

         params {
            @in pal: Evas.Textgrid.Palette; [[The type of the palette to set the color.]]
            @in idx: int; [[The index of the palette to which the color is stored.]]
            @in r: int; [[The red component of the color.]]
            @in g: int; [[The green component of the color.]]
            @in b: int; [[The blue component of the color.]]
            @in a: int; [[The alpha component of the color.]]
         }
      }
      palette_get @const {
         [[The retrieve color to the given palette at the given index of the given textgrid object.

           This function retrieves the color for the palette of type $pal at the
           index $idx of the textgrid object $obj. The ARGB components are
           stored in the buffers $r, $g, $b and $a. If $idx is not
           between 0 and the index of the latest set color, or if $pal is
           #EVAS_TEXTGRID_PALETTE_NONE or #EVAS_TEXTGRID_PALETTE_LAST, the
           values of the components are 0. $r, $g, $b and $a can be
           $null.

           See also @.palette_set.

           @since 1.7]]
         params {
            @in pal: Evas.Textgrid.Palette; [[The type of the palette to set the color.]]
            @in idx: int; [[The index of the palette to which the color is stored.]]
            @out r: int; [[A pointer to the red component of the color.]]
            @out g: int; [[A pointer to the green component of the color.]]
            @out b: int; [[A pointer to the blue component of the color.]]
            @out a: int; [[A pointer to the alpha component of the color.]]
         }
      }
   }
   implements {
      Efl.Object.constructor;
      Efl.Object.destructor;
      Efl.Text.Properties.font { get; set; }
      Efl.Text.Properties.font_source { get; set; }
      Efl.Text.Font.font_bitmap_scalable { get; set; }
      Efl.Gfx.scale { set; }
   }
}