#include "OSK.h" #include "starlight/ThemeManager.h" #include "starlight/InputManager.h" #include "starlight/GFXManager.h" #include "starlight/gfx/Font.h" #include "starlight/ui/Image.h" #include "starlight/ui/Button.h" #include "starlight/ui/Label.h" #include "starlight/ui/ScrollField.h" #include "starlight/ConfigManager.h" using std::string; using starlight::ThemeManager; using starlight::InputManager; using starlight::GFXManager; using starlight::gfx::Font; using starlight::ui::Image; using starlight::ui::Button; using starlight::ui::Label; using starlight::ui::ScrollField; using starlight::ui::DrawLayerProxy; using starlight::ui::Form; using starlight::dialog::OSK; namespace { inline starlight::TextConfig& PreviewTC() { static auto tc = ThemeManager::GetMetric("/dialogs/OSK/preview"); return tc; } const constexpr float textHang = 4; } OSK::OSK(osk::InputHandler* handler) : Form(true), handler(handler) { priority = 1000; // probably don't want all that much displaying above the keyboard handler->parent = this; auto cover = std::make_shared(touchScreen->rect, "decorations/osk.background"); cover->blockTouch = true; touchScreen->Add(cover); // wip setContainer = std::make_shared(VRect::touchScreen); touchScreen->Add(setContainer); auto actSym = [this](Button& key){ this->handler->InputSymbol(key.label); this->OnKey(); }; Vector2 bs(24, 32); Vector2 bpen; Vector2 bpstart(160-bs.x*(12.5/2), 68+5); int line = -1; float linestart [] = {0, .5, .75, 1.25, 2.75-1}; string chr = "\n1234567890-=\nqwertyuiop[]\nasdfghjkl;\'\nzxcvbnm,./\n` \\"; string Chr = "\n!@#$%^&*()_+\nQWERTYUIOP{}\nASDFGHJKL:\"\nZXCVBNM<>?\n~ |"; for (unsigned int ic = 0; ic < chr.length(); ic++) { char& c = chr[ic]; char& C = Chr[ic]; if (c == '\n') { line++; bpen = bpstart + Vector2(linestart[line] * bs.x, bs.y * line); } else { // lower auto key = std::make_shared