diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/input_method/main.cpp | 20 | ||||
-rw-r--r-- | demos/main/main.cpp | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/demos/input_method/main.cpp b/demos/input_method/main.cpp index b109f5e7..215eba16 100644 --- a/demos/input_method/main.cpp +++ b/demos/input_method/main.cpp @@ -31,19 +31,19 @@ int main() { auto target_clause_brush = graph_factory->CreateSolidColorBrush(); target_clause_brush->SetColor(colors::blue); - std::shared_ptr<IFont> font = graph_factory->CreateFont("等线", 30); + std::shared_ptr<IFont> font = graph_factory->CreateFont(u"等线", 30); float window_width = 10000; auto prompt_text_layout = graph_factory->CreateTextLayout(font, - "Alt+F1: Enable IME\n" - "Alt+F2: Disable IME\n" - "Alt+F3: Complete composition.\n" - "Alt+F4: Cancel composition."); + u"Alt+F1: Enable IME\n" + u"Alt+F2: Disable IME\n" + u"Alt+F3: Complete composition.\n" + u"Alt+F4: Cancel composition."); std::optional<CompositionText> optional_composition_text; - std::string committed_text; + std::u16string committed_text; window->ResizeEvent()->AddHandler( [&prompt_text_layout, &window_width](const Size& size) { @@ -60,9 +60,9 @@ int main() { const auto anchor_y = prompt_text_layout->GetTextBounds().height; auto text_layout = graph_factory->CreateTextLayout( - font, - committed_text + - (optional_composition_text ? optional_composition_text->text : "")); + font, committed_text + (optional_composition_text + ? optional_composition_text->text + : u"")); text_layout->SetMaxWidth(window_width); if (optional_composition_text) { @@ -123,7 +123,7 @@ int main() { }); input_method_context->TextEvent()->AddHandler( - [window, &committed_text](const std::string_view& c) { + [window, &committed_text](const std::u16string_view& c) { committed_text += c; window->RequestRepaint(); }); diff --git a/demos/main/main.cpp b/demos/main/main.cpp index 832ef75e..a0d4cd88 100644 --- a/demos/main/main.cpp +++ b/demos/main/main.cpp @@ -34,15 +34,15 @@ int main() { const auto button = Button::Create(); const auto text_block1 = TextBlock::Create(); - text_block1->SetText("Hello World!"); + text_block1->SetText(u"Hello World!"); button->SetChild(text_block1); flex_layout->AddChild(button, 0); const auto text_block2 = TextBlock::Create(); - text_block2->SetText("Hello World!"); + text_block2->SetText(u"Hello World!"); const auto text_block3 = TextBlock::Create(); - text_block3->SetText("Overlapped text"); + text_block3->SetText(u"Overlapped text"); const auto stack_layout = StackLayout::Create(); stack_layout->AddChild(text_block2, 0); @@ -50,7 +50,7 @@ int main() { flex_layout->AddChild(stack_layout, 1); const auto text_block4 = TextBlock::Create(); - text_block4->SetText("Hello World!!!"); + text_block4->SetText(u"Hello World!!!"); flex_layout->AddChild(text_block4, 2); window->GetUiHost()->GetNativeWindowResolver()->Resolve()->SetVisible(true); |