2222#include " resource.h"
2323#include " Version.h"
2424#include " CollectionInterfaceDialog.h"
25+ #include " CollectionInterfaceClass.h"
26+ #include < string>
27+ #include < vector>
28+
29+ CollectionInterface* pobjCI;
30+ void _populate_file_cbx (HWND hwndDlg, std::vector<std::wstring>& vwsList);
2531
2632#pragma warning(push)
2733#pragma warning(disable: 4100)
@@ -56,6 +62,8 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
5662 ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_CATEGORY, CB_ADDSTRING, 0 , reinterpret_cast <LPARAM>(L" Theme" ));
5763 const int index2Begin = 0 ; // start with UDL selected
5864 ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_CATEGORY, CB_SETCURSEL, index2Begin, 0 );
65+
66+ pobjCI = new CollectionInterface;
5967 }
6068
6169 return true ;
@@ -68,18 +76,24 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
6876 case IDC_CI_BTN_RESTART:
6977 EndDialog (hwndDlg, 0 );
7078 DestroyWindow (hwndDlg);
79+ delete pobjCI;
80+ pobjCI = NULL ;
7181 return true ;
7282 case IDC_CI_COMBO_CATEGORY:
7383 if (HIWORD (wParam) == CBN_SELCHANGE) {
74- LRESULT selectedIndex = ::SendMessage ( reinterpret_cast <HWND>(lParam) , CB_GETCURSEL, 0 , 0 );
84+ LRESULT selectedIndex = ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_CATEGORY , CB_GETCURSEL, 0 , 0 );
7585 if (selectedIndex != CB_ERR) {
76- wchar_t buffer[256 ];
77- LRESULT needLen = ::SendMessage (reinterpret_cast <HWND>(lParam), CB_GETLBTEXTLEN, selectedIndex, 0 );
78- if (needLen < 256 ) {
79- ::SendMessage (reinterpret_cast <HWND>(lParam), CB_GETLBTEXT, selectedIndex, reinterpret_cast<LPARAM>(buffer));
80- buffer[255 ] = ' \0 ' ;
81- ::MessageBox (NULL , buffer, L" Which Category:" , MB_OK);
82- }
86+ LRESULT needLen = ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_CATEGORY, CB_GETLBTEXTLEN, selectedIndex, 0 );
87+ std::wstring wsCategory (needLen,0 );
88+ ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_CATEGORY, CB_GETLBTEXT, selectedIndex, reinterpret_cast <LPARAM>(wsCategory.c_str()));
89+ if (wsCategory == L" UDL" )
90+ _populate_file_cbx (hwndDlg, pobjCI->vwsUDLFiles );
91+ else if (wsCategory == L" AutoCompletion" )
92+ _populate_file_cbx (hwndDlg, pobjCI->vwsACFiles );
93+ else if (wsCategory == L" FunctionList" )
94+ _populate_file_cbx (hwndDlg, pobjCI->vwsFLFiles );
95+ else if (wsCategory == L" Theme" )
96+ _populate_file_cbx (hwndDlg, pobjCI->vwsThemeFiles );
8397 }
8498 }
8599 return true ;
@@ -107,3 +121,14 @@ INT_PTR CALLBACK ciDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
107121 return false ;
108122}
109123#pragma warning(pop)
124+
125+ void _populate_file_cbx (HWND hwndDlg, std::vector<std::wstring>& vwsList)
126+ {
127+ ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_FILE, CB_RESETCONTENT, 0 , 0 );
128+ ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_FILE, CB_ADDSTRING, 0 , reinterpret_cast <LPARAM>(L" <Pick File>" ));
129+ for (auto & str : vwsList) {
130+ ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_FILE, CB_ADDSTRING, 0 , reinterpret_cast <LPARAM>(str.c_str()));
131+ }
132+ ::SendDlgItemMessage (hwndDlg, IDC_CI_COMBO_FILE, CB_SETCURSEL, 0 , 0 );
133+ return ;
134+ }
0 commit comments