display icons in search dialog

svn path=/trunk/; revision=6241
This commit is contained in:
Martin Fuchs 2003-10-04 23:30:22 +00:00
parent 93e9630e67
commit 26e9ba9eda
5 changed files with 87 additions and 29 deletions

View file

@ -71,15 +71,18 @@ void CollectProgramsThread::collect_programs(const ShellPath& path)
collect_programs(shell_entry->create_absolute_pidl());
else if (entry->_shell_attribs & SFGAO_LINK)
if (_alive)
_callback(dir._folder, shell_entry, _hwnd);
_callback(dir._folder, shell_entry, _para);
}
}
#pragma warning(disable: 4355)
FindProgramTopicDlg::FindProgramTopicDlg(HWND hwnd)
: super(hwnd),
_list_ctrl(GetDlgItem(hwnd, IDC_MAILS_FOUND)),
_thread(collect_programs_callback, _list_ctrl)
_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32, 0, 0)),
_thread(collect_programs_callback, hwnd, this)
{
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
@ -90,7 +93,9 @@ FindProgramTopicDlg::FindProgramTopicDlg(HWND hwnd)
_haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_SEARCH_PROGRAM));
LV_COLUMN column = {LVCF_TEXT|LVCF_FMT|LVCF_WIDTH, LVCFMT_LEFT, 250};
ListView_SetImageList(_list_ctrl, _himl, LVSIL_SMALL);
LV_COLUMN column = {LVCF_FMT|LVCF_WIDTH|LVCF_TEXT, LVCFMT_LEFT, 250};
column.pszText = _T("Name");
ListView_InsertColumn(_list_ctrl, 0, &column);
@ -104,6 +109,12 @@ FindProgramTopicDlg::FindProgramTopicDlg(HWND hwnd)
Refresh();
}
FindProgramTopicDlg::~FindProgramTopicDlg()
{
ImageList_Destroy(_himl);
}
void FindProgramTopicDlg::Refresh()
{
WaitCursor wait;
@ -129,25 +140,31 @@ void FindProgramTopicDlg::collect_programs_callback(ShellFolder& folder, const S
hr = pShellLink->GetPath(path, MAX_PATH-1, (WIN32_FIND_DATA*)&wfd, SLGP_UNCPRIORITY);
if (SUCCEEDED(hr)) {
if (_tcsstr(path, _T(".exe"))) { //@@
HWND list_ctrl = (HWND)param;
String lwr_path = path;
String lwr_name = entry->_display_name;
LV_ITEM item = {LVIF_TEXT, INT_MAX};
_tcslwr((LPTSTR)lwr_path.c_str());
_tcslwr((LPTSTR)lwr_name.c_str());
if (_tcsstr(lwr_path, _T(".exe")) && //@@ filter on ".exe" suffix
!_tcsstr(lwr_name, _T("uninstal")) && !_tcsstr(lwr_name, _T("deinstal"))) { //@@ filter out deinstallation links
FindProgramTopicDlg* pThis = (FindProgramTopicDlg*) param;
LV_ITEM item = {LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, INT_MAX};
item.pszText = entry->_display_name;
item.iItem = ListView_InsertItem(list_ctrl, &item);
item.iSubItem = 1;
item.pszText = path;
ListView_SetItem(list_ctrl, &item);
int icon;
hr = pShellLink->GetIconLocation(path, MAX_PATH-1, &icon);
//TODO: display icon
item.iImage = ImageList_AddIcon(pThis->_himl, entry->_hIcon);
item.lParam = 0; //@@
//TODO: store info in ShellPathWithFolder
item.iItem = ListView_InsertItem(pThis->_list_ctrl, &item);
item.mask = LVIF_TEXT;
item.iSubItem = 1;
item.pszText = path;
ListView_SetItem(pThis->_list_ctrl, &item);
}
}
}
@ -179,3 +196,30 @@ int FindProgramTopicDlg::Command(int id, int code)
return TRUE;
}
int FindProgramTopicDlg::Notify(int id, NMHDR* pnmh)
{
switch(pnmh->code) {
case LVN_GETDISPINFO: {
LV_DISPINFO* pDispInfo = (LV_DISPINFO*) pnmh;
if (pnmh->hwndFrom == _list_ctrl) {
/*
if (pDispInfo->item.mask & LVIF_IMAGE) {
int icon;
HRESULT hr = pShellLink->GetIconLocation(path, MAX_PATH-1, &icon);
HICON hIcon = ExtractIcon();
pDispInfo->item.iImage = ImageList_AddIcon(_himl, hIcon);
pDispInfo->item.mask |= LVIF_DI_SETITEM;
return 1;
}
*/
}
break;}
}
return 0;
}

View file

@ -28,7 +28,8 @@
//
struct ShellPathWithFolder {
struct ShellPathWithFolder
{
ShellPathWithFolder(const ShellFolder& folder, const ShellPath& path)
: _folder(folder), _path(path) {}
@ -41,9 +42,10 @@ typedef void (*COLLECT_CALLBACK)(ShellFolder& folder, const ShellEntry* entry, v
struct CollectProgramsThread : public Thread
{
CollectProgramsThread(COLLECT_CALLBACK callback, HWND hwnd)
CollectProgramsThread(COLLECT_CALLBACK callback, HWND hwnd, void* para)
: _callback(callback),
_hwnd(hwnd)
_hwnd(hwnd),
_para(para)
{
}
@ -52,6 +54,7 @@ struct CollectProgramsThread : public Thread
protected:
COLLECT_CALLBACK _callback;
HWND _hwnd;
void* _para;
void CollectProgramsThread::collect_programs(const ShellPath& path);
};
@ -62,15 +65,19 @@ struct FindProgramTopicDlg : public ResizeController<Dialog>
typedef ResizeController<Dialog> super;
FindProgramTopicDlg(HWND hwnd);
~FindProgramTopicDlg();
protected:
CommonControlInit _usingCmnCtrl;
HWND _list_ctrl;
HACCEL _haccel;
HIMAGELIST _himl;
CollectProgramsThread _thread;
virtual LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam);
virtual int Command(int id, int code);
virtual int Notify(int id, NMHDR* pnmh);
void Refresh();

View file

@ -8,7 +8,6 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include <winuser.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -143,12 +142,21 @@ IDB_LOGOV BITMAP DISCARDABLE "res/logov.bmp"
// Accelerator
//
#ifdef __WINE__
IDA_EXPLORER ACCELERATORS DISCARDABLE
BEGIN
VK_X, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
VK_S, ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL,
NOINVERT
END
#else
IDA_EXPLORER ACCELERATORS DISCARDABLE
BEGIN
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
"S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL,
NOINVERT
END
#endif
IDA_SEARCH_PROGRAM ACCELERATORS DISCARDABLE
BEGIN
@ -559,7 +567,7 @@ BEGIN
PUSHBUTTON "&Help",254,158,43,47,14
END
IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 144, 65
IDD_SEARCH_PROGRAM DIALOGEX 120, 100, 144, 65
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
@ -567,7 +575,7 @@ CAPTION "Search Program in Startmenu"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_TOPIC,7,7,130,14,ES_AUTOHSCROLL
CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT |
CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT | LVS_SINGLESEL|
LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,25,130,33
END

View file

@ -773,15 +773,14 @@ int StartMenuRoot::Command(int id, int code)
CreateSubmenu(id, CSIDL_COMMON_PROGRAMS, CSIDL_PROGRAMS);
break;
case IDC_SEARCH_PROGRAM: {
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
case IDC_SEARCH_PROGRAM:
CloseStartMenu(id);
Dialog::DoModal(IDD_SEARCH_PROGRAM, WINDOW_CREATOR(FindProgramTopicDlg), hwndDesktopBar);
break;}
Dialog::DoModal(IDD_SEARCH_PROGRAM, WINDOW_CREATOR(FindProgramTopicDlg));
break;
case IDC_EXPLORE:
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
CloseStartMenu(id);
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
break;
case IDC_LAUNCH: {

View file

@ -333,8 +333,8 @@ struct Dialog : public Window
Dialog(HWND);
~Dialog();
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent);
static int DoModal(UINT nid, CREATORFUNC creator, const void* info, HWND hwndParent);
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0);
static int DoModal(UINT nid, CREATORFUNC creator, const void* info, HWND hwndParent=0);
protected:
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);