Change directory structure
This commit is contained in:
57
luprex/cpp/core/gui.hpp
Normal file
57
luprex/cpp/core/gui.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef GUI_HPP
|
||||
#define GUI_HPP
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
class GuiElt : public eng::nevernew {
|
||||
friend class Gui;
|
||||
public:
|
||||
enum Type {
|
||||
TYPE_MENU_ITEM,
|
||||
};
|
||||
private:
|
||||
Type type_;
|
||||
eng::string action_;
|
||||
eng::string label_;
|
||||
|
||||
GuiElt() {}
|
||||
public:
|
||||
~GuiElt() {}
|
||||
Type type() const { return type_; }
|
||||
const eng::string &action() const { return action_; }
|
||||
const eng::string &label() const { return label_; }
|
||||
};
|
||||
|
||||
class Gui : public eng::nevernew {
|
||||
public:
|
||||
using EltVec = eng::vector<GuiElt>;
|
||||
private:
|
||||
int64_t place_;
|
||||
EltVec elts_;
|
||||
public:
|
||||
Gui() { place_ = 0; }
|
||||
int64_t place() { return place_; }
|
||||
const EltVec &elts() const { return elts_; }
|
||||
void clear(int64_t p) { place_ = p; elts_.clear(); }
|
||||
bool has_action(const eng::string &action) const;
|
||||
void menu_item(const eng::string &action, const eng::string &label);
|
||||
eng::string get_action(int64_t index);
|
||||
eng::string menu_debug_string() const;
|
||||
|
||||
// Put a pointer to a gui into the lua registry.
|
||||
//
|
||||
// All lua commands that manipulate the GUI implicitly
|
||||
// operate on this global gui pointer.
|
||||
//
|
||||
static void store_global_pointer(lua_State *L, Gui *g);
|
||||
static Gui *fetch_global_pointer(lua_State *L);
|
||||
};
|
||||
|
||||
|
||||
#endif // GUI_HPP
|
||||
|
||||
Reference in New Issue
Block a user