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 __MESSAGES_H__
23 #define __MESSAGES_H__
25 ///Abstract superclass = interface for displaying messages to the user.
26 ///Each platform must implement: see CDasherInterfaceBase, CDashIntfScreenMsgs
33 class CMessageDisplay
{
35 ///Displays a message to the user - somehow. Two styles
36 /// of message are supported: (1) modal messages, i.e. which interrupt text entry;
37 /// these should be explicitly dismissed (somehow) before text entry resumes; and
38 /// (2) non-modal or asynchronous messages, which should be displayed in the background
39 /// but allow the user to continue text entry as normal.
40 /// NOTE for subclasses: it is best not to popup any modal window here but rather to
41 /// store all messages until the next frame is rendered and then combine them into one.
42 /// \param strText text of message to display.
43 /// \param bInterrupt if true, text entry should be interrupted; if false, user should
44 /// be able to continue writing uninterrupted.
45 virtual void Message(const std::string
&strText
, bool bInterrupt
)=0;
47 ///Utility method for common case of displaying a modal message with a format
48 /// string containing a single %s.
49 void FormatMessageWithString(const char* fmt
, const char* str
);
51 ///Utility method for less-but-still-quite-common case of displaying a modal
52 /// message with a format string containing two %s
53 void FormatMessageWith2Strings(const char* fmt
, const char* str1
, const char* str2
);