1
#include "ActionButton.h"
2
#include "DasherInterfaceBase.h"
3
#include "DasherTypes.h"
7
CActionButton::CActionButton(Dasher::CDasherInterfaceBase *pInterface, const std::string &strCommand, bool bAlwaysVisible)
8
: m_strCommand(strCommand) {
9
m_pInterface = pInterface;
10
m_bAlwaysVisible = bAlwaysVisible;
13
void CActionButton::SetPosition(int iX, int iY, int iWidth, int iHeight) {
20
void CActionButton::Draw(Dasher::CDasherScreen *pScreen, bool bVisible) {
21
if(bVisible || m_bAlwaysVisible)
22
pScreen->DrawRectangle(m_iX, m_iY, m_iX + m_iWidth, m_iY + m_iHeight, 1, 2, Dasher::Opts::Nodes1, true, true, 1);
25
bool CActionButton::HandleClickDown(int iTime, int iX, int iY, bool bVisible) {
26
if(!bVisible && !m_bAlwaysVisible)
29
if((iX > m_iX) && (iX < (m_iX + m_iWidth)) && (iY > m_iY) && (iY < (m_iY + m_iHeight))) {
37
bool CActionButton::HandleClickUp(int iTime, int iX, int iY, bool bVisible) {
38
if(!bVisible && !m_bAlwaysVisible)
41
if((iX > m_iX) && (iX < (m_iX + m_iWidth)) && (iY > m_iY) && (iY < (m_iY + m_iHeight)))
47
void CActionButton::Execute(int iTime) {
48
m_pInterface->ExecuteCommand(m_strCommand);