1 /* 2 * This file is part of EasyRPG Player. 3 * 4 * EasyRPG Player is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * EasyRPG Player is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef EP_WINDOW_KEYBOARD_H 19 #define EP_WINDOW_KEYBOARD_H 20 21 #include "window_base.h" 22 23 struct Keyboard_Layout; 24 25 /** 26 * Window Input Number Class. 27 * The number input window. 28 */ 29 class Window_Keyboard : public Window_Base { 30 public: 31 /** 32 * Constructor. 33 * 34 * @param ix window x position. 35 * @param iy window y position. 36 * @param iwidth window width. 37 * @param iheight window height. 38 * @param ndone_text text for the "Done" button. 39 */ 40 Window_Keyboard(int ix, int iy, int iwidth = 320, int iheight = 80, const char* ndone_text = DONE); 41 42 enum Mode { 43 Hiragana, 44 Katakana, 45 Hangul1, 46 Hangul2, 47 ZhCn1, 48 ZhCn2, 49 ZhTw1, 50 ZhTw2, 51 RuCyrl, 52 Letter, 53 Symbol, 54 MODE_END 55 }; 56 57 void UpdateCursorRect(); 58 Rect GetItemRect(int row, int col) const; 59 void Update() override; 60 void Refresh(); 61 void SetMode(Mode nmode, Mode nnext_mode); 62 std::string const& GetKey(int row, int col) const; 63 std::string const& GetSelected() const; 64 65 static const char* const DONE; 66 static const char* const SPACE; 67 static const char* const NEXT_PAGE; 68 static const char* const DONE_JP; 69 static const char* const DONE_KO; 70 static const char* const DONE_ZH_CN; 71 static const char* const DONE_ZH_TW; 72 static const char* const DONE_RU; 73 74 static const int row_max = 9; 75 static const int col_max = 10; 76 static Keyboard_Layout layouts[MODE_END]; 77 78 protected: 79 static const int border_x = 8; 80 static const int border_y = 4; 81 static const int min_width = 2; 82 83 std::string done_text; 84 int row_spacing; 85 int col_spacing; 86 Mode mode; 87 Mode next_mode; 88 int row; 89 int col; 90 91 bool play_cursor; 92 }; 93 94 95 /** 96 * Keyboard layout struct. 97 * Defines which keys are available and how the key to switch here is named 98 */ 99 struct Keyboard_Layout { 100 const std::string key_text; 101 const std::string items[Window_Keyboard::row_max][Window_Keyboard::col_max]; 102 }; 103 104 #endif 105