You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.4 KiB

#ifndef __SDL_SCROLLING_LIST_WIDGET_HEADER__
#define __SDL_SCROLLING_LIST_WIDGET_HEADER__
#include "../gui_sdl.h"
#include "../core/coreWidget.h"
#include "../core/coreLabel.h"
#define WHEEL_MOVES_LINE
//#ifdef WHEEL_REVERSE_CONTROLL
class ScrollListItem: public sdlLabel{
private:
bool m_bSelected;
public:
explicit ScrollListItem(CSTR text, int fontSize = 10 );
virtual ~ScrollListItem();
void setSelected(bool a);
};
typedef std::vector<ScrollListItem*> vectorListItems;
class sdlScrollListWidget : public sdlCoreWidget {
private:
int m_nFontSize;
int m_nLineSize;
vectorListItems m_vLines;
bool m_bHScroll;
bool m_bVScroll;
bool m_bUnderCursor;
int m_nXOffset;
int m_nYOffset;
int m_nContentX;
int m_nContentY;
int m_nSelectedID;
int m_nPreSelectedID;
CSTR m_pFillParameter;
protected:
virtual bool create(void);
virtual void dispatch(SDL_Event* pEvt);
virtual void drawBefore(SDL_Renderer* pRenderer);
virtual void drawAfter(SDL_Renderer* pRenderer);
public:
sdlScrollListWidget(int x, int y, int w, int h, int fontsize, bool deco, sdlCoreWidget *pPtr = NULL);
~sdlScrollListWidget();
int addItem(ScrollListItem *ptr);
int addItem(CSTR text);
virtual void selectItem(int index);
int getSelectedIndex();
ScrollListItem * getSelectedItem();
ScrollListItem * getItem(int index);
void setParamPtr(CSTR ptr);
};
#endif