README.md edited online with Bitbucket
[gdash.git] / src / framework / messageactivity.hpp
blobbff443956dabdfb6edda16375b6b0d3b2e3db6ef
1 /*
2 * Copyright (c) 2007-2013, Czirkos Zoltan http://code.google.com/p/gdash/
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
19 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef MESSAGEACTIVITY_HPP_INCLUDED
25 #define MESSAGEACTIVITY_HPP_INCLUDED
27 #include "framework/activity.hpp"
28 #include "misc/smartptr.hpp"
30 #include <vector>
31 #include <string>
33 class Command;
35 /**
36 * Show a short message to the user, and wait for a keypress.
37 * After the keypress, execute a Command.
38 * The message can be of two parts, a primary and a secondary text. The secondary one is optional,
39 * it may be an empty text - it just gives some further information to the user. */
40 class MessageActivity: public Activity {
41 public:
42 /** Ctor of a MessageActivity.
43 * @param app The parent app.
44 * @param primary The text to show.
45 * @param secondary Supplementary text to show (extra information). May be omitted.
46 * @param command_after_exit Execute the command after showing the text and keypress from the user. May be omitted. */
47 MessageActivity(App *app, std::string const &primary, std::string const &secondary = "", SmartPtr<Command> command_after_exit = SmartPtr<Command>());
48 ~MessageActivity();
50 virtual void redraw_event(bool full) const;
51 virtual void keypress_event(KeyCode keycode, int gfxlib_keycode);
53 private:
54 SmartPtr<Command> command_after_exit;
55 std::vector<std::string> wrapped_text;
58 #endif