123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "stdafx.h"
- #include "StateBtnGroup.h"
- IMPLEMENT_DYNAMIC(CStateBtnGroup, CWnd)
- CStateBtnGroup::CStateBtnGroup(void)
- {
- CButtonGroup();
- }
- CStateBtnGroup::~CStateBtnGroup(void)
- {
- for (size_t i = 0; i < pButtons.size(); i++)
- {
- delete(pButtons[i]);
- pButtons[i] = NULL;
- }
- }
- void CStateBtnGroup::addButton(CString name, UINT nID)
- {
- CStateButton* pBtn = new CStateButton;
- pButtons.push_back(pBtn);
- CString str;
- str.Format("%d", pButtons.size());
- pBtn->Create("a", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, getCurRect(pButtons.size() - 1), pParent, nID);
- pBtn->name = name;
- pBtn->index = pButtons.size() - 1;
- pBtn->type = type;
- pBtn->pParent = this;
- row = pButtons.size() / maxColumn + 1;
- if (pButtons.size() % maxColumn == 0)
- {
- row -= 1;
- }
- column = maxColumn;
- }
- void CStateBtnGroup::changeButtonInfo(UINT index, CString name, CString amount, CString vol, CString price,UINT state)
- {
- if (pButtons[index]->name == name
- && pButtons[index]->amount == amount
- && pButtons[index]->vol == vol
- && pButtons[index]->price == price
- && pButtons[index]->state == state)
- {
- return;
- }
- pButtons[index]->name = name;
- pButtons[index]->amount = amount;
- pButtons[index]->vol = vol;
- pButtons[index]->price = price;
- pButtons[index]->state = state;
- ::SendMessage(pButtons[index]->m_hWnd, WM_PAINT, (LPARAM)0, (WPARAM)0);
- }
|