2009-10-01 01:10:58 +02:00
|
|
|
#include "gui.h"
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
class customOptionList
|
|
|
|
{
|
|
|
|
public:
|
2010-09-24 02:48:03 +02:00
|
|
|
customOptionList(int Size);
|
2010-09-19 01:16:05 +02:00
|
|
|
~customOptionList();
|
2010-09-24 02:48:03 +02:00
|
|
|
void SetLength(int Length);
|
|
|
|
void SetName(int i, const char *format, ...) __attribute__( ( format ( printf, 3, 4 ) ) );
|
|
|
|
const char *GetName(int i)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
if (i >= 0 && i < length && name[i])
|
2010-09-19 01:16:05 +02:00
|
|
|
return name[i];
|
2010-09-24 02:48:03 +02:00
|
|
|
else return "";
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
2010-09-24 02:48:03 +02:00
|
|
|
void SetValue(int i, const char *format, ...) __attribute__( ( format ( printf, 3, 4 ) ) );
|
|
|
|
const char *GetValue(int i)
|
2010-09-19 01:16:05 +02:00
|
|
|
{
|
2010-09-24 02:48:03 +02:00
|
|
|
if (i >= 0 && i < length && value[i])
|
2010-09-19 01:16:05 +02:00
|
|
|
return value[i];
|
2010-09-24 02:48:03 +02:00
|
|
|
else return "";
|
|
|
|
}
|
|
|
|
void Clear(bool OnlyValue = false);
|
|
|
|
int GetLength()
|
|
|
|
{
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
bool IsChanged()
|
|
|
|
{
|
|
|
|
bool ret = changed;
|
|
|
|
changed = false;
|
|
|
|
return ret;
|
2010-09-19 01:16:05 +02:00
|
|
|
}
|
|
|
|
private:
|
2010-09-24 02:48:03 +02:00
|
|
|
void SetSize(int Size);
|
2010-09-19 01:16:05 +02:00
|
|
|
int size;
|
|
|
|
char ** name;
|
|
|
|
char ** value;
|
|
|
|
int length;
|
|
|
|
bool changed;
|
2009-10-01 01:10:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//!Display a list of menu options
|
2010-09-24 02:48:03 +02:00
|
|
|
class GuiCustomOptionBrowser: public GuiElement
|
2010-02-09 11:59:55 +01:00
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
public:
|
2010-09-26 10:33:43 +02:00
|
|
|
GuiCustomOptionBrowser(int w, int h, customOptionList * l, const char * background, int scrollbar, int col2);
|
2010-09-19 01:16:05 +02:00
|
|
|
~GuiCustomOptionBrowser();
|
2010-09-24 02:48:03 +02:00
|
|
|
int FindMenuItem(int c, int d);
|
2010-09-19 01:16:05 +02:00
|
|
|
int GetClickedOption();
|
|
|
|
int GetSelectedOption();
|
2010-09-24 02:48:03 +02:00
|
|
|
void SetClickable(bool enable);
|
|
|
|
void SetScrollbar(int enable);
|
|
|
|
void SetOffset(int optionnumber);
|
2010-09-19 01:16:05 +02:00
|
|
|
void ResetState();
|
2010-09-24 02:48:03 +02:00
|
|
|
void SetFocus(int f);
|
2010-09-19 01:16:05 +02:00
|
|
|
void Draw();
|
2010-09-24 02:48:03 +02:00
|
|
|
void Update(GuiTrigger * t);
|
2010-09-19 01:16:05 +02:00
|
|
|
protected:
|
|
|
|
void UpdateListEntries();
|
|
|
|
int selectedItem;
|
|
|
|
int listOffset;
|
|
|
|
int size;
|
|
|
|
int coL2;
|
|
|
|
int scrollbaron;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
customOptionList * options;
|
|
|
|
int * optionIndex;
|
|
|
|
GuiButton ** optionBtn;
|
|
|
|
GuiText ** optionTxt;
|
|
|
|
GuiText ** optionVal;
|
|
|
|
GuiText ** optionValOver;
|
|
|
|
GuiImage ** optionBg;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiButton * arrowUpBtn;
|
|
|
|
GuiButton * arrowDownBtn;
|
|
|
|
GuiButton * scrollbarBoxBtn;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiImage * bgOptionsImg;
|
|
|
|
GuiImage * scrollbarImg;
|
|
|
|
GuiImage * arrowDownImg;
|
|
|
|
GuiImage * arrowDownOverImg;
|
|
|
|
GuiImage * arrowUpImg;
|
|
|
|
GuiImage * arrowUpOverImg;
|
|
|
|
GuiImage * scrollbarBoxImg;
|
|
|
|
GuiImage * scrollbarBoxOverImg;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiImageData * bgOptions;
|
|
|
|
GuiImageData * bgOptionsEntry;
|
|
|
|
GuiImageData * scrollbar;
|
|
|
|
GuiImageData * arrowDown;
|
|
|
|
GuiImageData * arrowDownOver;
|
|
|
|
GuiImageData * arrowUp;
|
|
|
|
GuiImageData * arrowUpOver;
|
|
|
|
GuiImageData * scrollbarBox;
|
|
|
|
GuiImageData * scrollbarBoxOver;
|
2009-10-01 01:10:58 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
GuiSound * btnSoundClick;
|
|
|
|
GuiTrigger * trigA;
|
|
|
|
GuiTrigger * trigHeldA;
|
2009-10-01 01:10:58 +02:00
|
|
|
};
|