1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #pragma once
- #include "afxwin.h"
- #include <vector>
- #include "MyButton.h"
- using namespace std;
- class CMyButton;
- class CGoodsDlg;
- class CButtonGroup:public CWnd
- {
- DECLARE_DYNAMIC(CButtonGroup);
- public:
- CButtonGroup(void);
- public:
- ~CButtonGroup(void);
- public:
- CGoodsDlg* pParent;
- vector<CMyButton*> pButtons;
- UINT xAlign;
- UINT yAlign;
- UINT width;
- UINT height;
- UINT row;
- UINT column;
- UINT maxRow;
- UINT maxColumn;
- UINT x;
- UINT y;
- UINT groupIndex;
- UINT type;
- public:
- afx_msg void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
- void addButton(CString name, UINT nID);
- void changeButtonInfo(UINT index, CString name, CString otherInfo);
- CRect getCurRect(UINT row, UINT column)
- {
- CRect rt;
- rt.left = x + column * width + column * xAlign;
- rt.right = x + (column + 1) * width + column * xAlign;
- rt.top = y + row * height + row * xAlign;
- rt.bottom = y + (row + 1) * height + row * yAlign;
- return rt;
- }
- CRect getCurRect(UINT index)
- {
- CRect rt;
- UINT row = index / maxColumn;
- UINT column = index % maxColumn;
- rt.left = x + column * width + column * xAlign;
- rt.right = x + (column + 1) * width + column * xAlign;
- rt.top = y + row * height + row * xAlign;
- rt.bottom = y + (row + 1) * height + row * yAlign;
- return rt;
- }
- UINT getBottom()
- {
- return y + row * height + (row - 1) * yAlign;
- }
- UINT getRow(UINT index)
- {
- return index / maxColumn;
- }
- UINT getColumn(UINT index)
- {
- return index % maxColumn;
- }
- void handleClick(UINT index);
- };
|