Ejemplo n.º 1
0
void CSettingConfig::BoldChangedPages(HTREEITEM hItem)
{
    if (hItem == m_PagesTreeList.GetRootItem())
    {
        ::EnableWindow(GetDlgItem(IDC_RESET_ALL), false);
    }
    bool bEnableResetAll = false;

    while (hItem)
    {
        CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
        if (Page)
        {
            m_PagesTreeList.SetItemState(hItem, Page->EnableReset() ? TVIS_BOLD : 0, TVIS_BOLD);
            if (Page->EnableReset())
            {
                bEnableResetAll = true;
            }
        }

        BoldChangedPages(m_PagesTreeList.GetChildItem(hItem));
        hItem = m_PagesTreeList.GetNextSiblingItem(hItem);
    }

    if (bEnableResetAll)
    {
        ::EnableWindow(GetDlgItem(IDC_RESET_ALL), true);
    }
}
Ejemplo n.º 2
0
LRESULT CSettingConfig::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
{
    switch (wID)
    {
    case IDAPPLY:
        ApplySettings(true);
        break;
    case IDOK:
        ApplySettings(false);
        EndDialog(1);
        break;
    case IDCANCEL:
        EndDialog(0);
        break;
    case IDC_RESET_PAGE:
        if (m_CurrentPage)
        {
            m_CurrentPage->ResetPage();
        }
        break;
    case IDC_RESET_ALL:
        for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++)
        {
            CConfigSettingSection * Section = *iter;

            for (size_t i = 0; i < Section->GetPageCount(); i++)
            {
                CSettingsPage * Page = Section->GetPage(i);
                if (Page->EnableReset())
                {
                    Page->ResetPage();
                }
            }
        }

        break;
    }
    return FALSE;
}