efl/src/lib/elementary/elm_code_widget.eo

331 lines
12 KiB
Plaintext

/* FIXME: this widget should just implement a scroller */
enum @beta 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 @beta @extern Elm.Code; [[Elementary code main data structure]] /* The main interface currently defined in code */
struct @beta @extern Elm.Code_Line; [[Elementary code line data structure]] /* Parts of the interface currently defined in code */
class @beta Elm.Code_Widget extends Efl.Ui.Layout
{
[[Elementary code widget]]
c_prefix: efl_ui_code_widget;
methods {
@property code {
[[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.]]
set {
}
get {
}
values {
code: ptr(Elm.Code); [[Our underlying Elm.Code object]]
}
}
@property font {
[[Set the font that this widget uses, the font should be a monospaced scalable font.
Passing $NULL will load the default system monospaced font.
When reading, the font name is a copy and should be freed once it is no longer needed.]]
set {
}
get {
}
values {
name: string; [[The name of the font to load]]
size: int; [[The font size for the widget]]
}
}
@property columns {
[[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.]]
get {
}
values {
columns: uint; [[The number of columns required to render the widget]]
}
}
@property gravity {
[[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.]]
set {
}
get {
}
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 {
[[The widget's policy for scrollbar visibility.]]
set {
}
get {
}
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 {
[[The width of a tab stop, used purely for visual layout of tab characters.
Recommended value is between 2 and 8.]]
set {
}
get {
}
values {
tabstop: uint; [[Maximum width of a tab character]]
}
}
@property editable {
[[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.]]
set {
}
get {
[[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 {
[[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.]]
set {
}
get {
}
values {
line_numbers: bool; [[Whether or not line numbers (or their placeholder) should be shown]]
}
}
@property line_width_marker {
[[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.]]
set {
}
get {
}
values {
line_width_marker: uint; [[Where to display a line width marker, if at all]]
}
}
@property show_whitespace {
[[Whether white space should be shown.]]
set {
}
get {
}
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 {
[[Whether syntax highlighting should be use for this widget.]]
set {
}
get {
}
values {
syntax_enabled: bool; [[Whether or not to enable syntax highlighting]]
}
}
@property tab_inserts_spaces {
[[Whether space characters should be inserted instead of tabs.]]
set {
}
get {
}
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 {
[[The current location of the text cursor.]]
set {
}
get {
}
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]]
code,selection,start: Elm.Code_Widget; [[Called when a selection is started]]
code,selection,changed: Elm.Code_Widget; [[Called when selection changed]]
code,selection,cleared: Elm.Code_Widget; [[Called when selection was cleared]]
code,selection,cut: Elm.Code_Widget; [[Called when a cut action is performed]]
code,selection,copy: Elm.Code_Widget; [[Called when a copy action is performed]]
code,selection,paste: Elm.Code_Widget; [[Called when a paste action is performed]]
}
}