metaforce/specter/include/Specter/Button.hpp

58 lines
1.6 KiB
C++
Raw Normal View History

2015-11-21 01:14:49 +00:00
#ifndef SPECTER_BUTTON_HPP
#define SPECTER_BUTTON_HPP
2015-12-05 00:42:46 +00:00
#include "Specter/TextView.hpp"
#include "Specter/Control.hpp"
2015-12-05 00:42:46 +00:00
namespace Specter
{
class Button : public Control
2015-12-05 00:42:46 +00:00
{
std::string m_textStr;
std::unique_ptr<TextView> m_text;
SolidShaderVert m_verts[28];
ViewBlock m_bBlock;
boo::IGraphicsBufferD* m_bBlockBuf;
boo::IGraphicsBufferD* m_bVertsBuf;
boo::IVertexFormat* m_bVtxFmt; /* OpenGL only */
boo::IShaderDataBinding* m_bShaderBinding;
int m_nomWidth, m_nomHeight;
bool m_pressed = false;
bool m_hovered = false;
void setInactive();
void setHover();
void setPressed();
void setDisabled();
public:
class Resources
{
friend class ViewResources;
friend class Button;
void init(boo::IGraphicsDataFactory* factory, const ThemeData& theme);
};
Button(ViewResources& res, View& parentView,
std::unique_ptr<IControlBinding>&& controlBinding, const std::string& text);
2015-12-05 00:42:46 +00:00
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
void mouseEnter(const boo::SWindowCoord&);
void mouseLeave(const boo::SWindowCoord&);
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
void resetResources(ViewResources& res);
void draw(boo::IGraphicsCommandQueue* gfxQ);
void setText(const std::string& text);
int nominalWidth() const {return m_nomWidth;}
int nominalHeight() const {return m_nomHeight;}
};
}
2015-11-21 01:14:49 +00:00
#endif // SPECTER_BUTTON_HPP