1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-03 17:37:18 +00:00
OpenMW/components/widgets/sharedstatebutton.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.4 KiB
C++
Raw Normal View History

#ifndef OPENMW_WIDGETS_SHAREDSTATEBUTTON_HPP
#define OPENMW_WIDGETS_SHAREDSTATEBUTTON_HPP
#include <MyGUI_Button.h>
2023-10-31 06:18:09 +00:00
#include "fontwrapper.hpp"
namespace Gui
{
class SharedStateButton;
typedef std::vector<SharedStateButton*> ButtonGroup;
/// @brief A button that applies its own state changes to other widgets, to do this you define it as part of a
/// ButtonGroup.
2023-10-31 06:18:09 +00:00
class SharedStateButton final : public FontWrapper<MyGUI::Button>
{
MYGUI_RTTI_DERIVED(SharedStateButton)
public:
SharedStateButton();
protected:
void updateButtonState();
void onMouseButtonPressed(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MyGUI::MouseButton _id) override;
void onMouseSetFocus(MyGUI::Widget* _old) override;
void onMouseLostFocus(MyGUI::Widget* _new) override;
void baseUpdateEnable() override;
void shutdownOverride() override;
bool _setState(const std::string& _value);
public:
2021-08-15 17:50:28 +00:00
void shareStateWith(const ButtonGroup& shared);
/// @note The ButtonGroup connection will be destroyed when any widget in the group gets destroyed.
2024-01-30 05:45:57 +00:00
static void createButtonGroup(ButtonGroup& group);
//! Set button selected state
void setStateSelected(bool _value);
private:
ButtonGroup mSharedWith;
bool mIsMousePressed;
bool mIsMouseFocus;
};
}
#endif