void CFileTypesForm::OnSize(UINT nType, int cx, int cy)
{
	// resize our controls along...
	CRect		rc, rc2;
	GetClientRect(&rc);

	if (IsWindow(title)) {
		title.GetClientRect(&rc2);

        tab.SetWindowPos(NULL, 0, rc2.Height(), rc.Width(), rc.Height() - rc2.Height(), SWP_SHOWWINDOW | SWP_NOZORDER);
        OnTabChanged(NULL, NULL);

		title.SetWindowPos(NULL, 0, 0, rc.Width(), rc2.Height(), SWP_SHOWWINDOW | SWP_NOZORDER);
		title.Invalidate();
	}
}
BOOL CFileTypesForm::DoCreateDialog(CWnd* parent)
{
	BOOL ret = Create(IDD, parent);
	if (!ret) return FALSE;

	// prepare titlebar
	title.ModifyStyle(0, WS_CLIPCHILDREN);
	title.ModifyStyleEx(0, WS_EX_CONTROLPARENT);

	// create buttons
	CRect	rc;
	rc.SetRect(0, 0, 60, 23);
    btn_copy.Create(_T("&Copy"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, rc, &title, IDC_BUTTON_COPY);
	btn_copy.SetFont(GetFont());
    btn_copy.SetWindowPos(NULL, 4, 4, rc.Width(), rc.Height(), SWP_SHOWWINDOW | SWP_NOZORDER);

	btn_reload.Create(_T("&Reload"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, rc, &title, IDC_BUTTON_CLEAR);
    btn_reload.SetWindowPos(NULL, 8 + rc.Width(), 4, rc.Width(), rc.Height(), SWP_SHOWWINDOW | SWP_NOZORDER);
	btn_reload.SetFont(GetFont());

    pages[0] = page_protocols   = new CPageFileTypes(_T("Protocols"));
    pages[1] = page_extensions  = new CPageFileTypes(_T("Extensions"));
    pages[2] = page_bytes       = new CPageFileTypes(_T("Bytes"));

    // we need to set WS_EX_CONTROLPARENT for the tabs
	tab.ModifyStyleEx(0, WS_EX_CONTROLPARENT);

    TCITEM tci;
    tci.mask = TCIF_TEXT;
    tci.iImage = -1;

    for (DWORD i=0; i<pageCount; i++)
    {
        if (pages[i])
        {
            pages[i]->Create(CPageFileTypes::IDD, &tab);
            tci.pszText =  (LPTSTR)(LPCTSTR)CString(pages[i]->title);
            tab.InsertItem(i, &tci);
        }
    }

    OnTabChanged(NULL, NULL);

    OnInitialize();

	return TRUE;
}
bool CDlgModelController::OnInitDialog()
{
	OnTabChanged();
	return true;
}