1/* FIXME: this widget should just implement a scroller */ 2enum @beta Elm.Code_Widget_Scroller_Policy 3{ 4 [[Type that controls when scrollbars should appear. 5 6 See also @Elm.Interface_Scrollable.policy.set. 7 ]] 8 auto = 0, [[Show scrollbars as needed]] 9 on, [[Always show scrollbars]] 10 off, [[Never show scrollbars]] 11 last [[Sentinel value to indicate last enum field during iteration]] 12} 13 14/* FIXME: Those types make elm_code unusable from pure EO */ 15struct @beta @extern Elm.Code; [[Elementary code main data structure]] /* The main interface currently defined in code */ 16struct @beta @extern Elm.Code_Line; [[Elementary code line data structure]] /* Parts of the interface currently defined in code */ 17 18class @beta Elm.Code_Widget extends Efl.Ui.Layout 19{ 20 [[Elementary code widget]] 21 c_prefix: efl_ui_code_widget; 22 methods { 23 @property code { 24 [[The underlying code object that this widget renders. 25 This can only be set during construction, once the widget is created the 26 backing code object cannot be changed.]] 27 set { 28 } 29 get { 30 } 31 values { 32 code: ptr(Elm.Code); [[Our underlying Elm.Code object]] 33 } 34 } 35 @property font { 36 [[Set the font that this widget uses, the font should be a monospaced scalable font. 37 Passing $NULL will load the default system monospaced font. 38 When reading, the font name is a copy and should be freed once it is no longer needed.]] 39 set { 40 } 41 get { 42 } 43 values { 44 name: string; [[The name of the font to load]] 45 size: int; [[The font size for the widget]] 46 } 47 } 48 @property columns { 49 [[The number of columns in the widget currently. 50 This will be the max of the number of columns to represent the longest line and 51 the minimum required to fill the visible widget width.]] 52 get { 53 } 54 values { 55 columns: uint; [[The number of columns required to render the widget]] 56 } 57 } 58 @property gravity { 59 [[Set how this widget's scroller should respond to new lines being added. 60 61 An x value of 0.0 will maintain the distance from the left edge, 1.0 will ensure the rightmost edge (of the longest line) is respected 62 With 0.0 for y the view will keep it's position relative to the top whereas 1.0 will scroll downward as lines are added.]] 63 set { 64 } 65 get { 66 } 67 values { 68 x: double; [[The horizontal value of the scroller gravity - valid values are 0.0 and 1.0]] 69 y: double; [[The vertical gravity of the widget's scroller - valid values are 0.0 and 1.0]] 70 } 71 } 72 @property policy { 73 [[The widget's policy for scrollbar visibility.]] 74 set { 75 } 76 get { 77 } 78 values { 79 policy_h: Elm.Code_Widget_Scroller_Policy; [[The horizontal scrollbar visibility policy]] 80 policy_v: Elm.Code_Widget_Scroller_Policy; [[The vertical scrollbar visibility policy]] 81 } 82 } 83 @property tabstop { 84 [[The width of a tab stop, used purely for visual layout of tab characters. 85 86 Recommended value is between 2 and 8.]] 87 set { 88 } 89 get { 90 } 91 values { 92 tabstop: uint; [[Maximum width of a tab character]] 93 } 94 } 95 @property editable { 96 [[Whether this widget allows editing. 97 98 If editable then the widget will allow user input to manipulate 99 the underlying Elm.Code_File of this Elm.Code instance. 100 Any other Elm.Code_Widget's connected to this Elm.Code will 101 update to reflect the changes.]] 102 set { 103 } 104 get { 105 [[Returns EINA_TRUE if the widget is editable, EINA_FALSE otherwise. 106 If this widget is not editable the underlying Elm.Code_File could 107 still be manipulated by a different widget or the filesystem.]] 108 } 109 values { 110 editable: bool; [[The editable state of the widget]] 111 } 112 } 113 @property line_numbers { 114 [[Whether line numbers should be displayed in the left gutter. 115 116 Passing EINA_TRUE will reserve a space for showing line numbers, 117 EINA_FALSE will turn this off.]] 118 set { 119 } 120 get { 121 } 122 values { 123 line_numbers: bool; [[Whether or not line numbers (or their placeholder) should be shown]] 124 } 125 } 126 @property line_width_marker { 127 [[Where the line width market should be shown. 128 129 Passing a non-zero value will set which line width to mark with a vertical line. 130 Passing 0 will hide this marker.]] 131 set { 132 } 133 get { 134 } 135 values { 136 line_width_marker: uint; [[Where to display a line width marker, if at all]] 137 } 138 } 139 @property show_whitespace { 140 [[Whether white space should be shown.]] 141 set { 142 } 143 get { 144 } 145 values { 146 show_whitespace: bool; [[Whether or not we show whitespace characters]] 147 } 148 } 149 @property alpha { 150 [[Set an alpha color value for this widget (0 - 255) default is fully opaque (255).]] 151 set { 152 } 153 get { 154 } 155 values { 156 alpha: int; [[Alpha value]] 157 } 158 } 159 @property syntax_enabled { 160 [[Whether syntax highlighting should be use for this widget.]] 161 set { 162 } 163 get { 164 } 165 values { 166 syntax_enabled: bool; [[Whether or not to enable syntax highlighting]] 167 } 168 } 169 @property tab_inserts_spaces { 170 [[Whether space characters should be inserted instead of tabs.]] 171 set { 172 } 173 get { 174 } 175 values { 176 tab_inserts_spaces: bool; [[$true if we should insert space characters instead of a tab when the Tab key is pressed]] 177 } 178 } 179 @property cursor_position { 180 [[The current location of the text cursor.]] 181 set { 182 } 183 get { 184 } 185 values { 186 row: uint; [[The vertical position ov the cursur - the fist row is 1]] 187 col: uint; [[The horizontal position of the cursor, starting from column 1]] 188 } 189 } 190 theme_refresh { 191 [[Update and refresh theme for widget.]] 192 } 193 line_refresh { 194 [[Refresh code line in widget]] 195 params { 196 line: ptr(Elm.Code_Line); [[The line to refresh.]] 197 } 198 } 199 line_visible_get { 200 [[Check if the code line is currently visible]] 201 params { 202 line: ptr(Elm.Code_Line); [[The line to test for visibility.]] 203 } 204 return: bool; [[$true if the line specified is currently visible within the scroll region.]] 205 } 206 lines_visible_get { 207 [[Get the number of code lines currently visible in the widget]] 208 return: uint; [[the number of lines currently visible in the widget.]] 209 } 210 position_at_coordinates_get { 211 [[Get the row, col position for a given coordinate on the widget.]] 212 params { 213 x: int; [[The x coordinate in the widget]] 214 y: int; [[The y coordinate in the widget]] 215 row: ptr(uint); [[The row for the coordinates]] 216 col: ptr(int); [[The column for the coordinates]] 217 } 218 return: bool; [[$true if a line exists at these coordinates]] 219 } 220 geometry_for_position_get { 221 [[Get the geometry for the cell at the specified position.]] 222 params { 223 row: uint; [[The row for the requested position]] 224 col: int; [[The column for the requested position]] 225 x: ptr(int); [[The x coordinate of the cell at specified position]] 226 y: ptr(int); [[The y coordinate of the cell at specified position]] 227 w: ptr(int); [[The width of the cell at specified position]] 228 h: ptr(int); [[The height of the cell at specified position]] 229 } 230 return: bool; [[$true if a cell exists at the specified position]] 231 } 232 233 text_left_gutter_width_get { 234 [[Get the column width of the gutter]] 235 return: int; [[The current column width of the gutter for the widget.]] 236 } 237 text_between_positions_get { 238 [[Get text between given positions]] 239 params { 240 start_line: uint; [[The line of the first character to get]] 241 start_col: uint; [[The widget column of the first character to get]] 242 end_line: uint; [[The line of the last character to get]] 243 end_col: uint; [[The widget column of the last character to get]] 244 } 245 return: ptr(char); [[The text content between start and end positions]] 246 } 247 text_at_cursor_insert { 248 [[Insert the provided text at the cursor position. 249 This will add the operation to the widget's undo list.]] 250 params { 251 text: string; [[The text to insert]] 252 } 253 } 254 255 line_text_column_width_to_position { 256 [[Get text column width at given position]] 257 params { 258 line: ptr(Elm.Code_Line); [[Code line]] 259 position: uint; [[Code position]] 260 } 261 return: uint; [[Text column width]] 262 } 263 line_text_column_width_get { 264 [[Get text column width for code line]] 265 params { 266 line: ptr(Elm.Code_Line); [[Code line]] 267 } 268 return: uint; [[Text column width]] 269 } 270 line_text_position_for_column_get { 271 [[Get position from column]] 272 params { 273 line: ptr(Elm.Code_Line); [[Code line]] 274 column: uint; [[Column]] 275 } 276 return: uint; [[Position]] 277 } 278 text_tabwidth_at_column_get { 279 [[Get tabwidth for column]] 280 params { 281 column: uint; [[Column]] 282 } 283 return: uint; [[Tabwidth]] 284 } 285 line_status_toggle { 286 [[Toggle the display of the line status widget]] 287 params { 288 line: ptr(Elm.Code_Line); [[Code line]] 289 } 290 } 291 292 undo { 293 [[Undo last action]] 294 } 295 can_undo_get { 296 [[Determine if there are any available undo operations]] 297 return: bool; [[$true if there are undo operations]] 298 } 299 redo { 300 [[Redo last action]] 301 } 302 can_redo_get { 303 [[Determine if there are any available redo operations]] 304 return: bool; [[$true if there are redo operations]] 305 } 306 } 307 implements { 308 class.constructor; 309 Efl.Object.constructor; 310 Efl.Object.finalize; 311 Efl.Ui.Widget.widget_input_event_handler; 312 Efl.Ui.Widget.theme_apply; 313 } 314 constructors { 315 .code; 316 } 317 events { 318 line,clicked: Elm.Code_Line; [[Called when text line was clicked]] 319 line,gutter,clicked: Elm.Code_Line; [[Called when gutter was clicked]] 320 changed,user: void; [[Called when object changed due to user interaction]] 321 /* FIXME: All events below send the obj in the event_info, which is redundant */ 322 cursor,changed: Elm.Code_Widget; [[Called when cursor changed]] 323 code,selection,start: Elm.Code_Widget; [[Called when a selection is started]] 324 code,selection,changed: Elm.Code_Widget; [[Called when selection changed]] 325 code,selection,cleared: Elm.Code_Widget; [[Called when selection was cleared]] 326 code,selection,cut: Elm.Code_Widget; [[Called when a cut action is performed]] 327 code,selection,copy: Elm.Code_Widget; [[Called when a copy action is performed]] 328 code,selection,paste: Elm.Code_Widget; [[Called when a paste action is performed]] 329 } 330} 331