Root/
| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2006 by Massimiliano Torromeo * |
| 3 | * massimiliano.torromeo@gmail.com * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #ifndef INPUTDIALOG_H_ |
| 22 | #define INPUTDIALOG_H_ |
| 23 | |
| 24 | #define KEY_WIDTH 20 |
| 25 | #define KEY_HEIGHT 20 |
| 26 | #define KB_TOP 90 |
| 27 | |
| 28 | #define ID_NO_ACTION 0 |
| 29 | #define ID_ACTION_CLOSE 1 |
| 30 | #define ID_ACTION_UP 2 |
| 31 | #define ID_ACTION_DOWN 3 |
| 32 | #define ID_ACTION_LEFT 4 |
| 33 | #define ID_ACTION_RIGHT 5 |
| 34 | #define ID_ACTION_BACKSPACE 6 |
| 35 | #define ID_ACTION_SPACE 7 |
| 36 | #define ID_ACTION_GOUP 8 |
| 37 | #define ID_ACTION_SELECT 9 |
| 38 | #define ID_ACTION_KB_CHANGE 10 |
| 39 | |
| 40 | #include <string> |
| 41 | #include "gmenu2x.h" |
| 42 | #include "dialog.h" |
| 43 | |
| 44 | using std::string; |
| 45 | using std::vector; |
| 46 | |
| 47 | typedef vector<string> stringlist; |
| 48 | |
| 49 | class InputManager; |
| 50 | class Touchscreen; |
| 51 | |
| 52 | class InputDialog : protected Dialog { |
| 53 | private: |
| 54 | InputManager &inputMgr; |
| 55 | Touchscreen &ts; |
| 56 | int selRow, selCol; |
| 57 | bool close, ok; |
| 58 | string title, text, icon; |
| 59 | short curKeyboard; |
| 60 | vector<stringlist> keyboard; |
| 61 | stringlist *kb; |
| 62 | int kbLength, kbWidth, kbHeight, kbLeft; |
| 63 | SDL_Rect kbRect; |
| 64 | IconButton *btnBackspaceX, *btnBackspaceL, *btnSpace, *btnConfirm, *btnChangeKeys; |
| 65 | string input; |
| 66 | |
| 67 | void backspace(); |
| 68 | void space(); |
| 69 | void confirm(); |
| 70 | void changeKeys(); |
| 71 | |
| 72 | int drawVirtualKeyboard(); |
| 73 | void setKeyboard(int); |
| 74 | |
| 75 | public: |
| 76 | InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts, const string &text, const string &startvalue="", const string &title="", const string &icon=""); |
| 77 | |
| 78 | bool exec(); |
| 79 | const string &getInput() { return input; } |
| 80 | }; |
| 81 | |
| 82 | #endif /*INPUTDIALOG_H_*/ |
| 83 |
Branches:
install_locations
master
opkrun
packages
