1 // DashIntfScreenMsgs.h
3 // Created 2011 by Alan Lawrence
4 // Copyright (c) 2011 The Dasher Team
6 // This file is part of Dasher.
8 // Dasher is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // Dasher is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with Dasher; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __DASH_INTF_SCREEN_MSGS_H__
23 #define __DASH_INTF_SCREEN_MSGS_H__
25 #include "DashIntfSettings.h"
28 ///Implements the MessageDisplay part of CDasherInterfaceBase by rendering messages
29 /// directly onto the CDasherScreen (using MakeLabel wrapping to LP_MESSAGE_FONTSIZE).
30 ///Also implements CreateGameModule to return a ScreenGameModule, which provides
31 /// text prompts in much the same fashion.
32 /// Note we subclass CDashIntfSettings as currently all platforms want to inherit from
33 /// the latter; if this changes, we could declare ScreenMsgs & Settings separately and
34 /// combine via multiple inheritance?? (from CSettingsUser, not DashIntfBase!)
35 class CDashIntfScreenMsgs
: public CDashIntfSettings
{
38 CDashIntfScreenMsgs(CSettingsStore
*pSettingsStore
, CFileUtils
* fileUtils
);
40 /// Stores messages for Redraw to render onto the Screen on top of the view.
41 /// For modal messages (bInterrupt=true), pauses Dasher, and keeps the message
42 /// onscreen until the user starts moving again (via normal mechanisms);
43 /// For non-modal or asynchronous messages (bInterrupt=false), we render
44 /// the message over the canvas for LP_MESSAGE_TIME milliseconds without pausing.
45 /// (This method merely stores the messages into m_dqAsyncMessages or m_dqModalMessages
46 /// as appropriate; display, timeout, etc. is handled in Redraw.)
47 /// \param strText text of message to display.
48 /// \param bInterrupt whether to interrupt any text entry in progress.
49 virtual void Message(const std::string
&strText
, bool bInterrupt
);
51 /// Override to render (on top of nodes+decorations) any messages, for
52 /// LP_MESSAGE_TIME ms, before removing from queue.
53 bool FinishRender(unsigned long ulTime
);
55 ///Override to re-MakeLabel any messages.
56 void ChangeScreen(CDasherScreen
*pNewScreen
);
58 ///Flush any modal messages that have been displayed before resuming.
59 void onUnpause(unsigned long lTime
);
61 ///Implement to return a ScreenGameModule, i.e. rendering text prompts
62 /// onto the Screen with Labels, much as we do for messages!
63 CGameModule
*CreateGameModule();
65 /// Asynchronous (non-modal) messages to be displayed to the user, longest-ago
66 /// at the front, along with the timestamp of the frame at which each was first
67 /// displayed to the user - 0 if not yet displayed.
68 std::deque
<pair
<CDasherScreen::Label
*, unsigned long> > m_dqAsyncMessages
;
70 /// Modal messages being or waiting to be displayed to the user, longest-ago
71 /// at the front, along with the timestamp when each was first displayed to the
72 /// user (0 if not yet displayed).
73 std::deque
<pair
<CDasherScreen::Label
*, unsigned long> > m_dqModalMessages
;