47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
|
|
#pragma once
|
|||
|
|
#include <vector>
|
|||
|
|
#include <map>
|
|||
|
|
#include <afxwin.h>
|
|||
|
|
|
|||
|
|
#define WM_CHILD_CLOSED (WM_USER + 100)
|
|||
|
|
|
|||
|
|
class CGridDialog : public CDialog
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
CGridDialog();
|
|||
|
|
|
|||
|
|
BOOL AddChild(CDialog* pDlg); // <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ӶԻ<D3B6><D4BB><EFBFBD>
|
|||
|
|
void RemoveChild(CDialog* pDlg); // <20><>̬<EFBFBD>Ƴ<EFBFBD><C6B3>ӶԻ<D3B6><D4BB><EFBFBD>
|
|||
|
|
void SetGrid(int rows, int cols); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
void LayoutChildren(); // <20><><EFBFBD><EFBFBD>
|
|||
|
|
BOOL HasSlot() const {
|
|||
|
|
return m_children.size() < m_max;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
virtual BOOL OnInitDialog();
|
|||
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|||
|
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|||
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
|||
|
|
afx_msg LRESULT OnChildClosed(WPARAM wParam, LPARAM lParam);
|
|||
|
|
|
|||
|
|
DECLARE_MESSAGE_MAP()
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
HICON m_hIcon;
|
|||
|
|
int m_rows = 0;
|
|||
|
|
int m_cols = 0;
|
|||
|
|
int m_max = 0;
|
|||
|
|
std::vector<CDialog*> m_children;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CDialog* m_pMaxChild = nullptr; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><F3BBAFB5>ӶԻ<D3B6><D4BB><EFBFBD>
|
|||
|
|
LONG m_parentStyle = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC>ʽ
|
|||
|
|
|
|||
|
|
struct ChildState {
|
|||
|
|
CRect rect; // ԭʼλ<CABC><CEBB>
|
|||
|
|
LONG style; // ԭʼ<D4AD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
|
};
|
|||
|
|
std::map<CDialog*, ChildState> m_origState;
|
|||
|
|
};
|