2021-07-31 22:17:48 +08:00
|
|
|
#include "pch.h"
|
|
|
|
|
#include <LCUI.h>
|
2023-03-18 23:54:25 +08:00
|
|
|
#include <platform.h>
|
2023-03-19 22:27:01 +08:00
|
|
|
#include <ui.h>
|
2023-05-14 21:39:33 +08:00
|
|
|
#include <ui_widgets/text.h>
|
2023-03-19 22:27:01 +08:00
|
|
|
#include <ui_widgets/textedit.h>
|
2023-04-29 23:38:26 +08:00
|
|
|
#include <ui_xml.h>
|
2021-07-31 22:17:48 +08:00
|
|
|
#include LCUI_APP_H
|
|
|
|
|
|
|
|
|
|
class App : public LCUI::Application
|
|
|
|
|
{
|
|
|
|
|
void Load(Platform::String ^ entryPoint);
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-08 22:32:07 +08:00
|
|
|
static void OnBtnClick(ui_widget_t* self, ui_event_t* e, void *arg)
|
2021-07-31 22:17:48 +08:00
|
|
|
{
|
|
|
|
|
wchar_t str[256];
|
2021-08-08 22:32:07 +08:00
|
|
|
ui_widget_t* edit = ui_get_widget("edit");
|
|
|
|
|
ui_widget_t* txt = ui_get_widget("text-hello");
|
2022-02-04 20:39:17 +08:00
|
|
|
ui_textedit_get_text_w(edit, 0, 255, str);
|
2023-05-14 21:39:33 +08:00
|
|
|
ui_text_set_content_w(txt, str);
|
2021-07-31 22:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void App::Load(Platform::String ^ entryPoint)
|
|
|
|
|
{
|
2021-08-08 22:32:07 +08:00
|
|
|
ui_widget_t* btn, root, pack;
|
|
|
|
|
root = ui_root();
|
2022-02-03 16:19:29 +08:00
|
|
|
pack = ui_load_xml_file("helloworld.xml");
|
2021-07-31 22:17:48 +08:00
|
|
|
if (!pack) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-08-08 22:32:07 +08:00
|
|
|
ui_widget_append(root, pack);
|
|
|
|
|
ui_widget_unwrap(pack);
|
|
|
|
|
btn = ui_get_widget("btn");
|
2023-05-20 23:06:13 +08:00
|
|
|
ui_widget_on(btn, "click", OnBtnClick, NULL);
|
2021-07-31 22:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Platform::MTAThread] int main(Platform::Array<Platform::String ^> ^) {
|
|
|
|
|
App app;
|
|
|
|
|
LCUI::Initialize();
|
|
|
|
|
LCUI::Run(app);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|