efl/src/lib/elementary/elm_code_widget.eo

345 lines
13 KiB
Plaintext

/* FIXME: this widget should just implement a scroller */
enum Elm.Code_Widget_Scroller_Policy
{
[[Type that controls when scrollbars should appear.
See also @Elm.Interface_Scrollable.policy.set.
]]
auto = 0, [[Show scrollbars as needed]]
on, [[Always show scrollbars]]
off, [[Never show scrollbars]]
last [[Sentinel value to indicate last enum field during iteration]]
}
/* FIXME: Those types make elm_code unusable from pure EO */
struct @extern Elm.Code; [[Elementary code main data structure]] /* The main interface currently defined in code */
struct @extern Elm.Code_Line; [[Elementary code line data structure]] /* Parts of the interface currently defined in code */
class Elm.Code_Widget extends Efl.Ui.Layout_Base
{
[[Elementary code widget]]
eo_prefix: efl_ui_code_widget;
methods {
@property code {
set {
[[Set the underlying code object that this widget renders.
This can only be set during construction, once the widget is created the
backing code object cannot be changed.]]
}
get {
[[Get the underlying code object we are rendering]]
}
values {
code: ptr(Elm.Code); [[Our underlying Elm.Code object]]
}
}
@property font {
set {
[[Set the font that this widget uses, the font should be a monospaced scalable font.
Passing NULL will load the default system monospaced font.]]
}
get {
[[Get the font currently in use.
The font name is a copy ad should be freed once it is no longer needed]]
}
values {
name: string; [[The name of the font to load]]
size: int; [[The font size for the widget]]
}
}
@property columns {
get {
[[Get the number of columns in the widget currently.
This will be the max of the number of columns to represent the longest line and
the minimum required to fill the visible widget width.]]
}
values {
columns: uint; [[The number of columns required to render the widget]]
}
}
@property gravity {
set {
[[Set how this widget's scroller should respond to new lines being added.
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
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.]]
}
get {
[[Get the current x and y gravity of the widget's scroller]]
}
values {
x: double; [[The horizontal value of the scroller gravity - valid values are 0.0 and 1.0]]
y: double; [[The vertical gravity of the widget's scroller - valid values are 0.0 and 1.0]]
}
}
@property policy {
set {
[[Set the policy for scrollbar visibility.]]
}
get {
[[Get the widget's policy for scrollbar visibility.]]
}
values {
policy_h: Elm.Code_Widget_Scroller_Policy; [[The horizontal scrollbar visibility policy]]
policy_v: Elm.Code_Widget_Scroller_Policy; [[The vertical scrollbar visibility policy]]
}
}
@property tabstop {
set {
[[Set the width of a tab stop, used purely for visual layout of tab characters.
Recommended value is between 2 and 8.]]
}
get {
[[Get the current width of a tab stop.
This is used to determine where characters after a tab should appear in the line.]]
}
values {
tabstop: uint; [[Maximum width of a tab character]]
}
}
@property editable {
set {
[[Set whether this widget allows editing
If editable then the widget will allow user input to manipulate
the underlying Elm.Code_File of this Elm.Code instance.
Any other Elm.Code_Widget's connected to this Elm.Code will
update to reflect the changes.]]
}
get {
[[Get the current editable state of this widget
returns EINA_TRUE if the widget is editable, EINA_FALSE otherwise.
If this widget is not editable the underlying Elm.Code_File could
still be manipulated by a different widget or the filesystem.]]
}
values {
editable: bool; [[The editable state of the widget]]
}
}
@property line_numbers {
set {
[[Set whether line numbers should be displayed in the left gutter.
Passing EINA_TRUE will reserve a space for showing line numbers,
EINA_FALSE will turn this off.]]
}
get {
[[Get the status of line number display for this widget.]]
}
values {
line_numbers: bool; [[Whether or not line numbers (or their placeholder) should be shown]]
}
}
@property line_width_marker {
set {
[[Set where the line width market should be shown.
Passing a non-zero value will set which line width to mark with a vertical line.
Passing 0 will hide this marker.]]
}
get {
[[Get the position of the line width marker, any positive return indicates where the marker appears.]]
}
values {
line_width_marker: uint; [[Where to display a line width marker, if at all]]
}
}
@property show_whitespace {
set {
[[Set whether white space should be shown.]]
}
get {
[[Get whether or not white space will be visible.]]
}
values {
show_whitespace: bool; [[Whether or not we show whitespace characters]]
}
}
@property alpha {
[[Set an alpha color value for this widget (0 - 255) default is fully opaque (255).]]
set {
}
get {
}
values {
alpha: int; [[Alpha value]]
}
}
@property syntax_enabled {
set {
[[Set whether syntax highlighting should be use for this widget.]]
}
get {
[[Get this widget's enabled state for syntax highlighting.]]
}
values {
syntax_enabled: bool; [[Whether or not to enable syntax highlighting]]
}
}
@property tab_inserts_spaces {
set {
[[Set whether space characters should be inserted instead of tabs.]]
}
get {
[[Get whether or not space characters will be inserted instead of tabs.]]
}
values {
tab_inserts_spaces: bool; [[$true if we should insert space characters instead of a tab when the Tab key is pressed]]
}
}
@property cursor_position {
set {
[[Set the current location of the text cursor.]]
}
get {
[[Get the current x and y position of the widget's cursor.]]
}
values {
row: uint; [[The vertical position ov the cursur - the fist row is 1]]
col: uint; [[The horizontal position of the cursor, starting from column 1]]
}
}
theme_refresh {
[[Update and refresh theme for widget.]]
}
line_refresh {
[[Refresh code line in widget]]
params {
line: ptr(Elm.Code_Line); [[The line to refresh.]]
}
}
line_visible_get {
[[Check if the code line is currently visible]]
params {
line: ptr(Elm.Code_Line); [[The line to test for visibility.]]
}
return: bool; [[$true if the line specified is currently visible within the scroll region.]]
}
lines_visible_get {
[[Get the number of code lines currently visible in the widget]]
return: uint; [[the number of lines currently visible in the widget.]]
}
position_at_coordinates_get {
[[Get the row, col position for a given coordinate on the widget.]]
params {
x: int; [[The x coordinate in the widget]]
y: int; [[The y coordinate in the widget]]
row: ptr(uint); [[The row for the coordinates]]
col: ptr(int); [[The column for the coordinates]]
}
return: bool; [[$true if a line exists at these coordinates]]
}
geometry_for_position_get {
[[Get the geometry for the cell at the specified position.]]
params {
row: uint; [[The row for the requested position]]
col: int; [[The column for the requested position]]
x: ptr(int); [[The x coordinate of the cell at specified position]]
y: ptr(int); [[The y coordinate of the cell at specified position]]
w: ptr(int); [[The width of the cell at specified position]]
h: ptr(int); [[The height of the cell at specified position]]
}
return: bool; [[$true if a cell exists at the specified position]]
}
text_left_gutter_width_get {
[[Get the column width of the gutter]]
return: int; [[The current column width of the gutter for the widget.]]
}
text_between_positions_get {
[[Get text between given positions]]
params {
start_line: uint; [[The line of the first character to get]]
start_col: uint; [[The widget column of the first character to get]]
end_line: uint; [[The line of the last character to get]]
end_col: uint; [[The widget column of the last character to get]]
}
return: ptr(char); [[The text content between start and end positions]]
}
text_at_cursor_insert {
[[Insert the provided text at the cursor position.
This will add the operation to the widget's undo list.]]
params {
text: string; [[The text to insert]]
}
}
line_text_column_width_to_position {
[[Get text column width at given position]]
params {
line: ptr(Elm.Code_Line); [[Code line]]
position: uint; [[Code position]]
}
return: uint; [[Text column width]]
}
line_text_column_width_get {
[[Get text column width for code line]]
params {
line: ptr(Elm.Code_Line); [[Code line]]
}
return: uint; [[Text column width]]
}
line_text_position_for_column_get {
[[Get position from column]]
params {
line: ptr(Elm.Code_Line); [[Code line]]
column: uint; [[Column]]
}
return: uint; [[Position]]
}
text_tabwidth_at_column_get {
[[Get tabwidth for column]]
params {
column: uint; [[Column]]
}
return: uint; [[Tabwidth]]
}
line_status_toggle {
[[Toggle the display of the line status widget]]
params {
line: ptr(Elm.Code_Line); [[Code line]]
}
}
undo {
[[Undo last action]]
}
can_undo_get {
[[Determine if there are any available undo operations]]
return: bool; [[$true if there are undo operations]]
}
redo {
[[Redo last action]]
}
can_redo_get {
[[Determine if there are any available redo operations]]
return: bool; [[$true if there are redo operations]]
}
}
implements {
class.constructor;
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Ui.Widget.theme_apply;
}
constructors {
.code;
}
events {
line,clicked: Elm.Code_Line; [[Called when text line was clicked]]
line,gutter,clicked: Elm.Code_Line; [[Called when gutter was clicked]]
changed,user: void; [[Called when object changed due to user interaction]]
/* FIXME: All events below send the obj in the event_info, which is redundant */
cursor,changed: Elm.Code_Widget; [[Called when cursor changed]]
selection,start: Elm.Code_Widget; [[Called when a selection is started]]
selection,changed: Elm.Code_Widget; [[Called when selection changed]]
selection,cleared: Elm.Code_Widget; [[Called when selection was cleared]]
selection,cut: Elm.Code_Widget; [[Called when a cut action is performed]]
selection,copy: Elm.Code_Widget; [[Called when a copy action is performed]]
selection,paste: Elm.Code_Widget; [[Called when a paste action is performed]]
}
}