From 40fcd5137e30eef53d38e55e8af95313db5c7a3d Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sun, 23 Oct 2011 12:46:52 +0200 Subject: [PATCH] InputDialog: header cleanup. --- src/inputdialog.cpp | 12 +++++-- src/inputdialog.h | 75 +++++++++++++++------------------------ src/menusettingstring.cpp | 3 ++ 3 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/inputdialog.cpp b/src/inputdialog.cpp index e405804..1098b66 100644 --- a/src/inputdialog.cpp +++ b/src/inputdialog.cpp @@ -18,14 +18,20 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include - #include "inputdialog.h" +#include "buttonbox.h" +#include "gmenu2x.h" + +#include + using namespace std; using namespace fastdelegate; +#define KEY_WIDTH 20 +#define KEY_HEIGHT 20 +#define KB_TOP 90 + InputDialog::InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr_, Touchscreen &ts_, const string &text, const string &startvalue, const string &title, const string &icon) diff --git a/src/inputdialog.h b/src/inputdialog.h index 8bb7899..a8f7feb 100644 --- a/src/inputdialog.h +++ b/src/inputdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,53 +18,29 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef INPUTDIALOG_H_ -#define INPUTDIALOG_H_ +#ifndef INPUTDIALOG_H +#define INPUTDIALOG_H -#define KEY_WIDTH 20 -#define KEY_HEIGHT 20 -#define KB_TOP 90 - -#define ID_NO_ACTION 0 -#define ID_ACTION_CLOSE 1 -#define ID_ACTION_UP 2 -#define ID_ACTION_DOWN 3 -#define ID_ACTION_LEFT 4 -#define ID_ACTION_RIGHT 5 -#define ID_ACTION_BACKSPACE 6 -#define ID_ACTION_SPACE 7 -#define ID_ACTION_GOUP 8 -#define ID_ACTION_SELECT 9 -#define ID_ACTION_KB_CHANGE 10 - -#include -#include "gmenu2x.h" #include "dialog.h" -#include "buttonbox.h" -using std::string; -using std::vector; - -typedef vector stringlist; +#include +#include +#include +class ButtonBox; class InputManager; class Touchscreen; class InputDialog : protected Dialog { -private: - InputManager &inputMgr; - Touchscreen &ts; - int selRow, selCol; - bool close, ok; - string title, text, icon; - short curKeyboard; - vector keyboard; - stringlist *kb; - int kbLength, kbWidth, kbHeight, kbLeft; - SDL_Rect kbRect; - ButtonBox *buttonbox; - string input; +public: + InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts, + const std::string &text, const std::string &startvalue="", + const std::string &title="", const std::string &icon=""); + bool exec(); + const std::string &getInput() { return input; } + +private: void backspace(); void space(); void confirm(); @@ -73,11 +49,18 @@ private: void drawVirtualKeyboard(); void setKeyboard(int); -public: - InputDialog(GMenu2X *gmenu2x, InputManager &inputMgr, Touchscreen &ts, const string &text, const string &startvalue="", const string &title="", const string &icon=""); - - bool exec(); - const string &getInput() { return input; } + InputManager &inputMgr; + Touchscreen &ts; + int selRow, selCol; + bool close, ok; + std::string title, text, icon; + short curKeyboard; + std::vector< std::vector > keyboard; + std::vector *kb; + int kbLength, kbWidth, kbHeight, kbLeft; + SDL_Rect kbRect; + ButtonBox *buttonbox; + std::string input; }; -#endif /*INPUTDIALOG_H_*/ +#endif // INPUTDIALOG_H diff --git a/src/menusettingstring.cpp b/src/menusettingstring.cpp index 0d8107b..2cb54fc 100644 --- a/src/menusettingstring.cpp +++ b/src/menusettingstring.cpp @@ -17,7 +17,10 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "menusettingstring.h" + +#include "gmenu2x.h" #include "iconbutton.h" #include "inputdialog.h"