summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/Windows/Control
diff options
context:
space:
mode:
Diffstat (limited to 'other-licenses/7zstub/src/Windows/Control')
-rw-r--r--other-licenses/7zstub/src/Windows/Control/Dialog.cpp145
-rw-r--r--other-licenses/7zstub/src/Windows/Control/Dialog.h141
-rw-r--r--other-licenses/7zstub/src/Windows/Control/ProgressBar.h41
3 files changed, 0 insertions, 327 deletions
diff --git a/other-licenses/7zstub/src/Windows/Control/Dialog.cpp b/other-licenses/7zstub/src/Windows/Control/Dialog.cpp
deleted file mode 100644
index 9d9891f51..000000000
--- a/other-licenses/7zstub/src/Windows/Control/Dialog.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// Windows/Control/Dialog.cpp
-
-#include "StdAfx.h"
-
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-#include "Windows/Control/Dialog.h"
-
-extern HINSTANCE g_hInstance;
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NWindows {
-namespace NControl {
-
-static INT_PTR APIENTRY DialogProcedure(HWND dialogHWND, UINT message,
- WPARAM wParam, LPARAM lParam)
-{
- CWindow dialogTmp(dialogHWND);
- if (message == WM_INITDIALOG)
- dialogTmp.SetUserDataLongPtr(lParam);
- CDialog *dialog = (CDialog *)(dialogTmp.GetUserDataLongPtr());
- if (dialog == NULL)
- return FALSE;
- if (message == WM_INITDIALOG)
- dialog->Attach(dialogHWND);
-
- return BoolToBOOL(dialog->OnMessage(message, wParam, lParam));
-}
-
-bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message)
- {
- case WM_INITDIALOG:
- return OnInit();
- case WM_COMMAND:
- return OnCommand(wParam, lParam);
- case WM_NOTIFY:
- return OnNotify(wParam, (LPNMHDR) lParam);
- case WM_HELP:
- {
- OnHelp((LPHELPINFO)lParam);
- return true;
- }
- case WM_TIMER:
- {
- return OnTimer(wParam, lParam);
- }
- default:
- return false;
- }
-}
-
-bool CDialog::OnCommand(WPARAM wParam, LPARAM lParam)
-{
- return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam);
-}
-
-bool CDialog::OnCommand(int code, int itemID, LPARAM lParam)
-{
- if (code == BN_CLICKED)
- return OnButtonClicked(itemID, (HWND)lParam);
- return false;
-}
-
-bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDOK:
- OnOK();
- break;
- case IDCANCEL:
- OnCancel();
- break;
- case IDHELP:
- OnHelp();
- break;
- default:
- return false;
- }
- return true;
-}
-
-bool CModelessDialog::Create(LPCTSTR templateName, HWND parentWindow)
-{
- HWND aHWND = CreateDialogParam(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this);
- if (aHWND == 0)
- return false;
- Attach(aHWND);
- return true;
-}
-
-INT_PTR CModalDialog::Create(LPCTSTR templateName, HWND parentWindow)
-{
- return DialogBoxParam(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this);
-}
-
-#ifndef _UNICODE
-
-bool CModelessDialog::Create(LPCWSTR templateName, HWND parentWindow)
-{
- HWND aHWND;
- if (g_IsNT)
- aHWND = CreateDialogParamW(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this);
- else
- {
- AString name;
- LPCSTR templateNameA;
- if (IS_INTRESOURCE(templateName))
- templateNameA = (LPCSTR)templateName;
- else
- {
- name = GetSystemString(templateName);
- templateNameA = name;
- }
- aHWND = CreateDialogParamA(g_hInstance, templateNameA, parentWindow, DialogProcedure, (LPARAM)this);
- }
- if (aHWND == 0)
- return false;
- Attach(aHWND);
- return true;
-}
-
-INT_PTR CModalDialog::Create(LPCWSTR templateName, HWND parentWindow)
-{
- if (g_IsNT)
- return DialogBoxParamW(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this);
- AString name;
- LPCSTR templateNameA;
- if (IS_INTRESOURCE(templateName))
- templateNameA = (LPCSTR)templateName;
- else
- {
- name = GetSystemString(templateName);
- templateNameA = name;
- }
- return DialogBoxParamA(g_hInstance, templateNameA, parentWindow, DialogProcedure, (LPARAM)this);
-}
-#endif
-
-}}
diff --git a/other-licenses/7zstub/src/Windows/Control/Dialog.h b/other-licenses/7zstub/src/Windows/Control/Dialog.h
deleted file mode 100644
index 2c78efcba..000000000
--- a/other-licenses/7zstub/src/Windows/Control/Dialog.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Windows/Control/Dialog.h
-
-#ifndef __WINDOWS_CONTROL_DIALOG_H
-#define __WINDOWS_CONTROL_DIALOG_H
-
-#include "Windows/Window.h"
-#include "Windows/Defs.h"
-
-namespace NWindows {
-namespace NControl {
-
-class CDialog: public CWindow
-{
-public:
- CDialog(HWND wndow = NULL): CWindow(wndow){};
- virtual ~CDialog() {};
-
- HWND GetItem(int itemID) const
- { return GetDlgItem(_window, itemID); }
-
- bool EnableItem(int itemID, bool enable) const
- { return BOOLToBool(::EnableWindow(GetItem(itemID), BoolToBOOL(enable))); }
-
- bool SetItemText(int itemID, LPCTSTR s)
- { return BOOLToBool(SetDlgItemText(_window, itemID, s)); }
-
- #ifndef _UNICODE
- bool SetItemText(int 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); }
- #ifndef _UNICODE
- /*
- bool GetItemText(int itemID, LPWSTR string, int maxCount)
- {
- CWindow window(GetItem(itemID));
- 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 result;
- value = GetDlgItemInt(_window, itemID, &result, BoolToBOOL(isSigned));
- return BOOLToBool(result);
- }
-
- HWND GetNextGroupItem(HWND control, bool previous)
- { return GetNextDlgGroupItem(_window, control, BoolToBOOL(previous)); }
- HWND GetNextTabItem(HWND control, bool previous)
- { return GetNextDlgTabItem(_window, control, BoolToBOOL(previous)); }
-
- 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); }
-
- bool CheckButton(int buttonID, UINT checkState)
- { return BOOLToBool(CheckDlgButton(_window, buttonID, checkState)); }
- bool CheckButton(int 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); }
-
- bool CheckRadioButton(int firstButtonID, int lastButtonID, int checkButtonID)
- { return BOOLToBool(::CheckRadioButton(_window, firstButtonID, lastButtonID, 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 void OnHelp(LPHELPINFO helpInfo) { OnHelp(); };
- virtual void OnHelp() {};
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- virtual void OnOK() {};
- virtual void OnCancel() {};
- virtual bool OnNotify(UINT controlID, LPNMHDR lParam) { return false; }
- virtual bool OnTimer(WPARAM timerID, LPARAM callback) { return false; }
-
- LONG_PTR SetMsgResult(LONG_PTR newLongPtr )
- { return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
- LONG_PTR GetMsgResult() const
- { return GetLongPtr(DWLP_MSGRESULT); }
-};
-
-class CModelessDialog: public CDialog
-{
-public:
- bool Create(LPCTSTR templateName, HWND parentWindow);
- #ifndef _UNICODE
- bool Create(LPCWSTR templateName, HWND parentWindow);
- #endif
- virtual void OnOK() { Destroy(); }
- virtual void OnCancel() { Destroy(); }
-};
-
-class CModalDialog: public CDialog
-{
-public:
- INT_PTR Create(LPCTSTR templateName, HWND parentWindow);
- INT_PTR Create(UINT resID, HWND parentWindow)
- { return Create(MAKEINTRESOURCEW(resID), parentWindow); }
- #ifndef _UNICODE
- INT_PTR Create(LPCWSTR templateName, HWND parentWindow);
- #endif
-
- bool End(INT_PTR result)
- { return BOOLToBool(::EndDialog(_window, result)); }
- virtual void OnOK() { End(IDOK); }
- virtual void OnCancel() { End(IDCANCEL); }
-};
-
-class CDialogChildControl: public NWindows::CWindow
-{
-public:
- int m_ID;
- void Init(const NWindows::NControl::CDialog &parentDialog, int id)
- {
- m_ID = id;
- Attach(parentDialog.GetItem(id));
- }
-};
-
-}}
-
-#endif \ No newline at end of file
diff --git a/other-licenses/7zstub/src/Windows/Control/ProgressBar.h b/other-licenses/7zstub/src/Windows/Control/ProgressBar.h
deleted file mode 100644
index 682bab704..000000000
--- a/other-licenses/7zstub/src/Windows/Control/ProgressBar.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Windows/Control/ProgressBar.h
-
-#ifndef __WINDOWS_CONTROL_PROGRESSBAR_H
-#define __WINDOWS_CONTROL_PROGRESSBAR_H
-
-#include "Windows/Window.h"
-#include "Windows/Defs.h"
-
-namespace NWindows {
-namespace NControl {
-
-class CProgressBar: public CWindow
-{
-public:
- LRESULT SetPos(int pos)
- { return SendMessage(PBM_SETPOS, pos, 0); }
- LRESULT DeltaPos(int increment)
- { return SendMessage(PBM_DELTAPOS, increment, 0); }
- UINT GetPos()
- { return SendMessage(PBM_GETPOS, 0, 0); }
- LRESULT SetRange(unsigned short minValue, unsigned short maxValue)
- { return SendMessage(PBM_SETRANGE, 0, MAKELPARAM(minValue, maxValue)); }
- DWORD SetRange32(int minValue, int maxValue)
- { return SendMessage(PBM_SETRANGE32, minValue, maxValue); }
- int SetStep(int aStep)
- { return SendMessage(PBM_SETSTEP, aStep, 0); }
- int StepIt()
- { return SendMessage(PBM_STEPIT, 0, 0); }
-
- int GetRange(bool minValue, PPBRANGE range)
- { return SendMessage(PBM_GETRANGE, BoolToBOOL(minValue), (LPARAM)range); }
-
- COLORREF SetBarColor(COLORREF color)
- { return SendMessage(PBM_SETBARCOLOR, 0, color); }
- COLORREF SetBackgroundColor(COLORREF color)
- { return SendMessage(PBM_SETBKCOLOR, 0, color); }
-};
-
-}}
-
-#endif \ No newline at end of file