mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 16:07:09 -06:00
3.13
This commit is contained in:
102
7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp
Executable file
102
7zip/FileManager/Resource/ListViewDialog/ListViewDialog.cpp
Executable file
@@ -0,0 +1,102 @@
|
||||
// ListViewDialog.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ListViewDialog.h"
|
||||
|
||||
#include "Common/Vector.h"
|
||||
|
||||
#ifdef LANG
|
||||
#include "../../LangUtils.h"
|
||||
static CIDLangPair kIDLangPairs[] =
|
||||
{
|
||||
{ IDOK, 0x02000702 },
|
||||
{ IDCANCEL, 0x02000710 }
|
||||
};
|
||||
#endif
|
||||
|
||||
bool CListViewDialog::OnInit()
|
||||
{
|
||||
#ifdef LANG
|
||||
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
|
||||
#endif
|
||||
_listView.Attach(GetItem(IDC_LISTVIEW_LIST));
|
||||
SetText(Title);
|
||||
|
||||
LVCOLUMN columnInfo;
|
||||
columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
|
||||
columnInfo.fmt = LVCFMT_LEFT;
|
||||
columnInfo.iSubItem = 0;
|
||||
columnInfo.cx = 1000;
|
||||
|
||||
_listView.InsertColumn(0, &columnInfo);
|
||||
|
||||
for(int i = 0; i < Strings.Size(); i++)
|
||||
{
|
||||
LVITEM item;
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = i;
|
||||
item.pszText = (LPTSTR)(LPCTSTR)Strings[i];
|
||||
item.iSubItem = 0;
|
||||
_listView.InsertItem(&item);
|
||||
}
|
||||
if (Strings.Size() > 0)
|
||||
_listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
|
||||
StringsWereChanged = false;
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
bool CListViewDialog::OnNotify(UINT controlID, LPNMHDR header)
|
||||
{
|
||||
if (header->hwndFrom != _listView)
|
||||
return false;
|
||||
switch(header->code)
|
||||
{
|
||||
case LVN_KEYDOWN:
|
||||
{
|
||||
LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
|
||||
switch(keyDownInfo->wVKey)
|
||||
{
|
||||
case VK_DELETE:
|
||||
{
|
||||
if (!DeleteIsAllowed)
|
||||
return false;
|
||||
int focusedIndex = _listView.GetFocusedItem();
|
||||
if (focusedIndex < 0)
|
||||
focusedIndex = 0;
|
||||
while(true)
|
||||
{
|
||||
int index = _listView.GetNextSelectedItem(-1);
|
||||
if (index < 0)
|
||||
break;
|
||||
StringsWereChanged = true;
|
||||
_listView.DeleteItem(index);
|
||||
Strings.Delete(index);
|
||||
}
|
||||
if (focusedIndex >= _listView.GetItemCount())
|
||||
focusedIndex = _listView.GetItemCount() - 1;
|
||||
if (focusedIndex >= 0)
|
||||
_listView.SetItemState(focusedIndex, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
|
||||
return true;
|
||||
}
|
||||
case 'A':
|
||||
{
|
||||
bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
|
||||
if (ctrl)
|
||||
{
|
||||
int numItems = _listView.GetItemCount();
|
||||
for (int i = 0; i < numItems; i++)
|
||||
_listView.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CListViewDialog::OnOK()
|
||||
{
|
||||
FocusedItemIndex = _listView.GetFocusedItem();
|
||||
CModalDialog::OnOK();
|
||||
}
|
||||
33
7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h
Executable file
33
7zip/FileManager/Resource/ListViewDialog/ListViewDialog.h
Executable file
@@ -0,0 +1,33 @@
|
||||
// ListViewDialog.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __LISTVIEWDIALOG_H
|
||||
#define __LISTVIEWDIALOG_H
|
||||
|
||||
#include "Windows/Control/Dialog.h"
|
||||
#include "Windows/Control/ListView.h"
|
||||
#include "resource.h"
|
||||
|
||||
class CListViewDialog: public NWindows::NControl::CModalDialog
|
||||
{
|
||||
NWindows::NControl::CListView _listView;
|
||||
virtual void OnOK();
|
||||
virtual bool OnInit();
|
||||
virtual bool OnNotify(UINT controlID, LPNMHDR header);
|
||||
|
||||
public:
|
||||
UString Title;
|
||||
bool DeleteIsAllowed;
|
||||
CSysStringVector Strings;
|
||||
bool StringsWereChanged;
|
||||
int FocusedItemIndex;
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_LISTVIEW), wndParent); }
|
||||
|
||||
CListViewDialog(): DeleteIsAllowed(false) {}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
20
7zip/FileManager/Resource/ListViewDialog/resource.h
Executable file
20
7zip/FileManager/Resource/ListViewDialog/resource.h
Executable file
@@ -0,0 +1,20 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
|
||||
#define IDD_DIALOG_LISTVIEW 201
|
||||
|
||||
#define IDC_LISTVIEW_LIST 1000
|
||||
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 157
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
101
7zip/FileManager/Resource/ListViewDialog/resource.rc
Executable file
101
7zip/FileManager/Resource/ListViewDialog/resource.rc
Executable file
@@ -0,0 +1,101 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Russian resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(1251)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Russian resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG_LISTVIEW DIALOG DISCARDABLE 0, 0, 356, 234
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "List1",IDC_LISTVIEW_LIST,"SysListView32",LVS_REPORT |
|
||||
LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER |
|
||||
WS_BORDER | WS_TABSTOP,7,7,342,196
|
||||
DEFPUSHBUTTON "OK",IDOK,238,213,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,299,213,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_DIALOG_LISTVIEW, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 349
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 227
|
||||
HORZGUIDE, 203
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user