Root/src/inputdialog.h

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#include "dialog.h"
25
26#include <SDL.h>
27#include <string>
28#include <vector>
29
30class ButtonBox;
31class InputManager;
32class Touchscreen;
33
34class InputDialog : protected Dialog {
35public:
36    InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts,
37            const std::string &text, const std::string &startvalue="",
38            const std::string &title="", const std::string &icon="");
39
40    bool exec();
41    const std::string &getInput() { return input; }
42
43private:
44    void backspace();
45    void space();
46    void confirm();
47    void changeKeys();
48
49    void drawVirtualKeyboard();
50    void setKeyboard(int);
51
52    InputManager &inputMgr;
53    Touchscreen &ts;
54    int selRow, selCol;
55    bool close, ok;
56    std::string title, text, icon;
57    short curKeyboard;
58    std::vector< std::vector<std::string> > keyboard;
59    std::vector<std::string> *kb;
60    int kbLength, kbWidth, kbHeight, kbLeft;
61    SDL_Rect kbRect;
62    ButtonBox *buttonbox;
63    std::string input;
64};
65
66#endif // INPUTDIALOG_H
67

Archive Download this file



interactive