summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.h
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-02-17 13:35:54 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-02-17 13:35:54 +0000
commite9b1a504be1d94eab7a724ba5935aaf48fe9e4cb (patch)
tree3a07055dc98ba0f06bfc9e685e105a45085a7107 /crawl-ref/source/menu.h
parent702a81e3830d34745837cd116d5c3bcf6e4755bc (diff)
downloadcrawl-ref-e9b1a504be1d94eab7a724ba5935aaf48fe9e4cb.tar.gz
crawl-ref-e9b1a504be1d94eab7a724ba5935aaf48fe9e4cb.zip
Moved formatted_string into its own file, separate from the rest of Menu.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@954 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/menu.h')
-rw-r--r--crawl-ref/source/menu.h77
1 files changed, 2 insertions, 75 deletions
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index 29b3d6351b..e76d86ae9f 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -7,6 +7,7 @@
#include <time.h>
#include "AppHdr.h"
#include "externs.h"
+#include "format.h"
#include "defines.h"
#include "libutil.h"
@@ -44,82 +45,8 @@ struct menu_letter
}
};
-enum fs_op_type
-{
- FSOP_COLOUR,
- FSOP_CURSOR,
- FSOP_TEXT
-};
-
-class formatted_string
-{
-public:
- formatted_string(int init_colour = 0);
- formatted_string(const std::string &s, int init_colour = 0);
-
- operator std::string() const;
- void display(int start = 0, int end = -1) const;
- std::string tostring(int start = 0, int end = -1) const;
-
- void cprintf(const char *s, ...);
- void cprintf(const std::string &s);
- void gotoxy(int x, int y);
- void movexy(int delta_x, int delta_y);
- void add_glyph(const monsters *mons);
- void add_glyph(const item_def *item);
- void textcolor(int color);
-
- void clear();
-
- std::string::size_type length() const;
-
- const formatted_string &operator += (const formatted_string &other);
-
-public:
- static formatted_string parse_string(
- const std::string &s,
- bool eol_ends_format = true,
- bool (*process_tag)(const std::string &tag) = NULL );
-
- static int get_colour(const std::string &tag);
-
-private:
- int find_last_colour() const;
-
-public:
- struct fs_op
- {
- fs_op_type type;
- int x, y;
- bool relative;
- std::string text;
-
- fs_op(int color)
- : type(FSOP_COLOUR), x(color), y(-1), relative(false), text()
- {
- }
-
- fs_op(int cx, int cy, bool rel = false)
- : type(FSOP_CURSOR), x(cx), y(cy), relative(rel), text()
- {
- }
-
- fs_op(const std::string &s)
- : type(FSOP_TEXT), x(-1), y(-1), relative(false), text(s)
- {
- }
-
- operator fs_op_type () const
- {
- return type;
- }
- void display() const;
- };
-
- std::vector<fs_op> ops;
-};
-
struct item_def;
+
struct MenuEntry
{
std::string text;