add more function comment for HowToWork-cn.md

This commit is contained in:
idea4good 2019-09-12 16:54:16 +08:00
parent bfcd714412
commit c14b2d3ac8
2 changed files with 34 additions and 11 deletions

View File

@ -45,15 +45,14 @@ FAQ: Error when open GuiLite project with Visual Studio, reconfigure the project
- Output here: /GuiLite/Objects/GuiLite.lib
## How to port?
Here are 2 options for porting. For option 1: you should build GuiLite library, and move all headers files & library to your project; For option 2: You do not need to build GuiLite library, just merge all GuiLite code into 1 header(GuiLite.h) & 1 source(GuiLite.cpp), then move the 2 files to your project.
Here are 2 options for porting.
We recommend option 2, because of:
- Easy to port - no need to buid library
- Easy to move - just 2 files
- Easy to manage header files - just 1 header file
- Easy to debug - no library binary
### Option 1: 1 Header & 1 Source
1. Execute `1h-1cpp.sh` to merge the whole source code into: 1 header(GuiLite.h) & 1 source(GuiLite.cpp)
2. Move GuiLite.h/GuiLite.cpp to your project
3. Rebuild your project
### Option 1: Header & Library
### Option 2: Headers & 1 Library
- Headers: core_include, widgets_include
- Library: The GuiLite library
1. Move core_include/widgets_include to your project
@ -61,7 +60,10 @@ We recommend option 2, because of:
3. Link GuiLite library to your project
4. Rebuild your project
### Option 2: Header & Source
1. Execute `1h-1cpp.sh` to merge the whole source code into: 1 header(GuiLite.h) & 1 source(GuiLite.cpp)
2. Move GuiLite.h/GuiLite.cpp to your project
3. Rebuild your project
We recommend option 1, because of:
- Easy to port - no need to buid library
- Easy to move - just 2 files
- Easy to manage header files - just 1 header file
- Easy to debug - no library binary
On the other hand, for option 2: you should build GuiLite library, and move all headers files & library to your project.

View File

@ -125,6 +125,27 @@ widgets:
| set_frame_layer_visible_rect | 设置指定图层的可视区域矩形可视区域会根据图层优先级自动进行上下叠加。rect可视矩形的位置信息z_order图层的z坐标图层坐标 |
| flush_screen | 将当前surface的指定矩形区域一次性刷在显示屏上。leftsurface指定区域的左边界坐标topsurface指定区域的上边界坐标rightsurface指定区域的右边界坐标bottomsurface指定区域的下边界坐标 |
| is_valid | 判断给定位置的矩形是否合理是否在surface的范围内。rect矩形区域的坐标信息 |
***
| 函数名称 | wnd.cpp 函数接口注释 |
| --- | --- |
| c_wnd | c_wnd构造函数进行基本初始化 |
| connect | 把自己this、自己的子窗口系列及父窗口连接起来形成完整的UI窗口链条连接完成后自己就可以响应用户输入及各种UI消息。parent父窗口resour_id窗口IDstr自己的窗口标题字符串x自己相对父窗口的坐标xy自己相对父窗口的坐标ywidth窗口宽度height窗口高度p_child_tree子窗口系列 |
| load_child_wnd | 把一系列子窗口连接起来形成完整的UI窗口链条连接完成后所有子窗口都可以响应用户输入及各种UI消息。p_child_tree子窗口系列 |
| disconnect | 把自己this跟父窗口、子窗口脱离连接切断自己与UI的联系不在响应用户输入及各种UI消息。 |
| get_wnd_ptr | 获得指定窗口ID的窗口指针。id窗口ID |
| set_attr | 设置窗口属性包括普通、失效、可见。attr属性值 |
| is_focus_wnd | 判断自己this是否可以获得焦点 |
| set_wnd_pos | 设置自己this相对于父窗口的窗口位置。x窗口左上角坐标xy窗口左上角坐标ywidth窗口宽度height窗口高度 |
| get_wnd_rect | 获取自己this相对于父窗口的位置信息。rect用于输出位置信息 |
| get_screen_rect | 获取自己this相对于UI系统的绝对位置信息。rect用于输出位置信息 |
| set_child_focus | 将自己this的一个子窗口设置为获得讲点状态。 focus_child获得焦点的子窗口|
| add_child_2_tail | 把一个子窗口添加到自己this的子窗口链表的尾部。child被添加的子窗口 |
| get_last_child | 获得自己this子窗口链表尾部的子窗口指针。 |
| unlink_child | 将自己this的子窗口从子窗口链表中脱离出来。child被脱链的子窗口 |
| show_window | 渲染自己this及自己的子窗口 |
| on_touch | 响应用户的触控消息。x用户触控点的坐标xy用户触控点的坐标yaction用户的触控类型包括按下释放 |
| on_key | 响应用户的按键消息。key用户点击的按键键值。 |
| notify_parent | 传递UI消息给自己this的父窗口并调用父窗口对应的响应函数。msg_id消息IDctrl_id自己的资源IDparam消息的参数 |
## 速成路线图
1. 精读源文件wnd.cpp中的connect, on_touch, on_key函数理解界面元素的串联办法理解响应触控操作的基本原理理解响应硬按键的基本原理