2008-01-10 21:01:25 +02:00
|
|
|
#pragma once
|
2008-03-16 02:09:43 +02:00
|
|
|
#include "CPlayerInterface.h"
|
2008-05-18 20:33:39 +03:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
#include <boost/bind.hpp>
|
2008-03-16 02:09:43 +02:00
|
|
|
class AdventureMapButton
|
|
|
|
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public CButtonBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string name; //for status bar
|
|
|
|
std::string helpBox; //for right-click help
|
|
|
|
char key; //key shortcut
|
2008-05-18 20:33:39 +03:00
|
|
|
boost::function<void()> callback;
|
2008-04-04 20:30:53 +03:00
|
|
|
bool colorChange,
|
|
|
|
actOnDown; //runs when mouse is pressed down over it, not when up
|
2008-03-16 02:09:43 +02:00
|
|
|
|
|
|
|
void clickRight (tribool down);
|
|
|
|
void clickLeft (tribool down);
|
|
|
|
virtual void hover (bool on);
|
|
|
|
void keyPressed (SDL_KeyboardEvent & key);
|
|
|
|
void activate(); // makes button active
|
|
|
|
void deactivate(); // makes button inactive (but doesn't delete)
|
|
|
|
|
|
|
|
AdventureMapButton(); //c-tor
|
2008-05-18 20:33:39 +03:00
|
|
|
AdventureMapButton( std::string Name, std::string HelpBox, boost::function<void()> Callback, int x, int y, std::string defName, bool activ=false, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
|
2008-03-16 02:09:43 +02:00
|
|
|
};
|
|
|
|
|
2008-01-31 23:35:30 +02:00
|
|
|
|
2008-05-18 20:33:39 +03:00
|
|
|
//template<typename T>
|
2008-04-04 20:30:53 +03:00
|
|
|
class CSlider : public IShowable, public MotionInterested, public ClickableL
|
|
|
|
{
|
|
|
|
public:
|
2008-05-18 20:33:39 +03:00
|
|
|
AdventureMapButton left, right, slider; //if vertical then left=up
|
2008-04-04 20:30:53 +03:00
|
|
|
int capacity,//how many elements can be active at same time
|
|
|
|
amount, //how many elements
|
|
|
|
value; //first active element
|
|
|
|
bool horizontal, moving;
|
|
|
|
CDefEssential *imgs ;
|
|
|
|
|
2008-05-18 20:33:39 +03:00
|
|
|
boost::function<void(int)> moved;
|
|
|
|
//void(T::*moved)(int to);
|
|
|
|
//T* owner;
|
2008-04-04 20:30:53 +03:00
|
|
|
|
|
|
|
void redrawSlider();
|
|
|
|
|
|
|
|
void sliderClicked();
|
|
|
|
void moveLeft();
|
|
|
|
void clickLeft (tribool down);
|
|
|
|
void mouseMoved (SDL_MouseMotionEvent & sEvent);
|
|
|
|
void moveRight();
|
|
|
|
void moveTo(int to);
|
|
|
|
void activate(); // makes button active
|
|
|
|
void deactivate(); // makes button inactive (but doesn't delete)
|
|
|
|
void show(SDL_Surface * to = NULL);
|
2008-05-18 20:33:39 +03:00
|
|
|
CSlider(int x, int y, int totalw, boost::function<void(int)> Moved, int Capacity, int Amount,
|
2008-04-04 20:30:53 +03:00
|
|
|
int Value=0, bool Horizontal=true);
|
|
|
|
~CSlider();
|
|
|
|
};
|