summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/CPP/Windows/Control/Dialog.h
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/lzma/CPP/Windows/Control/Dialog.h')
-rw-r--r--3rdparty/lzma/CPP/Windows/Control/Dialog.h125
1 files changed, 76 insertions, 49 deletions
diff --git a/3rdparty/lzma/CPP/Windows/Control/Dialog.h b/3rdparty/lzma/CPP/Windows/Control/Dialog.h
index 59b9f41935c..06be4bf938b 100644
--- a/3rdparty/lzma/CPP/Windows/Control/Dialog.h
+++ b/3rdparty/lzma/CPP/Windows/Control/Dialog.h
@@ -1,7 +1,7 @@
// Windows/Control/Dialog.h
-#ifndef __WINDOWS_CONTROL_DIALOG_H
-#define __WINDOWS_CONTROL_DIALOG_H
+#ifndef ZIP7_INC_WINDOWS_CONTROL_DIALOG_H
+#define ZIP7_INC_WINDOWS_CONTROL_DIALOG_H
#include "../Window.h"
@@ -10,53 +10,66 @@ namespace NControl {
class CDialog: public CWindow
{
+ // Z7_CLASS_NO_COPY(CDialog)
public:
- CDialog(HWND wnd = NULL): CWindow(wnd){};
- virtual ~CDialog() {};
+ CDialog(HWND wnd = NULL): CWindow(wnd) {}
+ virtual ~CDialog() {}
- HWND GetItem(int itemID) const
- { return GetDlgItem(_window, itemID); }
+ HWND GetItem(unsigned itemID) const
+ { return GetDlgItem(_window, (int)itemID); }
- bool EnableItem(int itemID, bool enable) const
+ bool EnableItem(unsigned itemID, bool enable) const
{ return BOOLToBool(::EnableWindow(GetItem(itemID), BoolToBOOL(enable))); }
- bool ShowItem(int itemID, int cmdShow) const
+ bool ShowItem(unsigned itemID, int cmdShow) const
{ return BOOLToBool(::ShowWindow(GetItem(itemID), cmdShow)); }
- bool ShowItem_Bool(int itemID, bool show) const
+ bool ShowItem_Bool(unsigned itemID, bool show) const
{ return ShowItem(itemID, show ? SW_SHOW: SW_HIDE); }
- bool HideItem(int itemID) const { return ShowItem(itemID, SW_HIDE); }
+ bool HideItem(unsigned itemID) const { return ShowItem(itemID, SW_HIDE); }
- bool SetItemText(int itemID, LPCTSTR s)
- { return BOOLToBool(SetDlgItemText(_window, itemID, s)); }
+ bool SetItemText(unsigned itemID, LPCTSTR s)
+ { return BOOLToBool(SetDlgItemText(_window, (int)itemID, s)); }
+
+ bool SetItemTextA(unsigned itemID, LPCSTR s)
+ { return BOOLToBool(SetDlgItemTextA(_window, (int)itemID, s)); }
+
+ bool SetItemText_Empty(unsigned itemID)
+ { return SetItemText(itemID, TEXT("")); }
#ifndef _UNICODE
- bool SetItemText(int itemID, LPCWSTR s)
+ bool SetItemText(unsigned itemID, LPCWSTR s)
{
CWindow window(GetItem(itemID));
return window.SetText(s);
}
#endif
- UINT GetItemText(int itemID, LPTSTR string, int maxCount)
- { return GetDlgItemText(_window, itemID, string, maxCount); }
+ UINT GetItemText(unsigned itemID, LPTSTR string, unsigned maxCount)
+ { return GetDlgItemText(_window, (int)itemID, string, (int)maxCount); }
#ifndef _UNICODE
/*
- bool GetItemText(int itemID, LPWSTR string, int maxCount)
+ bool GetItemText(unsigned itemID, LPWSTR string, int maxCount)
{
- CWindow window(GetItem(itemID));
+ CWindow window(GetItem(unsigned));
return window.GetText(string, maxCount);
}
*/
#endif
- bool SetItemInt(int itemID, UINT value, bool isSigned)
- { return BOOLToBool(SetDlgItemInt(_window, itemID, value, BoolToBOOL(isSigned))); }
- bool GetItemInt(int itemID, bool isSigned, UINT &value)
+ bool GetItemText(unsigned itemID, UString &s)
+ {
+ CWindow window(GetItem(itemID));
+ return window.GetText(s);
+ }
+
+ bool SetItemInt(unsigned itemID, UINT value, bool isSigned)
+ { return BOOLToBool(SetDlgItemInt(_window, (int)itemID, value, BoolToBOOL(isSigned))); }
+ bool GetItemInt(unsigned itemID, bool isSigned, UINT &value)
{
BOOL result;
- value = GetDlgItemInt(_window, itemID, &result, BoolToBOOL(isSigned));
+ value = GetDlgItemInt(_window, (int)itemID, &result, BoolToBOOL(isSigned));
return BOOLToBool(result);
}
@@ -65,33 +78,42 @@ public:
HWND GetNextTabItem(HWND control, bool previous)
{ return GetNextDlgTabItem(_window, control, BoolToBOOL(previous)); }
+ LRESULT SendMsg_NextDlgCtl(WPARAM wParam, LPARAM lParam)
+ { return SendMsg(WM_NEXTDLGCTL, wParam, lParam); }
+ LRESULT SendMsg_NextDlgCtl_HWND(HWND hwnd) { return SendMsg_NextDlgCtl((WPARAM)hwnd, TRUE); }
+ LRESULT SendMsg_NextDlgCtl_CtlId(unsigned id) { return SendMsg_NextDlgCtl_HWND(GetItem(id)); }
+ LRESULT SendMsg_NextDlgCtl_Next() { return SendMsg_NextDlgCtl(0, FALSE); }
+ LRESULT SendMsg_NextDlgCtl_Prev() { return SendMsg_NextDlgCtl(1, FALSE); }
+
bool MapRect(LPRECT rect)
{ return BOOLToBool(MapDialogRect(_window, rect)); }
bool IsMessage(LPMSG message)
{ return BOOLToBool(IsDialogMessage(_window, message)); }
- LRESULT SendItemMessage(int itemID, UINT message, WPARAM wParam, LPARAM lParam)
- { return SendDlgItemMessage(_window, itemID, message, wParam, lParam); }
+ LRESULT SendItemMessage(unsigned itemID, UINT message, WPARAM wParam, LPARAM lParam)
+ { return SendDlgItemMessage(_window, (int)itemID, message, wParam, lParam); }
- bool CheckButton(int buttonID, UINT checkState)
- { return BOOLToBool(CheckDlgButton(_window, buttonID, checkState)); }
- bool CheckButton(int buttonID, bool checkState)
+ bool CheckButton(unsigned buttonID, UINT checkState)
+ { return BOOLToBool(CheckDlgButton(_window, (int)buttonID, checkState)); }
+ bool CheckButton(unsigned buttonID, bool checkState)
{ return CheckButton(buttonID, UINT(checkState ? BST_CHECKED : BST_UNCHECKED)); }
- UINT IsButtonChecked(int buttonID) const
- { return IsDlgButtonChecked(_window, buttonID); }
- bool IsButtonCheckedBool(int buttonID) const
- { return (IsButtonChecked(buttonID) == BST_CHECKED); }
+ UINT IsButtonChecked_BST(unsigned buttonID) const
+ { return IsDlgButtonChecked(_window, (int)buttonID); }
+ bool IsButtonCheckedBool(unsigned buttonID) const
+ { return (IsButtonChecked_BST(buttonID) == BST_CHECKED); }
- bool CheckRadioButton(int firstButtonID, int lastButtonID, int checkButtonID)
- { return BOOLToBool(::CheckRadioButton(_window, firstButtonID, lastButtonID, checkButtonID)); }
+ bool CheckRadioButton(unsigned firstButtonID, unsigned lastButtonID, unsigned checkButtonID)
+ { return BOOLToBool(::CheckRadioButton(_window,
+ (int)firstButtonID, (int)lastButtonID, (int)checkButtonID)); }
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
virtual bool OnInit() { return true; }
- virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
- virtual bool OnCommand(int code, int itemID, LPARAM lParam);
+ // virtual bool OnCommand2(WPARAM wParam, LPARAM lParam);
+ virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam);
virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; }
+ virtual bool OnDestroy() { return false; }
/*
#ifdef UNDER_CE
@@ -100,11 +122,12 @@ public:
virtual void OnHelp(LPHELPINFO) { OnHelp(); }
#endif
*/
- virtual void OnHelp() {};
+ virtual void OnHelp() {}
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- virtual void OnOK() {};
- virtual void OnCancel() {};
+ virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND);
+ virtual void OnOK() {}
+ virtual void OnCancel() {}
+ virtual void OnClose() {}
virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */) { return false; }
virtual bool OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { return false; }
@@ -115,9 +138,11 @@ public:
bool GetMargins(int margin, int &x, int &y);
int Units_To_Pixels_X(int units);
- bool GetItemSizes(int id, int &x, int &y);
- void GetClientRectOfItem(int id, RECT &rect);
- bool MoveItem(int id, int x, int y, int width, int height, bool repaint = true);
+ bool GetItemSizes(unsigned id, int &x, int &y);
+ void GetClientRectOfItem(unsigned id, RECT &rect);
+ bool MoveItem(unsigned id, int x, int y, int width, int height, bool repaint = true);
+ bool MoveItem_RECT(unsigned id, const RECT &r, bool repaint = true)
+ { return MoveItem(id, r.left, r.top, RECT_SIZE_X(r), RECT_SIZE_Y(r), repaint); }
void NormalizeSize(bool fullNormalize = false);
void NormalizePosition();
@@ -131,8 +156,9 @@ public:
#ifndef _UNICODE
bool Create(LPCWSTR templateName, HWND parentWindow);
#endif
- virtual void OnOK() { Destroy(); }
- virtual void OnCancel() { Destroy(); }
+ virtual void OnOK() Z7_override { Destroy(); }
+ virtual void OnCancel() Z7_override { Destroy(); }
+ virtual void OnClose() Z7_override { Destroy(); }
};
class CModalDialog: public CDialog
@@ -145,22 +171,23 @@ public:
#endif
bool End(INT_PTR result) { return BOOLToBool(::EndDialog(_window, result)); }
- virtual void OnOK() { End(IDOK); }
- virtual void OnCancel() { End(IDCANCEL); }
+ virtual void OnOK() Z7_override { End(IDOK); }
+ virtual void OnCancel() Z7_override { End(IDCANCEL); }
+ virtual void OnClose() Z7_override { End(IDCLOSE); }
};
class CDialogChildControl: public NWindows::CWindow
{
- int m_ID;
+ // unsigned m_ID;
public:
- void Init(const NWindows::NControl::CDialog &parentDialog, int id)
+ void Init(const NWindows::NControl::CDialog &parentDialog, unsigned id)
{
- m_ID = id;
+ // m_ID = id;
Attach(parentDialog.GetItem(id));
}
};
-bool IsDialogSizeOK(int xSize, int ySize);
+bool IsDialogSizeOK(int xSize, int ySize, HWND hwnd = NULL);
}}