1 #ifndef _ELM_CODE_WIDGET_EO_LEGACY_H_ 2 #define _ELM_CODE_WIDGET_EO_LEGACY_H_ 3 4 #ifndef _ELM_CODE_WIDGET_EO_CLASS_TYPE 5 #define _ELM_CODE_WIDGET_EO_CLASS_TYPE 6 7 typedef Eo Elm_Code_Widget; 8 9 #endif 10 11 #ifndef _ELM_CODE_WIDGET_EO_TYPES 12 #define _ELM_CODE_WIDGET_EO_TYPES 13 14 15 #endif 16 17 /** 18 * @brief Set the underlying code object that this widget renders. This can 19 * only be set during construction, once the widget is created the backing code 20 * object cannot be changed. 21 * 22 * @param[in] obj The object. 23 * @param[in] code Our underlying Elm.Code object 24 * 25 * @ingroup Elm_Code_Widget_Group 26 */ 27 EAPI void elm_code_widget_code_set(Elm_Code_Widget *obj, Elm_Code *code); 28 29 /** 30 * @brief Get the underlying code object we are rendering 31 * 32 * @param[in] obj The object. 33 * 34 * @return Our underlying Elm.Code object 35 * 36 * @ingroup Elm_Code_Widget_Group 37 */ 38 EAPI Elm_Code *elm_code_widget_code_get(const Elm_Code_Widget *obj); 39 40 /** 41 * @brief Set the font that this widget uses, the font should be a monospaced 42 * scalable font. Passing NULL will load the default system monospaced font. 43 * 44 * @param[in] obj The object. 45 * @param[in] name The name of the font to load 46 * @param[in] size The font size for the widget 47 * 48 * @ingroup Elm_Code_Widget_Group 49 */ 50 EAPI void elm_code_widget_font_set(Elm_Code_Widget *obj, const char *name, int size); 51 52 /** 53 * @brief Get the font currently in use. The font name is a copy ad should be 54 * freed once it is no longer needed 55 * 56 * @param[in] obj The object. 57 * @param[out] name The name of the font to load 58 * @param[out] size The font size for the widget 59 * 60 * @ingroup Elm_Code_Widget_Group 61 */ 62 EAPI void elm_code_widget_font_get(const Elm_Code_Widget *obj, const char **name, int *size); 63 64 /** 65 * @brief Get the number of columns in the widget currently. This will be the 66 * max of the number of columns to represent the longest line and the minimum 67 * required to fill the visible widget width. 68 * 69 * @param[in] obj The object. 70 * 71 * @return The number of columns required to render the widget 72 * 73 * @ingroup Elm_Code_Widget_Group 74 */ 75 EAPI unsigned int elm_code_widget_columns_get(const Elm_Code_Widget *obj); 76 77 /** 78 * @brief Set how this widget's scroller should respond to new lines being 79 * added. 80 * 81 * An x value of 0.0 will maintain the distance from the left edge, 1.0 will 82 * ensure the rightmost edge (of the longest line) is respected With 0.0 for y 83 * the view will keep it's position relative to the top whereas 1.0 will scroll 84 * downward as lines are added. 85 * 86 * @param[in] obj The object. 87 * @param[in] x The horizontal value of the scroller gravity - valid values are 88 * 0.0 and 1.0 89 * @param[in] y The vertical gravity of the widget's scroller - valid values 90 * are 0.0 and 1.0 91 * 92 * @ingroup Elm_Code_Widget_Group 93 */ 94 EAPI void elm_code_widget_gravity_set(Elm_Code_Widget *obj, double x, double y); 95 96 /** 97 * @brief Get the current x and y gravity of the widget's scroller 98 * 99 * @param[in] obj The object. 100 * @param[out] x The horizontal value of the scroller gravity - valid values 101 * are 0.0 and 1.0 102 * @param[out] y The vertical gravity of the widget's scroller - valid values 103 * are 0.0 and 1.0 104 * 105 * @ingroup Elm_Code_Widget_Group 106 */ 107 EAPI void elm_code_widget_gravity_get(const Elm_Code_Widget *obj, double *x, double *y); 108 109 /** 110 * @brief Set the policy for scrollbar visibility. 111 * 112 * @param[in] obj The object. 113 * @param[in] policy_h The horizontal scrollbar visibility policy 114 * @param[in] policy_v The vertical scrollbar visibility policy 115 * 116 * @ingroup Elm_Code_Widget_Group 117 */ 118 EAPI void elm_code_widget_policy_set(Elm_Code_Widget *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); 119 120 /** 121 * @brief Get the widget's policy for scrollbar visibility. 122 * 123 * @param[in] obj The object. 124 * @param[out] policy_h The horizontal scrollbar visibility policy 125 * @param[out] policy_v The vertical scrollbar visibility policy 126 * 127 * @ingroup Elm_Code_Widget_Group 128 */ 129 EAPI void elm_code_widget_policy_get(const Elm_Code_Widget *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); 130 131 /** 132 * @brief Set the width of a tab stop, used purely for visual layout of tab 133 * characters. 134 * 135 * Recommended value is between 2 and 8. 136 * 137 * @param[in] obj The object. 138 * @param[in] tabstop Maximum width of a tab character 139 * 140 * @ingroup Elm_Code_Widget_Group 141 */ 142 EAPI void elm_code_widget_tabstop_set(Elm_Code_Widget *obj, unsigned int tabstop); 143 144 /** 145 * @brief Get the current width of a tab stop. This is used to determine where 146 * characters after a tab should appear in the line. 147 * 148 * @param[in] obj The object. 149 * 150 * @return Maximum width of a tab character 151 * 152 * @ingroup Elm_Code_Widget_Group 153 */ 154 EAPI unsigned int elm_code_widget_tabstop_get(const Elm_Code_Widget *obj); 155 156 /** 157 * @brief Set whether this widget allows editing 158 * 159 * If editable then the widget will allow user input to manipulate the 160 * underlying Elm.Code_File of this Elm.Code instance. Any other 161 * Elm.Code_Widget's connected to this Elm.Code will update to reflect the 162 * changes. 163 * 164 * @param[in] obj The object. 165 * @param[in] editable The editable state of the widget 166 * 167 * @ingroup Elm_Code_Widget_Group 168 */ 169 EAPI void elm_code_widget_editable_set(Elm_Code_Widget *obj, Eina_Bool editable); 170 171 /** 172 * @brief Get the current editable state of this widget 173 * 174 * returns EINA_TRUE if the widget is editable, EINA_FALSE otherwise. If this 175 * widget is not editable the underlying Elm.Code_File could still be 176 * manipulated by a different widget or the filesystem. 177 * 178 * @param[in] obj The object. 179 * 180 * @return The editable state of the widget 181 * 182 * @ingroup Elm_Code_Widget_Group 183 */ 184 EAPI Eina_Bool elm_code_widget_editable_get(const Elm_Code_Widget *obj); 185 186 /** 187 * @brief Set whether line numbers should be displayed in the left gutter. 188 * 189 * Passing EINA_TRUE will reserve a space for showing line numbers, EINA_FALSE 190 * will turn this off. 191 * 192 * @param[in] obj The object. 193 * @param[in] line_numbers Whether or not line numbers (or their placeholder) 194 * should be shown 195 * 196 * @ingroup Elm_Code_Widget_Group 197 */ 198 EAPI void elm_code_widget_line_numbers_set(Elm_Code_Widget *obj, Eina_Bool line_numbers); 199 200 /** 201 * @brief Get the status of line number display for this widget. 202 * 203 * @param[in] obj The object. 204 * 205 * @return Whether or not line numbers (or their placeholder) should be shown 206 * 207 * @ingroup Elm_Code_Widget_Group 208 */ 209 EAPI Eina_Bool elm_code_widget_line_numbers_get(const Elm_Code_Widget *obj); 210 211 /** 212 * @brief Set where the line width market should be shown. 213 * 214 * Passing a non-zero value will set which line width to mark with a vertical 215 * line. Passing 0 will hide this marker. 216 * 217 * @param[in] obj The object. 218 * @param[in] line_width_marker Where to display a line width marker, if at all 219 * 220 * @ingroup Elm_Code_Widget_Group 221 */ 222 EAPI void elm_code_widget_line_width_marker_set(Elm_Code_Widget *obj, unsigned int line_width_marker); 223 224 /** 225 * @brief Get the position of the line width marker, any positive return 226 * indicates where the marker appears. 227 * 228 * @param[in] obj The object. 229 * 230 * @return Where to display a line width marker, if at all 231 * 232 * @ingroup Elm_Code_Widget_Group 233 */ 234 EAPI unsigned int elm_code_widget_line_width_marker_get(const Elm_Code_Widget *obj); 235 236 /** 237 * @brief Set whether white space should be shown. 238 * 239 * @param[in] obj The object. 240 * @param[in] show_whitespace Whether or not we show whitespace characters 241 * 242 * @ingroup Elm_Code_Widget_Group 243 */ 244 EAPI void elm_code_widget_show_whitespace_set(Elm_Code_Widget *obj, Eina_Bool show_whitespace); 245 246 /** 247 * @brief Get whether or not white space will be visible. 248 * 249 * @param[in] obj The object. 250 * 251 * @return Whether or not we show whitespace characters 252 * 253 * @ingroup Elm_Code_Widget_Group 254 */ 255 EAPI Eina_Bool elm_code_widget_show_whitespace_get(const Elm_Code_Widget *obj); 256 257 /** 258 * @brief Set an alpha color value for this widget (0 - 255) default is fully 259 * opaque (255). 260 * 261 * @param[in] obj The object. 262 * @param[in] alpha Alpha value 263 * 264 * @ingroup Elm_Code_Widget_Group 265 */ 266 EAPI void elm_code_widget_alpha_set(Elm_Code_Widget *obj, int alpha); 267 268 /** 269 * @brief Set an alpha color value for this widget (0 - 255) default is fully 270 * opaque (255). 271 * 272 * @param[in] obj The object. 273 * 274 * @return Alpha value 275 * 276 * @ingroup Elm_Code_Widget_Group 277 */ 278 EAPI int elm_code_widget_alpha_get(const Elm_Code_Widget *obj); 279 280 /** 281 * @brief Set whether syntax highlighting should be use for this widget. 282 * 283 * @param[in] obj The object. 284 * @param[in] syntax_enabled Whether or not to enable syntax highlighting 285 * 286 * @ingroup Elm_Code_Widget_Group 287 */ 288 EAPI void elm_code_widget_syntax_enabled_set(Elm_Code_Widget *obj, Eina_Bool syntax_enabled); 289 290 /** 291 * @brief Get this widget's enabled state for syntax highlighting. 292 * 293 * @param[in] obj The object. 294 * 295 * @return Whether or not to enable syntax highlighting 296 * 297 * @ingroup Elm_Code_Widget_Group 298 */ 299 EAPI Eina_Bool elm_code_widget_syntax_enabled_get(const Elm_Code_Widget *obj); 300 301 /** 302 * @brief Set whether space characters should be inserted instead of tabs. 303 * 304 * @param[in] obj The object. 305 * @param[in] tab_inserts_spaces @c true if we should insert space characters 306 * instead of a tab when the Tab key is pressed 307 * 308 * @ingroup Elm_Code_Widget_Group 309 */ 310 EAPI void elm_code_widget_tab_inserts_spaces_set(Elm_Code_Widget *obj, Eina_Bool tab_inserts_spaces); 311 312 /** 313 * @brief Get whether or not space characters will be inserted instead of tabs. 314 * 315 * @param[in] obj The object. 316 * 317 * @return @c true if we should insert space characters instead of a tab when 318 * the Tab key is pressed 319 * 320 * @ingroup Elm_Code_Widget_Group 321 */ 322 EAPI Eina_Bool elm_code_widget_tab_inserts_spaces_get(const Elm_Code_Widget *obj); 323 324 /** 325 * @brief Set the current location of the text cursor. 326 * 327 * @param[in] obj The object. 328 * @param[in] row The vertical position ov the cursur - the fist row is 1 329 * @param[in] col The horizontal position of the cursor, starting from column 1 330 * 331 * @ingroup Elm_Code_Widget_Group 332 */ 333 EAPI void elm_code_widget_cursor_position_set(Elm_Code_Widget *obj, unsigned int row, unsigned int col); 334 335 /** 336 * @brief Get the current x and y position of the widget's cursor. 337 * 338 * @param[in] obj The object. 339 * @param[out] row The vertical position ov the cursur - the fist row is 1 340 * @param[out] col The horizontal position of the cursor, starting from column 341 * 1 342 * 343 * @ingroup Elm_Code_Widget_Group 344 */ 345 EAPI void elm_code_widget_cursor_position_get(const Elm_Code_Widget *obj, unsigned int *row, unsigned int *col); 346 347 /** Update and refresh theme for widget. 348 * 349 * @ingroup Elm_Code_Widget_Group 350 */ 351 EAPI void elm_code_widget_theme_refresh(Elm_Code_Widget *obj); 352 353 /** 354 * @brief Refresh code line in widget 355 * 356 * @param[in] obj The object. 357 * @param[in] line The line to refresh. 358 * 359 * @ingroup Elm_Code_Widget_Group 360 */ 361 EAPI void elm_code_widget_line_refresh(Elm_Code_Widget *obj, Elm_Code_Line *line); 362 363 /** 364 * @brief Check if the code line is currently visible 365 * 366 * @param[in] obj The object. 367 * @param[in] line The line to test for visibility. 368 * 369 * @return @c true if the line specified is currently visible within the scroll 370 * region. 371 * 372 * @ingroup Elm_Code_Widget_Group 373 */ 374 EAPI Eina_Bool elm_code_widget_line_visible_get(Elm_Code_Widget *obj, Elm_Code_Line *line); 375 376 /** 377 * @brief Get the number of code lines currently visible in the widget 378 * 379 * @param[in] obj The object. 380 * 381 * @return the number of lines currently visible in the widget. 382 * 383 * @ingroup Elm_Code_Widget_Group 384 */ 385 EAPI unsigned int elm_code_widget_lines_visible_get(Elm_Code_Widget *obj); 386 387 /** 388 * @brief Get the row, col position for a given coordinate on the widget. 389 * 390 * @param[in] obj The object. 391 * @param[in] x The x coordinate in the widget 392 * @param[in] y The y coordinate in the widget 393 * @param[in] row The row for the coordinates 394 * @param[in] col The column for the coordinates 395 * 396 * @return @c true if a line exists at these coordinates 397 * 398 * @ingroup Elm_Code_Widget_Group 399 */ 400 EAPI Eina_Bool elm_code_widget_position_at_coordinates_get(Elm_Code_Widget *obj, int x, int y, unsigned int *row, int *col); 401 402 /** 403 * @brief Get the geometry for the cell at the specified position. 404 * 405 * @param[in] obj The object. 406 * @param[in] row The row for the requested position 407 * @param[in] col The column for the requested position 408 * @param[in] x The x coordinate of the cell at specified position 409 * @param[in] y The y coordinate of the cell at specified position 410 * @param[in] w The width of the cell at specified position 411 * @param[in] h The height of the cell at specified position 412 * 413 * @return @c true if a cell exists at the specified position 414 * 415 * @ingroup Elm_Code_Widget_Group 416 */ 417 EAPI Eina_Bool elm_code_widget_geometry_for_position_get(Elm_Code_Widget *obj, unsigned int row, int col, int *x, int *y, int *w, int *h); 418 419 /** 420 * @brief Get the column width of the gutter 421 * 422 * @param[in] obj The object. 423 * 424 * @return The current column width of the gutter for the widget. 425 * 426 * @ingroup Elm_Code_Widget_Group 427 */ 428 EAPI int elm_code_widget_text_left_gutter_width_get(Elm_Code_Widget *obj); 429 430 /** 431 * @brief Get text between given positions 432 * 433 * @param[in] obj The object. 434 * @param[in] start_line The line of the first character to get 435 * @param[in] start_col The widget column of the first character to get 436 * @param[in] end_line The line of the last character to get 437 * @param[in] end_col The widget column of the last character to get 438 * 439 * @return The text content between start and end positions 440 * 441 * @ingroup Elm_Code_Widget_Group 442 */ 443 EAPI char *elm_code_widget_text_between_positions_get(Elm_Code_Widget *obj, unsigned int start_line, unsigned int start_col, unsigned int end_line, unsigned int end_col); 444 445 /** 446 * @brief Insert the provided text at the cursor position. This will add the 447 * operation to the widget's undo list. 448 * 449 * @param[in] obj The object. 450 * @param[in] text The text to insert 451 * 452 * @ingroup Elm_Code_Widget_Group 453 */ 454 EAPI void elm_code_widget_text_at_cursor_insert(Elm_Code_Widget *obj, const char *text); 455 456 /** 457 * @brief Get text column width at given position 458 * 459 * @param[in] obj The object. 460 * @param[in] line Code line 461 * @param[in] position Code position 462 * 463 * @return Text column width 464 * 465 * @ingroup Elm_Code_Widget_Group 466 */ 467 EAPI unsigned int elm_code_widget_line_text_column_width_to_position(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int position); 468 469 /** 470 * @brief Get text column width for code line 471 * 472 * @param[in] obj The object. 473 * @param[in] line Code line 474 * 475 * @return Text column width 476 * 477 * @ingroup Elm_Code_Widget_Group 478 */ 479 EAPI unsigned int elm_code_widget_line_text_column_width_get(Elm_Code_Widget *obj, Elm_Code_Line *line); 480 481 /** 482 * @brief Get position from column 483 * 484 * @param[in] obj The object. 485 * @param[in] line Code line 486 * @param[in] column Column 487 * 488 * @return Position 489 * 490 * @ingroup Elm_Code_Widget_Group 491 */ 492 EAPI unsigned int elm_code_widget_line_text_position_for_column_get(Elm_Code_Widget *obj, Elm_Code_Line *line, unsigned int column); 493 494 /** 495 * @brief Get tabwidth for column 496 * 497 * @param[in] obj The object. 498 * @param[in] column Column 499 * 500 * @return Tabwidth 501 * 502 * @ingroup Elm_Code_Widget_Group 503 */ 504 EAPI unsigned int elm_code_widget_text_tabwidth_at_column_get(Elm_Code_Widget *obj, unsigned int column); 505 506 /** 507 * @brief Toggle the display of the line status widget 508 * 509 * @param[in] obj The object. 510 * @param[in] line Code line 511 * 512 * @ingroup Elm_Code_Widget_Group 513 */ 514 EAPI void elm_code_widget_line_status_toggle(Elm_Code_Widget *obj, Elm_Code_Line *line); 515 516 /** Undo last action 517 * 518 * @ingroup Elm_Code_Widget_Group 519 */ 520 EAPI void elm_code_widget_undo(Elm_Code_Widget *obj); 521 522 /** 523 * @brief Determine if there are any available undo operations 524 * 525 * @param[in] obj The object. 526 * 527 * @return @c true if there are undo operations 528 * 529 * @ingroup Elm_Code_Widget_Group 530 */ 531 EAPI Eina_Bool elm_code_widget_can_undo_get(Elm_Code_Widget *obj); 532 533 /** Redo last action 534 * 535 * @ingroup Elm_Code_Widget_Group 536 */ 537 EAPI void elm_code_widget_redo(Elm_Code_Widget *obj); 538 539 /** 540 * @brief Determine if there are any available redo operations 541 * 542 * @param[in] obj The object. 543 * 544 * @return @c true if there are redo operations 545 * 546 * @ingroup Elm_Code_Widget_Group 547 */ 548 EAPI Eina_Bool elm_code_widget_can_redo_get(Elm_Code_Widget *obj); 549 550 #endif 551