~alanbell/dasher/ircfix-lp579181

« back to all changes in this revision

Viewing changes to Src/DasherCore/ActionButton.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-11-14 12:03:42 UTC
  • mfrom: (1.2.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20061114120342-pebcosas78lczcgz
Tags: 4.3.1-0ubuntu1
* New upstream release:
  - 4.3.1:
    - Bugfixes
    - Translation updates
  - 4.3.0:
    - Mainly work on two button dynamic mode to provide a platform for 
      user tests
* debian/patches/10_remove-extra-qualifier.patch:
  - fix FTBFS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "ActionButton.h"
 
2
#include "DasherInterfaceBase.h"
 
3
#include "DasherTypes.h"
 
4
 
 
5
#include <iostream>
 
6
 
 
7
CActionButton::CActionButton(Dasher::CDasherInterfaceBase *pInterface, const std::string &strCommand, bool bAlwaysVisible) 
 
8
  : m_strCommand(strCommand) {
 
9
  m_pInterface = pInterface;
 
10
  m_bAlwaysVisible = bAlwaysVisible;
 
11
}
 
12
 
 
13
void CActionButton::SetPosition(int iX, int iY, int iWidth, int iHeight) {
 
14
  m_iX = iX;
 
15
  m_iY = iY;
 
16
  m_iWidth = iWidth;
 
17
  m_iHeight = iHeight;
 
18
}
 
19
 
 
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);
 
23
}
 
24
 
 
25
bool CActionButton::HandleClickDown(int iTime, int iX, int iY, bool bVisible) {
 
26
  if(!bVisible && !m_bAlwaysVisible)
 
27
    return false;
 
28
 
 
29
  if((iX > m_iX) && (iX < (m_iX + m_iWidth)) && (iY > m_iY) && (iY < (m_iY + m_iHeight))) {
 
30
    Execute(iTime);
 
31
    return true;
 
32
  }
 
33
  else
 
34
    return false;
 
35
}
 
36
 
 
37
bool CActionButton::HandleClickUp(int iTime, int iX, int iY, bool bVisible) {
 
38
  if(!bVisible && !m_bAlwaysVisible)
 
39
    return false;
 
40
 
 
41
  if((iX > m_iX) && (iX < (m_iX + m_iWidth)) && (iY > m_iY) && (iY < (m_iY + m_iHeight)))
 
42
    return true;
 
43
  else
 
44
    return false;
 
45
}
 
46
 
 
47
void CActionButton::Execute(int iTime) {
 
48
  m_pInterface->ExecuteCommand(m_strCommand);
 
49
}