source: trunk/Utilities/Control/OptionTreeView/MainDialog.h @ 192

Last change on this file since 192 was 192, checked in by roman, 9 years ago
File size: 3.0 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2013
3// Created by Roman Ryltsov roman@alax.info
4
5#pragma once
6
7#include "rocontrols.h"
8
9////////////////////////////////////////////////////////////
10// CMainDialog
11
12class CMainDialog : 
13        public CDialogImpl<CMainDialog>
14{
15public:
16        enum { IDD = IDD_MAIN };
17
18BEGIN_MSG_MAP_EX(CMainDialog)
19        //CHAIN_MSG_MAP(CDialogImpl<CMainDialog>)
20        MSG_WM_INITDIALOG(OnInitDialog)
21        COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
22        NOTIFY_HANDLER_EX(IDC_TREE, CRoOptionTreeView::NC_SELECTEDCHANGED, OnTreeViewSelectedChanged)
23        NOTIFY_HANDLER_EX(IDC_TREE, CRoOptionTreeView::NC_VALUECHANGED, OnTreeViewValueChanged)
24        REFLECT_NOTIFICATIONS()
25END_MSG_MAP()
26
27public:
28
29private:
30        CRoOptionTreeView m_TreeView;
31
32public:
33// CMainDialog
34        CMainDialog() throw()
35        {
36        }
37
38// Window message handlers
39        LRESULT OnInitDialog(HWND, LPARAM)
40        {
41                //SetIcon(AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)), FALSE);
42                //SetIcon(AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)), FALSE);
43                _W(m_TreeView.SubclassWindow(GetDlgItem(IDC_TREE)));
44
45                CObjectPtr<CRoOptionTreeView::CStaticItem> pChecksItem = m_TreeView.InsertStaticItem(_T("check"), _T("Check Boxes"));
46                m_TreeView.InsertCheckItem(pChecksItem->m_hItem, _T("a"), _T("Check Box A"));
47                m_TreeView.InsertCheckItem(pChecksItem->m_hItem, _T("b"), _T("Check Box B"));
48                m_TreeView.InsertCheckItem(pChecksItem->m_hItem, _T("c"), _T("Check Box C"));
49                CObjectPtr<CRoOptionTreeView::CStaticItem> pRadiosItem = m_TreeView.InsertStaticItem(_T("radio"), _T("Radio Buttons"));
50                m_TreeView.InsertRadioItem(pRadiosItem->m_hItem, _T("a"), _T("Radio Button A"));
51                m_TreeView.InsertRadioItem(pRadiosItem->m_hItem, _T("b"), _T("Radio Button B"));
52                m_TreeView.InsertRadioItem(pRadiosItem->m_hItem, _T("c"), _T("Radio Button C"));
53
54                static LPCTSTR g_ppszIdentifiers[] = 
55                {
56                        _T("check/b"),
57                };
58                static LPCTSTR g_ppszInfoTips[] = 
59                {
60                        _T("Check Box B") _T("\r\n") _T("\r\n") _T("Blah Blah Blah"),
61                };
62                m_TreeView.SetInfoTips(g_ppszIdentifiers, g_ppszInfoTips);
63
64                m_TreeView.SetCheck(_T("check/b"), TRUE);
65                m_TreeView.SetRadio(_T("radio"), _T("b"));
66
67                _W(CenterWindow());
68                return TRUE;
69        }
70        LRESULT OnCancel(UINT, INT nIdentifier, HWND)
71        {
72                //CString s;
73                //s += AtlFormatString(_T("check/b: %d"), m_TreeView.GetCheck(_T("check/b"))) + _T("\r\n");
74                //s += AtlFormatString(_T("radio: %s"), m_TreeView.GetRadio(_T("radio"))) + _T("\r\n");
75                //AtlMessageBoxEx(m_hWnd, (LPCTSTR) s, _T("Value"), MB_OK | MB_ICONINFORMATION);
76                _W(EndDialog(nIdentifier));
77                return 0;
78        }
79        LRESULT OnTreeViewSelectedChanged(NMHDR*)
80        {
81                _Z4(atlTraceGeneral, 4, _T("m_TreeView.GetSelectedIdentifier() %s\n"), m_TreeView.GetSelectedIdentifier());
82                return 0;
83        }
84        LRESULT OnTreeViewValueChanged(NMHDR*)
85        {
86                _Z4(atlTraceGeneral, 4, _T("...\n"));
87                return 0;
88        }
89};
Note: See TracBrowser for help on using the repository browser.