ROVLib2
RISCOSC++applicationdevelopmentlibrary
icon.cpp
1 #include "icon.h"
2 #include "wimp_error.h"
3 #include <stdio.h>
4 
5 namespace rov2
6 {
7 
9  : m_pwWindow(NULL)
10  , m_ihIcon(-1)
11 {
12 }
13 
15 {
16  if (m_ihIcon != -1 && m_pwWindow != NULL)
17  {
18  wimp_deleteicon(m_pwWindow->Handle(), m_ihIcon);
19  m_ihIcon = -1;
20  }
21 }
22 
23 CCreatedIcon::CCreatedIcon(tIconCreateBlock& ricbBlock, CWindow* pwWindow, bool bRegister)
24  : CIcon()
25  , m_bRegistered(bRegister)
26 {
27  ricbBlock.whWindow = pwWindow->Handle();
28 
29  m_ihIcon = wimp_createicon(&ricbBlock);
30  if (m_ihIcon == -1)
31  {
32  throw pebLastError;
33  }
34  if (bRegister)
35  {
36  pwWindow->RegisterIcon(this);
37  }
38  m_pwWindow = pwWindow;
39 }
40 
42 {
43  if (m_bRegistered)
44  {
46  m_bRegistered = false;
47  }
48 }
49 
50 }
virtual ~CIcon()
Definition: icon.cpp:14
void DeregisterIcon(const CIcon *kpiIcon)
Definition: window.cpp:118
CIcon()
Definition: icon.cpp:8
CWindow * m_pwWindow
Definition: icon.h:25
const tWindowHandle Handle() const
Definition: window.h:35
tIconHandle m_ihIcon
Definition: icon.h:28
void RegisterIcon(const CIcon *kpiIcon)
Definition: window.cpp:112
CCreatedIcon(tIconCreateBlock &ricbBlock, CWindow *pwWindow, bool bRegister=true)
Definition: icon.cpp:23