mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 00:11:34 -06:00
9.21
This commit is contained in:
committed by
Kornel Lesiński
parent
de4f8c22fe
commit
35596517f2
@@ -2,10 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#include "Common/StringConvert.h"
|
||||
#endif
|
||||
#include "Windows/Control/Dialog.h"
|
||||
#ifndef _UNICODE
|
||||
#include "../../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
@@ -17,17 +17,16 @@ namespace NControl {
|
||||
|
||||
static INT_PTR APIENTRY DialogProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWindow dialogTmp(dialogHWND);
|
||||
CWindow tempDialog(dialogHWND);
|
||||
if (message == WM_INITDIALOG)
|
||||
dialogTmp.SetUserDataLongPtr(lParam);
|
||||
CDialog *dialog = (CDialog *)(dialogTmp.GetUserDataLongPtr());
|
||||
tempDialog.SetUserDataLongPtr(lParam);
|
||||
CDialog *dialog = (CDialog *)(tempDialog.GetUserDataLongPtr());
|
||||
if (dialog == NULL)
|
||||
return FALSE;
|
||||
if (message == WM_INITDIALOG)
|
||||
dialog->Attach(dialogHWND);
|
||||
|
||||
try { return BoolToBOOL(dialog->OnMessage(message, wParam, lParam)); }
|
||||
catch(...) { return true; }
|
||||
catch(...) { return TRUE; }
|
||||
}
|
||||
|
||||
bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
@@ -68,7 +67,7 @@ bool CDialog::OnCommand(int code, int itemID, LPARAM lParam)
|
||||
|
||||
bool CDialog::OnButtonClicked(int buttonID, HWND /* buttonHWND */)
|
||||
{
|
||||
switch(buttonID)
|
||||
switch (buttonID)
|
||||
{
|
||||
case IDOK: OnOK(); break;
|
||||
case IDCANCEL: OnCancel(); break;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "Windows/Control/ListView.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
#endif
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
@@ -93,4 +97,59 @@ int CListView::SetSubItem(int index, int subIndex, LPCWSTR text)
|
||||
|
||||
#endif
|
||||
|
||||
static LRESULT APIENTRY ListViewSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWindow window(hwnd);
|
||||
CListView2 *w = (CListView2 *)(window.GetUserDataLongPtr());
|
||||
if (w == NULL)
|
||||
return 0;
|
||||
return w->OnMessage(message, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CListView2::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef _UNICODE
|
||||
if (g_IsNT)
|
||||
return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
|
||||
else
|
||||
#endif
|
||||
return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
|
||||
}
|
||||
|
||||
void CListView2::SetWindowProc()
|
||||
{
|
||||
SetUserDataLongPtr((LONG_PTR)this);
|
||||
#ifndef _UNICODE
|
||||
if (g_IsNT)
|
||||
_origWindowProc = (WNDPROC)SetLongPtrW(GWLP_WNDPROC, (LONG_PTR)ListViewSubclassProc);
|
||||
else
|
||||
#endif
|
||||
_origWindowProc = (WNDPROC)SetLongPtr(GWLP_WNDPROC, (LONG_PTR)ListViewSubclassProc);
|
||||
}
|
||||
|
||||
/*
|
||||
LRESULT CListView3::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT res = CListView2::OnMessage(message, wParam, lParam);
|
||||
if (message == WM_GETDLGCODE)
|
||||
{
|
||||
// when user presses RETURN, windows sends default (first) button command to parent dialog.
|
||||
// we disable this:
|
||||
MSG *msg = (MSG *)lParam;
|
||||
WPARAM key = wParam;
|
||||
bool change = false;
|
||||
if (msg)
|
||||
{
|
||||
if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN)
|
||||
change = true;
|
||||
}
|
||||
else if (wParam == VK_RETURN)
|
||||
change = true;
|
||||
if (change)
|
||||
res |= DLGC_WANTALLKEYS;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
|
||||
}}
|
||||
|
||||
@@ -18,9 +18,12 @@ public:
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance, LPVOID createParam);
|
||||
|
||||
#ifndef UNDER_CE
|
||||
bool SetUnicodeFormat(bool fUnicode) { return BOOLToBool(ListView_SetUnicodeFormat(_window, BOOLToBool(fUnicode))); }
|
||||
#endif
|
||||
void SetUnicodeFormat()
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
ListView_SetUnicodeFormat(_window, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DeleteAllItems() { return BOOLToBool(ListView_DeleteAllItems(_window)); }
|
||||
bool DeleteColumn(int columnIndex) { return BOOLToBool(ListView_DeleteColumn(_window, columnIndex)); }
|
||||
@@ -65,8 +68,12 @@ public:
|
||||
{ return BOOLToBool(ListView_SortItems(_window, compareFunction, dataParam)); }
|
||||
|
||||
void SetItemState(int index, UINT state, UINT mask) { ListView_SetItemState(_window, index, state, mask); }
|
||||
void SetItemState_Selected(int index, bool select) { SetItemState(index, select ? LVIS_SELECTED : 0, LVIS_SELECTED); }
|
||||
void SetItemState_Selected(int index) { SetItemState(index, LVIS_SELECTED, LVIS_SELECTED); }
|
||||
void SelectAll() { SetItemState_Selected(-1); }
|
||||
void SetItemState_FocusedSelected(int index) { SetItemState(index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); }
|
||||
UINT GetItemState(int index, UINT mask) const { return ListView_GetItemState(_window, index, mask); }
|
||||
bool IsItemSelected(int index) const { return GetItemState(index, LVIS_SELECTED) == LVIS_SELECTED; }
|
||||
|
||||
bool GetColumn(int columnIndex, LVCOLUMN* columnInfo) const
|
||||
{ return BOOLToBool(ListView_GetColumn(_window, columnIndex, columnInfo)); }
|
||||
@@ -104,6 +111,22 @@ public:
|
||||
bool SetColumnWidthAuto(int iCol) { return SetColumnWidth(iCol, LVSCW_AUTOSIZE); }
|
||||
};
|
||||
|
||||
class CListView2: public CListView
|
||||
{
|
||||
WNDPROC _origWindowProc;
|
||||
public:
|
||||
void SetWindowProc();
|
||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
/*
|
||||
class CListView3: public CListView2
|
||||
{
|
||||
public:
|
||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
*/
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,50 +15,30 @@ extern bool g_IsNT;
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
INT_PTR APIENTRY ProperyPageProcedure(HWND dialogHWND, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
static INT_PTR APIENTRY MyProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CDialog tempDialog(dialogHWND);
|
||||
CWindow tempDialog(dialogHWND);
|
||||
if (message == WM_INITDIALOG)
|
||||
tempDialog.SetUserDataLongPtr(((PROPSHEETPAGE *)lParam)->lParam);
|
||||
CDialog *dialog = (CDialog *)(tempDialog.GetUserDataLongPtr());
|
||||
if (dialog == NULL)
|
||||
return FALSE;
|
||||
if (message == WM_INITDIALOG)
|
||||
dialog->Attach(dialogHWND);
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return dialog->OnInit();
|
||||
case WM_COMMAND:
|
||||
return dialog->OnCommand(wParam, lParam);
|
||||
case WM_NOTIFY:
|
||||
return dialog->OnNotify((UINT)wParam, (LPNMHDR) lParam);
|
||||
}
|
||||
if (dialog == NULL)
|
||||
return false;
|
||||
return dialog->OnMessage(message, wParam, lParam);
|
||||
try { return BoolToBOOL(dialog->OnMessage(message, wParam, lParam)); }
|
||||
catch(...) { return TRUE; }
|
||||
}
|
||||
|
||||
bool CPropertyPage::OnNotify(UINT /* controlID */, LPNMHDR lParam)
|
||||
{
|
||||
switch(lParam->code)
|
||||
switch (lParam->code)
|
||||
{
|
||||
case PSN_APPLY:
|
||||
SetMsgResult(OnApply(LPPSHNOTIFY(lParam)));
|
||||
break;
|
||||
case PSN_KILLACTIVE:
|
||||
SetMsgResult(BoolToBOOL(OnKillActive(LPPSHNOTIFY(lParam))));
|
||||
break;
|
||||
case PSN_SETACTIVE:
|
||||
SetMsgResult(OnSetActive(LPPSHNOTIFY(lParam)));
|
||||
break;
|
||||
case PSN_RESET:
|
||||
OnReset(LPPSHNOTIFY(lParam));
|
||||
break;
|
||||
case PSN_HELP:
|
||||
OnNotifyHelp(LPPSHNOTIFY(lParam));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
case PSN_APPLY: SetMsgResult(OnApply(LPPSHNOTIFY(lParam))); break;
|
||||
case PSN_KILLACTIVE: SetMsgResult(BoolToBOOL(OnKillActive(LPPSHNOTIFY(lParam)))); break;
|
||||
case PSN_SETACTIVE: SetMsgResult(OnSetActive(LPPSHNOTIFY(lParam))); break;
|
||||
case PSN_RESET: OnReset(LPPSHNOTIFY(lParam)); break;
|
||||
case PSN_HELP: OnNotifyHelp(LPPSHNOTIFY(lParam)); break;
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -90,7 +70,7 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare
|
||||
page.hInstance = g_hInstance;
|
||||
page.pszTemplate = MAKEINTRESOURCE(pageInfo.ID);
|
||||
page.pszIcon = NULL;
|
||||
page.pfnDlgProc = NWindows::NControl::ProperyPageProcedure;
|
||||
page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;
|
||||
|
||||
if (titles[i].IsEmpty())
|
||||
page.pszTitle = NULL;
|
||||
@@ -111,7 +91,7 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare
|
||||
page.hInstance = g_hInstance;
|
||||
page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID);
|
||||
page.pszIcon = NULL;
|
||||
page.pfnDlgProc = NWindows::NControl::ProperyPageProcedure;
|
||||
page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;
|
||||
|
||||
if (pageInfo.Title.IsEmpty())
|
||||
page.pszTitle = NULL;
|
||||
|
||||
Reference in New Issue
Block a user