Files

44 lines
966 B
C++
Raw Permalink Normal View History

2021-07-31 22:17:48 +08:00
#include "pch.h"
#include <LCUI.h>
2024-09-17 23:56:43 +08:00
#include <ptk.h>
2023-03-19 22:27:01 +08:00
#include <ui.h>
#include <LCUI/widgets/text.h>
#include <LCUI/widgets/textinput.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);
};
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];
ui_widget_t* edit = ui_get_widget("edit");
ui_widget_t* txt = ui_get_widget("text-hello");
2023-10-15 20:08:26 +08:00
ui_textinput_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)
{
ui_widget_t* btn, root, pack;
root = ui_root();
pack = ui_load_xml_file("helloworld.xml");
2021-07-31 22:17:48 +08:00
if (!pack) {
return;
}
ui_widget_append(root, pack);
ui_widget_unwrap(pack);
btn = ui_get_widget("btn");
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;
}