2024-02-12 20:16:37 +08:00
|
|
|
|
|
|
|
#include "../main.h"
|
|
|
|
|
|
|
|
CLabelPool::CLabelPool()
|
|
|
|
{
|
2024-10-21 22:23:45 +08:00
|
|
|
for(WORD wLabelID = 0; wLabelID < MAX_LABELS; wLabelID++)
|
2024-02-12 20:16:37 +08:00
|
|
|
{
|
2024-10-21 22:23:45 +08:00
|
|
|
memset(&m_Labels[wLabelID], 0, sizeof(LABEL));
|
|
|
|
m_bLabelSlotState[wLabelID] = FALSE;
|
2024-02-12 20:16:37 +08:00
|
|
|
}
|
|
|
|
}
|
2024-10-21 22:23:45 +08:00
|
|
|
|
2024-10-21 22:24:20 +08:00
|
|
|
CLabelPool::~CLabelPool()
|
|
|
|
{
|
|
|
|
for(WORD wLabelID = 0; wLabelID < MAX_LABELS; wLabelID++)
|
|
|
|
{
|
|
|
|
if(m_bLabelSlotState[wLabelID])
|
|
|
|
{
|
|
|
|
Delete(wLabelID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-21 22:23:45 +08:00
|
|
|
BOOL CLabelPool::Delete(WORD wLabelID)
|
|
|
|
{
|
|
|
|
if(wLabelID >= MAX_LABELS) return FALSE;
|
|
|
|
if(!m_bLabelSlotState[wLabelID]) return FALSE;
|
|
|
|
|
|
|
|
if(m_Labels[wLabelID].szText)
|
|
|
|
free(m_Labels[wLabelID].szText);
|
|
|
|
memset(&m_Labels[wLabelID], 0, sizeof(LABEL));
|
|
|
|
m_bLabelSlotState[wLabelID] = FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|