awtk/tests/testdata/fixed.h

1118 lines
31 KiB
C
Raw Normal View History

2023-03-03 17:05:38 +08:00
/**
* File: apidoc_test.h
* Author: AWTK Develop Team
* Brief:
*
* Copyright (c) 2023 - 2023 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2023-03-03 Wang JunSheng <wangjunsheng@zlg.cn> created
*
*/
#ifndef TK_CODE_EDIT_H
#define TK_CODE_EDIT_H
#include "base/widget.h"
#include "code_complete.h"
BEGIN_C_DECLS
/**
* @class code_edit_t
* @parent widget_t
* @annotation ["scriptable","design","widget"]
*
*
* xml中使用"code\_edit"
*
* ```xml
* <!-- ui -->
* <code_edit name="code_edit" x="10" y="10" w="200" h="200" tab_width="2">
* <scroll_bar_d name="scroll_bar" x="r" y="0" w="14" h="100%" value="0"/>
* </code_edit>
* ```
*
* style来设置控件的显示风格
*
* ```xml
* <!-- style -->
* <code_edit>
* <style name="default" border_color="black" font_size="18">
* <normal text_color="black" />
* </style>
* </code_edit>
* ```
*/
typedef struct _code_edit_t {
widget_t widget;
/**
* @property {char*} lang
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
char* lang;
/**
* @property {const char*} code_theme
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
* (xml目录必须有相应的xml文件存在nodepad++)
*/
const char* code_theme;
/**
* @property {char*} filename
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
char* filename;
/**
* @property {bool_t} show_line_number
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t show_line_number;
/**
* @property {bool_t} readonly
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t readonly;
/**
* @property {bool_t} wrap_word
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t wrap_word;
/**
* @property {uint32_t} tab_width
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
* tab的宽度
*/
uint32_t tab_width;
/**
* @property {int32_t} scroll_line
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
int32_t scroll_line;
/**
* @property {int32_t} zoom
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
int32_t zoom;
/**
* @property {int32_t} line_number_margin
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
* (32)
*/
int32_t line_number_margin;
/**
* @property {int32_t} symbol_margin
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
int32_t symbol_margin;
/**
* @property {bool_t} fold
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t fold;
/**
* @property {int32_t} fold_symbol_margin
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
int32_t fold_symbol_margin;
/**
* @property {bool_t} end_at_last_line
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t end_at_last_line;
/**
* @property {bool_t} is_utf8_bom
* @annotation ["get_prop","readable","persitent","design","scriptable"]
* utf8_bom
*/
bool_t is_utf8_bom;
/*private*/
int32_t lexer;
void* impl;
str_t text;
ca_symbols_t* symbols;
} code_edit_t;
/**
* @method code_edit_create
* @annotation ["constructor", "scriptable"]
* code_edit对象
* @param {widget_t*} parent
* @param {xy_t} x x坐标
* @param {xy_t} y y坐标
* @param {wh_t} w
* @param {wh_t} h
*
* @return {widget_t*} code_edit对象
*/
2023-04-14 18:10:22 +08:00
static inline widget_t* code_edit_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
2023-03-03 17:05:38 +08:00
/**
* @method code_edit_cast
* code_edit对象(使)
* @annotation ["cast", "scriptable"]
* @param {widget_t*} widget code_edit对象
*
* @return {widget_t*} code_edit对象
*/
widget_t* code_edit_cast(widget_t* widget);
/**
* @method code_edit_set_lang
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} lang
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_lang(widget_t* widget, const char* lang);
/**
* @method code_edit_set_code_theme
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} code_theme
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_code_theme(widget_t* widget, const char* code_theme);
/**
* @method code_edit_set_filename
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} filename
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_filename(widget_t* widget, const char* filename);
/**
* @method code_edit_set_show_line_number
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} show_line_number
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_show_line_number(widget_t* widget, bool_t show_line_number);
/**
* @method code_edit_set_readonly
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} readonly
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_readonly(widget_t* widget, bool_t readonly);
/**
* @method code_edit_set_tab_width
* tab的宽度
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {uint32_t} tab_width tab的宽度
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_tab_width(widget_t* widget, uint32_t tab_width);
/**
* @method code_edit_set_zoom
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} zoom
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_zoom(widget_t* widget, int32_t zoom);
/**
* @method code_edit_set_line_number_margin
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} margin
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_line_number_margin(widget_t* widget, int32_t margin);
/**
* @method code_edit_set_symbol_margin
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} margin
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_symbol_margin(widget_t* widget, int32_t margin);
/**
* @method code_edit_set_fold_symbol_margin
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} margin
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_fold_symbol_margin(widget_t* widget, int32_t margin);
/**
* @method code_edit_set_fold
* /
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} fold
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_fold(widget_t* widget, bool_t fold);
/**
* @method code_edit_set_end_at_last_line
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} end_at_last_line
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_end_at_last_line(widget_t* widget, bool_t end_at_last_line);
/**
* @method code_edit_set_wrap_word
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} wrap_word
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_wrap_word(widget_t* widget, bool_t wrap_word);
/**
* @method code_edit_set_scroll_line
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} scroll_line
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_scroll_line(widget_t* widget, int32_t scroll_line);
/**
* @method code_edit_insert_text
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} offset
* @param {const char*} text
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_insert_text(widget_t* widget, int32_t offset, const char* text);
/**
* @method code_edit_replace_sel
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} text
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_replace_sel(widget_t* widget, const char* text);
/**
* @method code_edit_set_sel
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} anchor
* @param {int64_t} caret
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_sel(widget_t* widget, int64_t anchor, int64_t caret);
/**
* @method code_edit_delete_range
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} start
* @param {int64_t} length
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_delete_range(widget_t* widget, int64_t start, int64_t length);
/**
* @method code_edit_redo
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_redo(widget_t* widget);
/**
* @method code_edit_undo
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_undo(widget_t* widget);
/**
* @method code_edit_empty_undo_buffer
* undo缓存
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_empty_undo_buffer(widget_t* widget);
/**
* @method code_edit_set_save_point
* save point
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_save_point(widget_t* widget);
/**
* @method code_edit_copy
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_copy(widget_t* widget);
/**
* @method code_edit_cut
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_cut(widget_t* widget);
/**
* @method code_edit_paste
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_paste(widget_t* widget);
/**
* @method code_edit_clear
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_clear(widget_t* widget);
/**
* @method code_edit_clear_selection
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_clear_selection(widget_t* widget);
/**
* @method code_edit_clear_all
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_clear_all(widget_t* widget);
/**
* @method code_edit_select_none
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_select_none(widget_t* widget);
/**
* @method code_edit_select_all
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_select_all(widget_t* widget);
/**
* @method code_edit_can_redo
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示能
*/
bool_t code_edit_can_redo(widget_t* widget);
/**
* @method code_edit_can_undo
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示能
*/
bool_t code_edit_can_undo(widget_t* widget);
/**
* @method code_edit_can_copy
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示能
*/
bool_t code_edit_can_copy(widget_t* widget);
/**
* @method code_edit_can_cut
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示能
*/
bool_t code_edit_can_cut(widget_t* widget);
/**
* @method code_edit_can_paste
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示能
*/
bool_t code_edit_can_paste(widget_t* widget);
/**
* @method code_edit_save
* save
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} filename
* @param {bool_t} with_utf8_bom bom
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_save(widget_t* widget, const char* filename, bool_t with_utf8_bom);
/**
* @method code_edit_load
* load
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} filename
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_load(widget_t* widget, const char* filename);
/**
* @method code_edit_is_modified
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {bool_t} TRUE表示是
*/
bool_t code_edit_is_modified(widget_t* widget);
/**
* @method code_edit_scroll_range
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} secondary
* @param {int64_t} primary
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_scroll_range(widget_t* widget, int64_t secondary, int64_t primary);
/**
* @method code_edit_set_x_caret_policy
* x轴浮标策略
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} policy
* @param {int32_t} slop
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_x_caret_policy(widget_t* widget, int32_t policy, int32_t slop);
/**
* @method code_edit_get_current_pos
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_get_current_pos(widget_t* widget);
/**
* @method code_edit_word_start
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {int64_t}
*/
int64_t code_edit_word_start(widget_t* widget, int64_t pos);
/**
* @method code_edit_word_end
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_word_end(widget_t* widget, int64_t pos);
/**
* @method code_edit_get_text_range
*
* @annotation ["scriptable1"]
* @param {widget_t*} widget widget对象
* @param {int64_t} start
* @param {int64_t} end
* @param {char*} buf
* @param {int32_t} buf_capacity buf的容量
*
* @return {ret_t} RET_OK表示成功
*/
2023-04-14 18:10:22 +08:00
ret_t code_edit_get_text_range(widget_t* widget, int64_t start, int64_t end, char* buf,
int32_t buf_capacity);
2023-03-03 17:05:38 +08:00
/**
* @method code_edit_get_text_bom
* utf8_bom, bom
* 使 code_edit_free
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t*} len
*
* @return {char*} RET_OK表示成功
*/
char* code_edit_get_text_bom(widget_t* widget, int64_t* len);
/**
* @method code_edit_free
* s
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {void*} s
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_free(void* s);
/**
* @method code_edit_get_word
* pos所在的单词
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
* @param {char*} buf
* @param {int32_t} buf_capacity buf的容量
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_get_word(widget_t* widget, int64_t pos, char* buf, int32_t buf_capacity);
/**
* @method code_edit_get_line
* pos所在行的内容
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
* @param {char*} buf
* @param {int32_t} buf_capacity buf的容量
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_get_line(widget_t* widget, int64_t pos, char* buf, int32_t buf_capacity);
/**
* @method code_edit_get_text_length
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_get_text_length(widget_t* widget);
/**
* @method code_edit_set_current_pos
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_current_pos(widget_t* widget, int64_t pos);
/**
* @method code_edit_get_anchor
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_get_anchor(widget_t* widget);
/**
* @method code_edit_set_anchor
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_anchor(widget_t* widget, int64_t pos);
/**
* @method code_edit_scroll_caret
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_scroll_caret(widget_t* widget);
/**
* @method code_edit_get_first_visible_line
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_get_first_visible_line(widget_t* widget);
/**
* @method code_edit_set_first_visible_line
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} line
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_first_visible_line(widget_t* widget, int64_t line);
/**
* @method code_edit_is_line_visible
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} line
*
* @return {bool_t} line行是否可见
*/
bool_t code_edit_is_line_visible(widget_t* widget, int64_t line);
/**
* @method code_edit_goto_pos
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_goto_pos(widget_t* widget, int64_t pos);
/**
* @method code_edit_get_line_from_position
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {int64_t}
*/
2023-04-14 18:10:22 +08:00
int64_t code_edit_get_line_from_position(widget_t* widget, int64_t pos);
2023-03-03 17:05:38 +08:00
/**
* @method code_edit_get_line_start
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @param {int64_t} line
*
* @return {int64_t}
*/
int64_t code_edit_get_line_start(widget_t* widget, int64_t line);
/**
* @method code_edit_get_line_end
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} line
*
* @return {int64_t}
*/
int64_t code_edit_get_line_end(widget_t* widget, int64_t line);
/**
* @method code_edit_get_lines_on_screen
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {int64_t}
*/
int64_t code_edit_get_lines_on_screen(widget_t* widget);
/**
* @method code_edit_set_all_font_size
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {uint32_t} size
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_all_font_size(widget_t* widget, uint32_t size);
/**
* @method code_edit_set_reloaded_text
* reload的字符串setText的区别是不会回滚到第一行
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} text
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_reloaded_text(widget_t* widget, const char* text);
/**
* @method code_edit_vertical_centre_caret
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_vertical_centre_caret(widget_t* widget);
/**
* @method code_edit_show_autoc
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {ca_symbols_t*} symbols
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_show_autoc(widget_t* widget, ca_symbols_t* symbols);
/**
* @method code_edit_cancel_autoc
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_cancel_autoc(widget_t* widget);
/**
* @method code_edit_set_autoc_visible_lines
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int32_t} lines
*
* @return {ret_t} RET_OK表示成功
*/
ret_t code_edit_set_autoc_visible_lines(widget_t* widget, int32_t lines);
/**
* @method code_edit_is_comment
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {int64_t} pos
*
* @return {bool_t} TRUE FALSE
*/
bool_t code_edit_is_comment(widget_t* widget, int64_t pos);
/**
* @enum code_edit_prop_t
* @annotation ["scriptable", "string1"]
* @prefix CODE_EDIT_PROP_
*
*/
/**
* @const CODE_EDIT_PROP_LANG
*
*/
#define CODE_EDIT_PROP_LANG "lang"
/**
* @const CODE_EDIT_PROP_FILENAME
*
*/
#define CODE_EDIT_PROP_FILENAME "filename"
/**
* @const CODE_EDIT_PROP_TAB_WIDTH
* tab宽度
*/
#define CODE_EDIT_PROP_TAB_WIDTH "tab_width"
/**
* @const CODE_EDIT_PROP_CODE_THEME
*
*/
#define CODE_EDIT_PROP_CODE_THEME "code_theme"
/**
* @const CODE_EDIT_PROP_SHOW_LINE_NUMBER
*
*/
#define CODE_EDIT_PROP_SHOW_LINE_NUMBER "show_line_number"
/**
* @const CODE_EDIT_PROP_ZOOM
* ZOOM
*/
#define CODE_EDIT_PROP_ZOOM "zoom"
/**
* @const CODE_EDIT_PROP_LINE_NUMBER_MARGIN
* LINE_NUMBER_MARGIN
*/
#define CODE_EDIT_PROP_LINE_NUMBER_MARGIN "line_number_margin"
/**
* @const CODE_EDIT_PROP_SYMBOL_MARGIN
* SYMBOL_MARGIN
*/
#define CODE_EDIT_PROP_SYMBOL_MARGIN "symbol_margin"
/**
* @const CODE_EDIT_PROP_FOLD
* FOLD
*/
#define CODE_EDIT_PROP_FOLD "fold"
/**
* @const CODE_EDIT_PROP_FOLD_SYMBOL_MARGIN
* FOLD_SYMBOL_MARGIN
*/
#define CODE_EDIT_PROP_FOLD_SYMBOL_MARGIN "fold_symbol_margin"
/**
* @const CODE_EDIT_PROP_WRAP_WORD
*
*/
#define CODE_EDIT_PROP_WRAP_WORD "wrap_word"
/**
* @const CODE_EDIT_PROP_SCROLL_LINE
*
*/
#define CODE_EDIT_PROP_SCROLL_LINE "scroll_line"
/**
* @const CODE_EDIT_PROP_CURRENT_POSITION
*
*/
#define CODE_EDIT_PROP_CURRENT_POSITION "current_position"
/**
* @const CODE_EDIT_PROP_ANCHOR
*
*/
#define CODE_EDIT_PROP_ANCHOR "anchor"
/**
* @const CODE_EDIT_PROP_CURSOR
*
*/
#define CODE_EDIT_PROP_CURSOR "cursor"
/**
* @const CODE_EDIT_PROP_SELECTION_START
*
*/
#define CODE_EDIT_PROP_SELECTION_START "selection_start"
/**
* @const CODE_EDIT_PROP_SELECTION_END
*
*/
#define CODE_EDIT_PROP_SELECTION_END "selection_end"
/**
* @enum widget_type_t
* @annotation ["scriptable", "string"]
* @prefix WIDGET_TYPE_
*
*/
/**
* @const WIDGET_TYPE_CODE_EDIT
*
*/
#define WIDGET_TYPE_CODE_EDIT "code_edit"
#define CODE_EDIT(widget) ((code_edit_t*)(code_edit_cast(WIDGET(widget))))
/**public for ScintillaAWTK*/
2023-04-14 18:10:22 +08:00
#define PROP_CODE_EDITOR_FONT_SIZE \
"CODE_EDITOR_FONT_SIZE" // designer设置了代码编辑器的字体大小后要设置值为字号的此属性到wm。
#define EVT_GLOBAL_CODE_EDITOR_FONT_SIZE_CHANGED \
EVT_USER_START + 1 // designer设置了代码编辑器的字体大小后要从wm派发这个事件。
#define _SC_MARGE_LINENUMBER 0 // 第0条marge为行号
2023-03-03 17:05:38 +08:00
#define _SC_MARGE_SYBOLE 1 // 第1条marge为断点等
#define _SC_MARGE_FOLDER 2 // 第2条marge为折叠符号
#define _CODE_EDIT_DEFAULT_LINE_NUMBER_WITH 32
/*public for subclass and runtime type check*/
TK_EXTERN_VTABLE(code_edit);
/*public for vtable*/
ret_t code_edit_on_destroy(widget_t* widget);
ret_t code_edit_on_event(widget_t* widget, event_t* e);
ret_t code_edit_on_paint_self(widget_t* widget, canvas_t* c);
ret_t code_edit_on_add_child(widget_t* widget, widget_t* child);
ret_t code_edit_get_prop(widget_t* widget, const char* name, value_t* v);
ret_t code_edit_set_prop(widget_t* widget, const char* name, const value_t* v);
/**
* @enum ret_t
* @prefix RET_
* @annotation ["scriptable"]
*
*/
typedef enum _ret_t {
/**
* @const RET_OK
*
*/
RET_OK = 0,
/**
* @const RET_OOM
* Out of memory
*/
RET_OOM,
} ret_t;
/**
* @enum kind_t
* @annotation ["scriptable"]
* @prefix KIND_
*
*/
typedef enum _kind_t {
/**
* @const KIND_OK
*
*/
KIND_OK = 0,
/**
* @const KIND_OOM
* Out of memory
*/
KIND_OOM,
} kind_t;
END_C_DECLS
#endif /*TK_CODE_EDIT_H*/