if (line->number == 1)
elm_code_line_token_add(line, 17, 24, 1, ELM_CODE_TOKEN_TYPE_COMMENT);
- else if (line->number == 4)
- line->status = ELM_CODE_STATUS_TYPE_ERROR;
+ else if (line->number == 2)
+ {
+ line->status = ELM_CODE_STATUS_TYPE_ERROR;
+ line->status_text = " -> This warning is important!";
+ }
efl_event_callback_stop(event->object);
}
_elm_code_test_welcome_setup(Evas_Object *parent)
{
Elm_Code *code;
+ Elm_Code_Line *line;
Elm_Code_Widget *widget;
code = elm_code_create();
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code);
_append_line(code->file, "❤ Hello World, Elm Code! ❤");
+ _append_line(code->file, "*** Currently experimental ***");
_append_line(code->file, "");
_append_line(code->file, "This is a demo of elm_code's capabilities.");
- _append_line(code->file, "⚑ *** Currently experimental ***");
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_code_widget_selection_start(widget, 1, 3);
elm_code_widget_selection_end(widget, 1, 13);
+ line = elm_code_file_line_get(code->file, 2);
+ elm_code_widget_line_status_toggle(widget, line);
+
return widget;
}
return !!line && col <= (int) length;
}
-static void
-_elm_code_widget_status_toggle(Elm_Code_Widget *widget, Elm_Code_Line *line)
+EOLIAN static void
+_elm_code_widget_line_status_toggle(Elm_Code_Widget *widget EINA_UNUSED, Elm_Code_Widget_Data *pd,
+ Elm_Code_Line *line)
{
Evas_Object *status, *grid;
- Elm_Code_Widget_Data *pd;
+ const char *template = "<color=#8B8B8B>%s</color>";
+ char *text;
// add a status below the line if needed (and remove those no longer needed)
- pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
grid = eina_list_nth(pd->grids, line->number - 1);
status = evas_object_data_get(grid, "status");
elm_box_pack_after(pd->gridbox, status, grid);
evas_object_data_set(grid, "status", status);
- elm_object_text_set(status, line->status_text);
+
+ text = malloc((strlen(template) + strlen(line->status_text) + 1) * sizeof(char));
+ sprintf(text, template, line->status_text);
+ elm_object_text_set(status, text);
+ free(text);
}
}
if (line->status_text)
{
- _elm_code_widget_status_toggle(widget, line);
+ elm_code_widget_line_status_toggle(widget, line);
return;
}
[[Get the column width of the gutter]]
return: int; [[The current column width of the gutter for the widget.]]
}
- text_line_number_width_get {
- [[Get the required column width]]
- return: int; [[The column width required to represent the number of lines in the widget.]]
- }
text_between_positions_get {
[[Get text between given positions]]
params {
}
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]]
}