41 lines
927 B
C++
41 lines
927 B
C++
#ifndef DROP_DOWN_LIST
|
|
#define DROP_DOWN_LIST
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
#include "Item.h"
|
|
#include "Dialog.h"
|
|
|
|
class DropDownList : public Item {
|
|
private:
|
|
vector<string> list;
|
|
vector<Dialog *> *dialogs;
|
|
int selected;
|
|
int listbox_item_size;
|
|
int listbox_height;
|
|
bool pressed;
|
|
void (*value_changed_func)(void *p, Item *i);
|
|
void *p;
|
|
public:
|
|
DropDownList(vector<string> list, vector<Dialog *> *dialogs, SDL_Rect pos);
|
|
~DropDownList();
|
|
void drawDropDownList();
|
|
bool onMousePress(int x, int y);
|
|
void onMouseRelease(int x, int y);
|
|
vector<string> getList();
|
|
void setSelected(int selected);
|
|
void setValueChangedFunc(void (*value_changed_func)(void *p, Item *i), void *p);
|
|
string getString();
|
|
void reset();
|
|
void add(string s);
|
|
bool select(string s);
|
|
int getListboxItemSize();
|
|
int getListboxHeight();
|
|
};
|
|
|
|
#endif
|