Rework the editor to be more sane
This commit is contained in:
parent
30346f869c
commit
64b376de49
2 changed files with 453 additions and 549 deletions
src
File diff suppressed because it is too large
Load diff
|
@ -30,6 +30,8 @@
|
|||
#ifndef __WIDGETS_H__
|
||||
#define __WIDGETS_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <guichan.h>
|
||||
#include <guichan/gsdl.h>
|
||||
#include "font.h"
|
||||
|
@ -66,6 +68,21 @@ public:
|
|||
virtual ~LuaActionListener();
|
||||
};
|
||||
|
||||
class LambdaActionListener : public gcn::ActionListener
|
||||
{
|
||||
std::function<void(const std::string &)> lambda;
|
||||
public:
|
||||
LambdaActionListener(std::function<void(const std::string &)> l)
|
||||
{
|
||||
lambda = l;
|
||||
}
|
||||
|
||||
virtual void action(const std::string &eventId)
|
||||
{
|
||||
lambda(eventId);
|
||||
}
|
||||
};
|
||||
|
||||
class ImageWidget : public gcn::Icon
|
||||
{
|
||||
public:
|
||||
|
@ -260,6 +277,18 @@ private:
|
|||
CGraphic *itemImage;
|
||||
};
|
||||
|
||||
class StringListModel : public gcn::ListModel
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
public:
|
||||
StringListModel(std::vector<std::string> l) {
|
||||
list = l;
|
||||
}
|
||||
|
||||
virtual int getNumberOfElements() { return list.size(); }
|
||||
virtual std::string getElementAt(int i) { return list[i]; }
|
||||
};
|
||||
|
||||
class LuaListModel : public gcn::ListModel
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
|
|
Loading…
Add table
Reference in a new issue