Debian Codegraph @

src/tools/dlgedit/gui_messages.h

raw
1 /*
2 Copyright (C) 2002 Kai Sterker <[email protected]>
3 Part of the Adonthell Project <http://adonthell.nongnu.org>
4
5 Dlgedit 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 Dlgedit 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 Dlgedit. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20 * @file gui_messages.h
21 *
22 * @author Kai Sterker
23 * @brief Defines the messages to display in the status bar.
24 */
25
26 #ifndef GUI_MESSAGES_H
27 #define GUI_MESSAGES_H
28
29 #include <map>
30 #include <gtk/gtk.h>
31
32 /**
33 * operator< for use with the map
34 */
35 struct ltint
36 {
37 bool operator() (const int &a, const int &b) const
38 {
39 return a < b;
40 }
41 };
42
43 /**
44 * Contains a map that holds (number, string) pairs, so the messages
45 * can be easily accessed by their ID.
46 */
47 class GuiMessages
48 {
49 public:
50 GuiMessages (GtkWidget *sb);
51
52 void display (int id);
53 void display (int id, const char* text);
54
55 void clear ();
56
57 private:
58 std::map<int, const char*, ltint> messages; // List of message strings
59 int current; // String currently displayed
60 GtkWidget *statusbar; // Target for the messages
61 };
62
63 #endif // GUI_MESSAGES_H