2015-04-30 23:15:25 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H
|
|
|
|
#define OPENMW_COMPONENTS_WIDGETS_IMAGEBUTTON_H
|
2013-01-03 00:09:03 +00:00
|
|
|
|
2013-03-03 12:11:02 +00:00
|
|
|
#include <MyGUI_ImageBox.h>
|
2013-01-03 00:09:03 +00:00
|
|
|
|
2014-09-12 03:14:21 +00:00
|
|
|
namespace Gui
|
2013-01-03 00:09:03 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief allows using different image textures depending on the button state
|
|
|
|
*/
|
|
|
|
class ImageButton : public MyGUI::ImageBox
|
|
|
|
{
|
|
|
|
MYGUI_RTTI_DERIVED(ImageButton)
|
|
|
|
|
|
|
|
public:
|
2015-12-07 14:32:00 +00:00
|
|
|
MyGUI::IntSize getRequestedSize();
|
|
|
|
|
2017-09-22 14:57:01 +00:00
|
|
|
ImageButton();
|
|
|
|
|
2018-03-08 23:39:35 +00:00
|
|
|
static void setDefaultNeedKeyFocus(bool enabled);
|
|
|
|
|
2015-12-07 14:32:00 +00:00
|
|
|
/// Set mImageNormal, mImageHighlighted and mImagePushed based on file convention (image_idle.ext, image_over.ext and image_pressed.ext)
|
|
|
|
void setImage(const std::string& image);
|
2013-01-03 00:09:03 +00:00
|
|
|
|
2017-09-22 14:57:01 +00:00
|
|
|
private:
|
|
|
|
void updateImage();
|
|
|
|
|
2018-03-08 23:39:35 +00:00
|
|
|
static bool sDefaultNeedKeyFocus;
|
|
|
|
|
2013-01-03 00:09:03 +00:00
|
|
|
protected:
|
|
|
|
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
|
|
|
|
virtual void onMouseLostFocus(MyGUI::Widget* _new);
|
|
|
|
virtual void onMouseSetFocus(MyGUI::Widget* _old);
|
|
|
|
virtual void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id);
|
|
|
|
virtual void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id);
|
2017-09-22 14:57:01 +00:00
|
|
|
virtual void onKeySetFocus(MyGUI::Widget* _old);
|
|
|
|
virtual void onKeyLostFocus(MyGUI::Widget* _new);
|
2013-01-03 00:09:03 +00:00
|
|
|
|
|
|
|
std::string mImageHighlighted;
|
|
|
|
std::string mImageNormal;
|
|
|
|
std::string mImagePushed;
|
2017-09-22 14:57:01 +00:00
|
|
|
|
|
|
|
bool mMouseFocus;
|
|
|
|
bool mMousePress;
|
|
|
|
bool mKeyFocus;
|
2013-01-03 00:09:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|