布局测试
This commit is contained in:
parent
976994e85b
commit
2a84cd6c4e
@ -2,7 +2,9 @@
|
||||
#include "window/mwindow.h"
|
||||
#include "font/font_system.h"
|
||||
#include "widget/widget_new.h"
|
||||
#include "widget/compound_widget/mbutton.h"
|
||||
#include "widget/leaf_widget/mtext_block.h"
|
||||
#include "widget/panel_widget/mbox.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
@ -14,10 +16,28 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
const auto& text_block = std::make_shared<mtext_block>();
|
||||
text_block->set_text(U"Hello, World! 你好,世界!😀");
|
||||
// text_block->set_text(U"😀");
|
||||
|
||||
const auto& text_block2 = std::make_shared<mtext_block>();
|
||||
text_block2->set_text(U"Hello, World!");
|
||||
|
||||
const auto button = std::make_shared<mbutton>();
|
||||
button->set_content(text_block);
|
||||
|
||||
const auto button2 = std::make_shared<mbutton>();
|
||||
button2->set_content(text_block2);
|
||||
|
||||
const auto& window = mwindow::create({ 1024, 1024 }, L"Hello, World!");
|
||||
window->set_content(text_block);
|
||||
window->set_content(
|
||||
mnew(mh_box)
|
||||
mslot(mh_box)
|
||||
[
|
||||
button
|
||||
]
|
||||
mslot(mh_box)
|
||||
[
|
||||
button2
|
||||
]
|
||||
);
|
||||
|
||||
mirage_app::get().run();
|
||||
return 0;
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
mbutton::mbutton() {
|
||||
color_ = {0.5, 0.5, 0.5, 1};
|
||||
slot_.h_alignment(horizontal_alignment_t::center);
|
||||
slot_.v_alignment(vertical_alignment_t::center);
|
||||
}
|
||||
|
||||
void mbutton::init() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user