Monday, June 05, 2006

maximize list control within playlist dialog


void CPlaylistDlg::OnHideControls()
{
m_HideControls ^= 1;
CWnd *wp = GetWindow(GW_CHILD);
while (wp != NULL) {
if (wp != &m_List)
wp->ShowWindow(m_HideControls ? SW_HIDE : SW_SHOW);
wp = wp->GetNextWindow();
}
PostMessage(WM_SIZE);
}

void CPlaylistDlg::OnSize(UINT nType, int cx, int cy)
{
CToolDlg::OnSize(nType, cx, cy);
if (m_HideControls) {
CRect r;
GetClientRect(r);
m_List.MoveWindow(r);
} else
m_Resize.OnSize();
}

void CPlaylistDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CToolDlg::OnShowWindow(bShow, nStatus);
if (bShow && !m_HideControls)
m_Resize.OnSize();
}

No comments: