diff options
Diffstat (limited to 'CPP/Windows/Control')
| -rw-r--r-- | CPP/Windows/Control/ComboBox.cpp | 8 | ||||
| -rw-r--r-- | CPP/Windows/Control/ComboBox.h | 22 | ||||
| -rw-r--r-- | CPP/Windows/Control/CommandBar.h | 12 | ||||
| -rw-r--r-- | CPP/Windows/Control/Dialog.cpp | 51 | ||||
| -rw-r--r-- | CPP/Windows/Control/Dialog.h | 114 | ||||
| -rw-r--r-- | CPP/Windows/Control/Edit.h | 4 | ||||
| -rw-r--r-- | CPP/Windows/Control/ImageList.h | 6 | ||||
| -rw-r--r-- | CPP/Windows/Control/ListView.cpp | 47 | ||||
| -rw-r--r-- | CPP/Windows/Control/ListView.h | 51 | ||||
| -rw-r--r-- | CPP/Windows/Control/ProgressBar.h | 24 | ||||
| -rw-r--r-- | CPP/Windows/Control/PropertyPage.cpp | 90 | ||||
| -rw-r--r-- | CPP/Windows/Control/PropertyPage.h | 20 | ||||
| -rw-r--r-- | CPP/Windows/Control/ReBar.h | 6 | ||||
| -rw-r--r-- | CPP/Windows/Control/Static.h | 4 | ||||
| -rw-r--r-- | CPP/Windows/Control/StatusBar.h | 10 | ||||
| -rw-r--r-- | CPP/Windows/Control/StdAfx.h | 7 | ||||
| -rw-r--r-- | CPP/Windows/Control/ToolBar.h | 6 | ||||
| -rw-r--r-- | CPP/Windows/Control/Trackbar.h | 4 | ||||
| -rw-r--r-- | CPP/Windows/Control/Window2.cpp | 14 | ||||
| -rw-r--r-- | CPP/Windows/Control/Window2.h | 16 |
20 files changed, 298 insertions, 218 deletions
diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp index f6ed8d3..8da487d 100644 --- a/CPP/Windows/Control/ComboBox.cpp +++ b/CPP/Windows/Control/ComboBox.cpp | |||
| @@ -43,10 +43,10 @@ LRESULT CComboBox::GetLBText(int index, UString &s) | |||
| 43 | s.Empty(); | 43 | s.Empty(); |
| 44 | if (g_IsNT) | 44 | if (g_IsNT) |
| 45 | { | 45 | { |
| 46 | LRESULT len = SendMsgW(CB_GETLBTEXTLEN, MY__int_TO_WPARAM(index), 0); | 46 | LRESULT len = SendMsgW(CB_GETLBTEXTLEN, MY_int_TO_WPARAM(index), 0); |
| 47 | if (len == CB_ERR) | 47 | if (len == CB_ERR) |
| 48 | return len; | 48 | return len; |
| 49 | LRESULT len2 = SendMsgW(CB_GETLBTEXT, MY__int_TO_WPARAM(index), (LPARAM)s.GetBuf((unsigned)len)); | 49 | LRESULT len2 = SendMsgW(CB_GETLBTEXT, MY_int_TO_WPARAM(index), (LPARAM)s.GetBuf((unsigned)len)); |
| 50 | if (len2 == CB_ERR) | 50 | if (len2 == CB_ERR) |
| 51 | return len; | 51 | return len; |
| 52 | if (len > len2) | 52 | if (len > len2) |
| @@ -55,11 +55,11 @@ LRESULT CComboBox::GetLBText(int index, UString &s) | |||
| 55 | return len; | 55 | return len; |
| 56 | } | 56 | } |
| 57 | AString sa; | 57 | AString sa; |
| 58 | LRESULT len = GetLBText(index, sa); | 58 | const LRESULT len = GetLBText(index, sa); |
| 59 | if (len == CB_ERR) | 59 | if (len == CB_ERR) |
| 60 | return len; | 60 | return len; |
| 61 | s = GetUnicodeString(sa); | 61 | s = GetUnicodeString(sa); |
| 62 | return s.Len(); | 62 | return (LRESULT)s.Len(); |
| 63 | } | 63 | } |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
diff --git a/CPP/Windows/Control/ComboBox.h b/CPP/Windows/Control/ComboBox.h index f08b1f7..2a60b8a 100644 --- a/CPP/Windows/Control/ComboBox.h +++ b/CPP/Windows/Control/ComboBox.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ComboBox.h | 1 | // Windows/Control/ComboBox.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_COMBOBOX_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_COMBOBOX_H |
| 4 | #define __WINDOWS_CONTROL_COMBOBOX_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_COMBOBOX_H |
| 5 | 5 | ||
| 6 | #include "../../Common/MyWindows.h" | 6 | #include "../../Common/MyWindows.h" |
| 7 | 7 | ||
| @@ -12,8 +12,6 @@ | |||
| 12 | namespace NWindows { | 12 | namespace NWindows { |
| 13 | namespace NControl { | 13 | namespace NControl { |
| 14 | 14 | ||
| 15 | #define MY__int_TO_WPARAM(i) ((WPARAM)(INT_PTR)(i)) | ||
| 16 | |||
| 17 | class CComboBox: public CWindow | 15 | class CComboBox: public CWindow |
| 18 | { | 16 | { |
| 19 | public: | 17 | public: |
| @@ -24,7 +22,8 @@ public: | |||
| 24 | #endif | 22 | #endif |
| 25 | 23 | ||
| 26 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ | 24 | /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ |
| 27 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY__int_TO_WPARAM(index), 0); } | 25 | LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } |
| 26 | LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } | ||
| 28 | 27 | ||
| 29 | /* If no item is selected, it returns CB_ERR (-1) */ | 28 | /* If no item is selected, it returns CB_ERR (-1) */ |
| 30 | int GetCurSel() { return (int)SendMsg(CB_GETCURSEL, 0, 0); } | 29 | int GetCurSel() { return (int)SendMsg(CB_GETCURSEL, 0, 0); } |
| @@ -32,15 +31,16 @@ public: | |||
| 32 | /* If an error occurs, it is CB_ERR (-1) */ | 31 | /* If an error occurs, it is CB_ERR (-1) */ |
| 33 | int GetCount() { return (int)SendMsg(CB_GETCOUNT, 0, 0); } | 32 | int GetCount() { return (int)SendMsg(CB_GETCOUNT, 0, 0); } |
| 34 | 33 | ||
| 35 | LRESULT GetLBTextLen(int index) { return SendMsg(CB_GETLBTEXTLEN, MY__int_TO_WPARAM(index), 0); } | 34 | LRESULT GetLBTextLen(int index) { return SendMsg(CB_GETLBTEXTLEN, MY_int_TO_WPARAM(index), 0); } |
| 36 | LRESULT GetLBText(int index, LPTSTR s) { return SendMsg(CB_GETLBTEXT, MY__int_TO_WPARAM(index), (LPARAM)s); } | 35 | LRESULT GetLBText(int index, LPTSTR s) { return SendMsg(CB_GETLBTEXT, MY_int_TO_WPARAM(index), (LPARAM)s); } |
| 37 | LRESULT GetLBText(int index, CSysString &s); | 36 | LRESULT GetLBText(int index, CSysString &s); |
| 38 | #ifndef _UNICODE | 37 | #ifndef _UNICODE |
| 39 | LRESULT GetLBText(int index, UString &s); | 38 | LRESULT GetLBText(int index, UString &s); |
| 40 | #endif | 39 | #endif |
| 41 | 40 | ||
| 42 | LRESULT SetItemData(int index, LPARAM lParam) { return SendMsg(CB_SETITEMDATA, MY__int_TO_WPARAM(index), lParam); } | 41 | LRESULT SetItemData(int index, LPARAM lParam) { return SendMsg(CB_SETITEMDATA, MY_int_TO_WPARAM(index), lParam); } |
| 43 | LRESULT GetItemData(int index) { return SendMsg(CB_GETITEMDATA, MY__int_TO_WPARAM(index), 0); } | 42 | LRESULT GetItemData(int index) { return SendMsg(CB_GETITEMDATA, MY_int_TO_WPARAM(index), 0); } |
| 43 | LRESULT GetItemData(unsigned index) { return SendMsg(CB_GETITEMDATA, index, 0); } | ||
| 44 | 44 | ||
| 45 | LRESULT GetItemData_of_CurSel() { return GetItemData(GetCurSel()); } | 45 | LRESULT GetItemData_of_CurSel() { return GetItemData(GetCurSel()); } |
| 46 | 46 | ||
| @@ -57,7 +57,7 @@ public: | |||
| 57 | /* Returns: | 57 | /* Returns: |
| 58 | an INT value that represents the number of items remaining in the control. | 58 | an INT value that represents the number of items remaining in the control. |
| 59 | If (index) is invalid, the message returns CB_ERR. */ | 59 | If (index) is invalid, the message returns CB_ERR. */ |
| 60 | LRESULT DeleteItem(int index) { return SendMsg(CBEM_DELETEITEM, MY__int_TO_WPARAM(index), 0); } | 60 | LRESULT DeleteItem(int index) { return SendMsg(CBEM_DELETEITEM, MY_int_TO_WPARAM(index), 0); } |
| 61 | 61 | ||
| 62 | LRESULT InsertItem(COMBOBOXEXITEM *item) { return SendMsg(CBEM_INSERTITEM, 0, (LPARAM)item); } | 62 | LRESULT InsertItem(COMBOBOXEXITEM *item) { return SendMsg(CBEM_INSERTITEM, 0, (LPARAM)item); } |
| 63 | #ifndef _UNICODE | 63 | #ifndef _UNICODE |
| @@ -65,7 +65,7 @@ public: | |||
| 65 | #endif | 65 | #endif |
| 66 | 66 | ||
| 67 | LRESULT SetItem(COMBOBOXEXITEM *item) { return SendMsg(CBEM_SETITEM, 0, (LPARAM)item); } | 67 | LRESULT SetItem(COMBOBOXEXITEM *item) { return SendMsg(CBEM_SETITEM, 0, (LPARAM)item); } |
| 68 | DWORD SetExtendedStyle(DWORD exMask, DWORD exStyle) { return (DWORD)SendMsg(CBEM_SETEXTENDEDSTYLE, exMask, exStyle); } | 68 | DWORD SetExtendedStyle(DWORD exMask, DWORD exStyle) { return (DWORD)SendMsg(CBEM_SETEXTENDEDSTYLE, exMask, (LPARAM)exStyle); } |
| 69 | HWND GetEditControl() { return (HWND)SendMsg(CBEM_GETEDITCONTROL, 0, 0); } | 69 | HWND GetEditControl() { return (HWND)SendMsg(CBEM_GETEDITCONTROL, 0, 0); } |
| 70 | HIMAGELIST SetImageList(HIMAGELIST imageList) { return (HIMAGELIST)SendMsg(CBEM_SETIMAGELIST, 0, (LPARAM)imageList); } | 70 | HIMAGELIST SetImageList(HIMAGELIST imageList) { return (HIMAGELIST)SendMsg(CBEM_SETIMAGELIST, 0, (LPARAM)imageList); } |
| 71 | }; | 71 | }; |
diff --git a/CPP/Windows/Control/CommandBar.h b/CPP/Windows/Control/CommandBar.h index a619744..d1b2f17 100644 --- a/CPP/Windows/Control/CommandBar.h +++ b/CPP/Windows/Control/CommandBar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/CommandBar.h | 1 | // Windows/Control/CommandBar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_COMMANDBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_COMMANDBAR_H |
| 4 | #define __WINDOWS_CONTROL_COMMANDBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_COMMANDBAR_H |
| 5 | 5 | ||
| 6 | #ifdef UNDER_CE | 6 | #ifdef UNDER_CE |
| 7 | 7 | ||
| @@ -26,12 +26,12 @@ public: | |||
| 26 | // Macros | 26 | // Macros |
| 27 | // void Destroy() { CommandBar_Destroy(_window); } | 27 | // void Destroy() { CommandBar_Destroy(_window); } |
| 28 | // bool AddButtons(UINT numButtons, LPTBBUTTON buttons) { return BOOLToBool(SendMsg(TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)buttons)); } | 28 | // bool AddButtons(UINT numButtons, LPTBBUTTON buttons) { return BOOLToBool(SendMsg(TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)buttons)); } |
| 29 | bool InsertButton(int iButton, LPTBBUTTON button) { return BOOLToBool(SendMsg(TB_INSERTBUTTON, (WPARAM)iButton, (LPARAM)button)); } | 29 | // bool InsertButton(unsigned iButton, LPTBBUTTON button) { return BOOLToBool(SendMsg(TB_INSERTBUTTON, (WPARAM)iButton, (LPARAM)button)); } |
| 30 | BOOL AddToolTips(UINT numToolTips, LPTSTR toolTips) { return BOOLToBool(SendMsg(TB_SETTOOLTIPS, (WPARAM)numToolTips, (LPARAM)toolTips)); } | 30 | // BOOL AddToolTips(UINT numToolTips, LPTSTR toolTips) { return BOOLToBool(SendMsg(TB_SETTOOLTIPS, (WPARAM)numToolTips, (LPARAM)toolTips)); } |
| 31 | void AutoSize() { SendMsg(TB_AUTOSIZE, 0, 0); } | 31 | void AutoSize() { SendMsg(TB_AUTOSIZE, 0, 0); } |
| 32 | 32 | ||
| 33 | bool AddAdornments(DWORD dwFlags) { return BOOLToBool(::CommandBar_AddAdornments(_window, dwFlags, 0)); } | 33 | // bool AddAdornments(DWORD dwFlags) { return BOOLToBool(::CommandBar_AddAdornments(_window, dwFlags, 0)); } |
| 34 | int AddBitmap(HINSTANCE hInst, int idBitmap, int iNumImages, int iImageWidth, int iImageHeight) { return ::CommandBar_AddBitmap(_window, hInst, idBitmap, iNumImages, iImageWidth, iImageHeight); } | 34 | // int AddBitmap(HINSTANCE hInst, int idBitmap, int iNumImages, int iImageWidth, int iImageHeight) { return ::CommandBar_AddBitmap(_window, hInst, idBitmap, iNumImages, iImageWidth, iImageHeight); } |
| 35 | bool DrawMenuBar(WORD iButton) { return BOOLToBool(::CommandBar_DrawMenuBar(_window, iButton)); } | 35 | bool DrawMenuBar(WORD iButton) { return BOOLToBool(::CommandBar_DrawMenuBar(_window, iButton)); } |
| 36 | HMENU GetMenu(WORD iButton) { return ::CommandBar_GetMenu(_window, iButton); } | 36 | HMENU GetMenu(WORD iButton) { return ::CommandBar_GetMenu(_window, iButton); } |
| 37 | int Height() { return CommandBar_Height(_window); } | 37 | int Height() { return CommandBar_Height(_window); } |
diff --git a/CPP/Windows/Control/Dialog.cpp b/CPP/Windows/Control/Dialog.cpp index 9ddd234..c8f1bd2 100644 --- a/CPP/Windows/Control/Dialog.cpp +++ b/CPP/Windows/Control/Dialog.cpp | |||
| @@ -18,7 +18,14 @@ extern bool g_IsNT; | |||
| 18 | namespace NWindows { | 18 | namespace NWindows { |
| 19 | namespace NControl { | 19 | namespace NControl { |
| 20 | 20 | ||
| 21 | static INT_PTR APIENTRY DialogProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam) | 21 | static |
| 22 | #ifdef Z7_OLD_WIN_SDK | ||
| 23 | BOOL | ||
| 24 | #else | ||
| 25 | INT_PTR | ||
| 26 | #endif | ||
| 27 | APIENTRY | ||
| 28 | DialogProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam) | ||
| 22 | { | 29 | { |
| 23 | CWindow tempDialog(dialogHWND); | 30 | CWindow tempDialog(dialogHWND); |
| 24 | if (message == WM_INITDIALOG) | 31 | if (message == WM_INITDIALOG) |
| @@ -45,7 +52,7 @@ bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) | |||
| 45 | switch (message) | 52 | switch (message) |
| 46 | { | 53 | { |
| 47 | case WM_INITDIALOG: return OnInit(); | 54 | case WM_INITDIALOG: return OnInit(); |
| 48 | case WM_COMMAND: return OnCommand(wParam, lParam); | 55 | case WM_COMMAND: return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam); |
| 49 | case WM_NOTIFY: return OnNotify((UINT)wParam, (LPNMHDR) lParam); | 56 | case WM_NOTIFY: return OnNotify((UINT)wParam, (LPNMHDR) lParam); |
| 50 | case WM_TIMER: return OnTimer(wParam, lParam); | 57 | case WM_TIMER: return OnTimer(wParam, lParam); |
| 51 | case WM_SIZE: return OnSize(wParam, LOWORD(lParam), HIWORD(lParam)); | 58 | case WM_SIZE: return OnSize(wParam, LOWORD(lParam), HIWORD(lParam)); |
| @@ -65,19 +72,21 @@ bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) | |||
| 65 | } | 72 | } |
| 66 | } | 73 | } |
| 67 | 74 | ||
| 68 | bool CDialog::OnCommand(WPARAM wParam, LPARAM lParam) | 75 | /* |
| 76 | bool CDialog::OnCommand2(WPARAM wParam, LPARAM lParam) | ||
| 69 | { | 77 | { |
| 70 | return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam); | 78 | return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam); |
| 71 | } | 79 | } |
| 80 | */ | ||
| 72 | 81 | ||
| 73 | bool CDialog::OnCommand(int code, int itemID, LPARAM lParam) | 82 | bool CDialog::OnCommand(unsigned code, unsigned itemID, LPARAM lParam) |
| 74 | { | 83 | { |
| 75 | if (code == BN_CLICKED) | 84 | if (code == BN_CLICKED) |
| 76 | return OnButtonClicked(itemID, (HWND)lParam); | 85 | return OnButtonClicked(itemID, (HWND)lParam); |
| 77 | return false; | 86 | return false; |
| 78 | } | 87 | } |
| 79 | 88 | ||
| 80 | bool CDialog::OnButtonClicked(int buttonID, HWND /* buttonHWND */) | 89 | bool CDialog::OnButtonClicked(unsigned buttonID, HWND /* buttonHWND */) |
| 81 | { | 90 | { |
| 82 | switch (buttonID) | 91 | switch (buttonID) |
| 83 | { | 92 | { |
| @@ -90,6 +99,28 @@ bool CDialog::OnButtonClicked(int buttonID, HWND /* buttonHWND */) | |||
| 90 | return true; | 99 | return true; |
| 91 | } | 100 | } |
| 92 | 101 | ||
| 102 | #ifndef UNDER_CE | ||
| 103 | /* in win2000/win98 : monitor functions are supported. | ||
| 104 | We need dynamic linking, if we want nt4/win95 support in program. | ||
| 105 | Even if we compile the code with low (WINVER) value, we still | ||
| 106 | want to use monitor functions. So we declare missing functions here */ | ||
| 107 | // #if (WINVER < 0x0500) | ||
| 108 | #ifndef MONITOR_DEFAULTTOPRIMARY | ||
| 109 | extern "C" { | ||
| 110 | DECLARE_HANDLE(HMONITOR); | ||
| 111 | #define MONITOR_DEFAULTTOPRIMARY 0x00000001 | ||
| 112 | typedef struct tagMONITORINFO | ||
| 113 | { | ||
| 114 | DWORD cbSize; | ||
| 115 | RECT rcMonitor; | ||
| 116 | RECT rcWork; | ||
| 117 | DWORD dwFlags; | ||
| 118 | } MONITORINFO, *LPMONITORINFO; | ||
| 119 | WINUSERAPI HMONITOR WINAPI MonitorFromWindow(HWND hwnd, DWORD dwFlags); | ||
| 120 | WINUSERAPI BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpmi); | ||
| 121 | } | ||
| 122 | #endif | ||
| 123 | #endif | ||
| 93 | 124 | ||
| 94 | static bool GetWorkAreaRect(RECT *rect, HWND hwnd) | 125 | static bool GetWorkAreaRect(RECT *rect, HWND hwnd) |
| 95 | { | 126 | { |
| @@ -172,7 +203,7 @@ int CDialog::Units_To_Pixels_X(int units) | |||
| 172 | return rect.right - rect.left; | 203 | return rect.right - rect.left; |
| 173 | } | 204 | } |
| 174 | 205 | ||
| 175 | bool CDialog::GetItemSizes(int id, int &x, int &y) | 206 | bool CDialog::GetItemSizes(unsigned id, int &x, int &y) |
| 176 | { | 207 | { |
| 177 | RECT rect; | 208 | RECT rect; |
| 178 | if (!::GetWindowRect(GetItem(id), &rect)) | 209 | if (!::GetWindowRect(GetItem(id), &rect)) |
| @@ -182,13 +213,13 @@ bool CDialog::GetItemSizes(int id, int &x, int &y) | |||
| 182 | return true; | 213 | return true; |
| 183 | } | 214 | } |
| 184 | 215 | ||
| 185 | void CDialog::GetClientRectOfItem(int id, RECT &rect) | 216 | void CDialog::GetClientRectOfItem(unsigned id, RECT &rect) |
| 186 | { | 217 | { |
| 187 | ::GetWindowRect(GetItem(id), &rect); | 218 | ::GetWindowRect(GetItem(id), &rect); |
| 188 | ScreenToClient(&rect); | 219 | ScreenToClient(&rect); |
| 189 | } | 220 | } |
| 190 | 221 | ||
| 191 | bool CDialog::MoveItem(int id, int x, int y, int width, int height, bool repaint) | 222 | bool CDialog::MoveItem(unsigned id, int x, int y, int width, int height, bool repaint) |
| 192 | { | 223 | { |
| 193 | return BOOLToBool(::MoveWindow(GetItem(id), x, y, width, height, BoolToBOOL(repaint))); | 224 | return BOOLToBool(::MoveWindow(GetItem(id), x, y, width, height, BoolToBOOL(repaint))); |
| 194 | } | 225 | } |
| @@ -356,8 +387,8 @@ void CDialog::NormalizePosition() | |||
| 356 | 387 | ||
| 357 | bool CModelessDialog::Create(LPCTSTR templateName, HWND parentWindow) | 388 | bool CModelessDialog::Create(LPCTSTR templateName, HWND parentWindow) |
| 358 | { | 389 | { |
| 359 | HWND aHWND = CreateDialogParam(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this); | 390 | const HWND aHWND = CreateDialogParam(g_hInstance, templateName, parentWindow, DialogProcedure, (LPARAM)this); |
| 360 | if (aHWND == 0) | 391 | if (!aHWND) |
| 361 | return false; | 392 | return false; |
| 362 | Attach(aHWND); | 393 | Attach(aHWND); |
| 363 | return true; | 394 | return true; |
diff --git a/CPP/Windows/Control/Dialog.h b/CPP/Windows/Control/Dialog.h index 8a39e99..06be4bf 100644 --- a/CPP/Windows/Control/Dialog.h +++ b/CPP/Windows/Control/Dialog.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/Dialog.h | 1 | // Windows/Control/Dialog.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_DIALOG_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_DIALOG_H |
| 4 | #define __WINDOWS_CONTROL_DIALOG_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_DIALOG_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
| @@ -10,65 +10,66 @@ namespace NControl { | |||
| 10 | 10 | ||
| 11 | class CDialog: public CWindow | 11 | class CDialog: public CWindow |
| 12 | { | 12 | { |
| 13 | // Z7_CLASS_NO_COPY(CDialog) | ||
| 13 | public: | 14 | public: |
| 14 | CDialog(HWND wnd = NULL): CWindow(wnd){}; | 15 | CDialog(HWND wnd = NULL): CWindow(wnd) {} |
| 15 | virtual ~CDialog() {}; | 16 | virtual ~CDialog() {} |
| 16 | 17 | ||
| 17 | HWND GetItem(int itemID) const | 18 | HWND GetItem(unsigned itemID) const |
| 18 | { return GetDlgItem(_window, itemID); } | 19 | { return GetDlgItem(_window, (int)itemID); } |
| 19 | 20 | ||
| 20 | bool EnableItem(int itemID, bool enable) const | 21 | bool EnableItem(unsigned itemID, bool enable) const |
| 21 | { return BOOLToBool(::EnableWindow(GetItem(itemID), BoolToBOOL(enable))); } | 22 | { return BOOLToBool(::EnableWindow(GetItem(itemID), BoolToBOOL(enable))); } |
| 22 | 23 | ||
| 23 | bool ShowItem(int itemID, int cmdShow) const | 24 | bool ShowItem(unsigned itemID, int cmdShow) const |
| 24 | { return BOOLToBool(::ShowWindow(GetItem(itemID), cmdShow)); } | 25 | { return BOOLToBool(::ShowWindow(GetItem(itemID), cmdShow)); } |
| 25 | 26 | ||
| 26 | bool ShowItem_Bool(int itemID, bool show) const | 27 | bool ShowItem_Bool(unsigned itemID, bool show) const |
| 27 | { return ShowItem(itemID, show ? SW_SHOW: SW_HIDE); } | 28 | { return ShowItem(itemID, show ? SW_SHOW: SW_HIDE); } |
| 28 | 29 | ||
| 29 | bool HideItem(int itemID) const { return ShowItem(itemID, SW_HIDE); } | 30 | bool HideItem(unsigned itemID) const { return ShowItem(itemID, SW_HIDE); } |
| 30 | 31 | ||
| 31 | bool SetItemText(int itemID, LPCTSTR s) | 32 | bool SetItemText(unsigned itemID, LPCTSTR s) |
| 32 | { return BOOLToBool(SetDlgItemText(_window, itemID, s)); } | 33 | { return BOOLToBool(SetDlgItemText(_window, (int)itemID, s)); } |
| 33 | 34 | ||
| 34 | bool SetItemTextA(int itemID, LPCSTR s) | 35 | bool SetItemTextA(unsigned itemID, LPCSTR s) |
| 35 | { return BOOLToBool(SetDlgItemTextA(_window, itemID, s)); } | 36 | { return BOOLToBool(SetDlgItemTextA(_window, (int)itemID, s)); } |
| 36 | 37 | ||
| 37 | bool SetItemText_Empty(int itemID) | 38 | bool SetItemText_Empty(unsigned itemID) |
| 38 | { return SetItemText(itemID, TEXT("")); } | 39 | { return SetItemText(itemID, TEXT("")); } |
| 39 | 40 | ||
| 40 | #ifndef _UNICODE | 41 | #ifndef _UNICODE |
| 41 | bool SetItemText(int itemID, LPCWSTR s) | 42 | bool SetItemText(unsigned itemID, LPCWSTR s) |
| 42 | { | 43 | { |
| 43 | CWindow window(GetItem(itemID)); | 44 | CWindow window(GetItem(itemID)); |
| 44 | return window.SetText(s); | 45 | return window.SetText(s); |
| 45 | } | 46 | } |
| 46 | #endif | 47 | #endif |
| 47 | 48 | ||
| 48 | UINT GetItemText(int itemID, LPTSTR string, int maxCount) | 49 | UINT GetItemText(unsigned itemID, LPTSTR string, unsigned maxCount) |
| 49 | { return GetDlgItemText(_window, itemID, string, maxCount); } | 50 | { return GetDlgItemText(_window, (int)itemID, string, (int)maxCount); } |
| 50 | #ifndef _UNICODE | 51 | #ifndef _UNICODE |
| 51 | /* | 52 | /* |
| 52 | bool GetItemText(int itemID, LPWSTR string, int maxCount) | 53 | bool GetItemText(unsigned itemID, LPWSTR string, int maxCount) |
| 53 | { | 54 | { |
| 54 | CWindow window(GetItem(itemID)); | 55 | CWindow window(GetItem(unsigned)); |
| 55 | return window.GetText(string, maxCount); | 56 | return window.GetText(string, maxCount); |
| 56 | } | 57 | } |
| 57 | */ | 58 | */ |
| 58 | #endif | 59 | #endif |
| 59 | 60 | ||
| 60 | bool GetItemText(int itemID, UString &s) | 61 | bool GetItemText(unsigned itemID, UString &s) |
| 61 | { | 62 | { |
| 62 | CWindow window(GetItem(itemID)); | 63 | CWindow window(GetItem(itemID)); |
| 63 | return window.GetText(s); | 64 | return window.GetText(s); |
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | bool SetItemInt(int itemID, UINT value, bool isSigned) | 67 | bool SetItemInt(unsigned itemID, UINT value, bool isSigned) |
| 67 | { return BOOLToBool(SetDlgItemInt(_window, itemID, value, BoolToBOOL(isSigned))); } | 68 | { return BOOLToBool(SetDlgItemInt(_window, (int)itemID, value, BoolToBOOL(isSigned))); } |
| 68 | bool GetItemInt(int itemID, bool isSigned, UINT &value) | 69 | bool GetItemInt(unsigned itemID, bool isSigned, UINT &value) |
| 69 | { | 70 | { |
| 70 | BOOL result; | 71 | BOOL result; |
| 71 | value = GetDlgItemInt(_window, itemID, &result, BoolToBOOL(isSigned)); | 72 | value = GetDlgItemInt(_window, (int)itemID, &result, BoolToBOOL(isSigned)); |
| 72 | return BOOLToBool(result); | 73 | return BOOLToBool(result); |
| 73 | } | 74 | } |
| 74 | 75 | ||
| @@ -80,7 +81,7 @@ public: | |||
| 80 | LRESULT SendMsg_NextDlgCtl(WPARAM wParam, LPARAM lParam) | 81 | LRESULT SendMsg_NextDlgCtl(WPARAM wParam, LPARAM lParam) |
| 81 | { return SendMsg(WM_NEXTDLGCTL, wParam, lParam); } | 82 | { return SendMsg(WM_NEXTDLGCTL, wParam, lParam); } |
| 82 | LRESULT SendMsg_NextDlgCtl_HWND(HWND hwnd) { return SendMsg_NextDlgCtl((WPARAM)hwnd, TRUE); } | 83 | LRESULT SendMsg_NextDlgCtl_HWND(HWND hwnd) { return SendMsg_NextDlgCtl((WPARAM)hwnd, TRUE); } |
| 83 | LRESULT SendMsg_NextDlgCtl_CtlId(int id) { return SendMsg_NextDlgCtl_HWND(GetItem(id)); } | 84 | LRESULT SendMsg_NextDlgCtl_CtlId(unsigned id) { return SendMsg_NextDlgCtl_HWND(GetItem(id)); } |
| 84 | LRESULT SendMsg_NextDlgCtl_Next() { return SendMsg_NextDlgCtl(0, FALSE); } | 85 | LRESULT SendMsg_NextDlgCtl_Next() { return SendMsg_NextDlgCtl(0, FALSE); } |
| 85 | LRESULT SendMsg_NextDlgCtl_Prev() { return SendMsg_NextDlgCtl(1, FALSE); } | 86 | LRESULT SendMsg_NextDlgCtl_Prev() { return SendMsg_NextDlgCtl(1, FALSE); } |
| 86 | 87 | ||
| @@ -90,26 +91,27 @@ public: | |||
| 90 | bool IsMessage(LPMSG message) | 91 | bool IsMessage(LPMSG message) |
| 91 | { return BOOLToBool(IsDialogMessage(_window, message)); } | 92 | { return BOOLToBool(IsDialogMessage(_window, message)); } |
| 92 | 93 | ||
| 93 | LRESULT SendItemMessage(int itemID, UINT message, WPARAM wParam, LPARAM lParam) | 94 | LRESULT SendItemMessage(unsigned itemID, UINT message, WPARAM wParam, LPARAM lParam) |
| 94 | { return SendDlgItemMessage(_window, itemID, message, wParam, lParam); } | 95 | { return SendDlgItemMessage(_window, (int)itemID, message, wParam, lParam); } |
| 95 | 96 | ||
| 96 | bool CheckButton(int buttonID, UINT checkState) | 97 | bool CheckButton(unsigned buttonID, UINT checkState) |
| 97 | { return BOOLToBool(CheckDlgButton(_window, buttonID, checkState)); } | 98 | { return BOOLToBool(CheckDlgButton(_window, (int)buttonID, checkState)); } |
| 98 | bool CheckButton(int buttonID, bool checkState) | 99 | bool CheckButton(unsigned buttonID, bool checkState) |
| 99 | { return CheckButton(buttonID, UINT(checkState ? BST_CHECKED : BST_UNCHECKED)); } | 100 | { return CheckButton(buttonID, UINT(checkState ? BST_CHECKED : BST_UNCHECKED)); } |
| 100 | 101 | ||
| 101 | UINT IsButtonChecked(int buttonID) const | 102 | UINT IsButtonChecked_BST(unsigned buttonID) const |
| 102 | { return IsDlgButtonChecked(_window, buttonID); } | 103 | { return IsDlgButtonChecked(_window, (int)buttonID); } |
| 103 | bool IsButtonCheckedBool(int buttonID) const | 104 | bool IsButtonCheckedBool(unsigned buttonID) const |
| 104 | { return (IsButtonChecked(buttonID) == BST_CHECKED); } | 105 | { return (IsButtonChecked_BST(buttonID) == BST_CHECKED); } |
| 105 | 106 | ||
| 106 | bool CheckRadioButton(int firstButtonID, int lastButtonID, int checkButtonID) | 107 | bool CheckRadioButton(unsigned firstButtonID, unsigned lastButtonID, unsigned checkButtonID) |
| 107 | { return BOOLToBool(::CheckRadioButton(_window, firstButtonID, lastButtonID, checkButtonID)); } | 108 | { return BOOLToBool(::CheckRadioButton(_window, |
| 109 | (int)firstButtonID, (int)lastButtonID, (int)checkButtonID)); } | ||
| 108 | 110 | ||
| 109 | virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam); | 111 | virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam); |
| 110 | virtual bool OnInit() { return true; } | 112 | virtual bool OnInit() { return true; } |
| 111 | virtual bool OnCommand(WPARAM wParam, LPARAM lParam); | 113 | // virtual bool OnCommand2(WPARAM wParam, LPARAM lParam); |
| 112 | virtual bool OnCommand(int code, int itemID, LPARAM lParam); | 114 | virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam); |
| 113 | virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; } | 115 | virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; } |
| 114 | virtual bool OnDestroy() { return false; } | 116 | virtual bool OnDestroy() { return false; } |
| 115 | 117 | ||
| @@ -120,11 +122,11 @@ public: | |||
| 120 | virtual void OnHelp(LPHELPINFO) { OnHelp(); } | 122 | virtual void OnHelp(LPHELPINFO) { OnHelp(); } |
| 121 | #endif | 123 | #endif |
| 122 | */ | 124 | */ |
| 123 | virtual void OnHelp() {}; | 125 | virtual void OnHelp() {} |
| 124 | 126 | ||
| 125 | virtual bool OnButtonClicked(int buttonID, HWND buttonHWND); | 127 | virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND); |
| 126 | virtual void OnOK() {}; | 128 | virtual void OnOK() {} |
| 127 | virtual void OnCancel() {}; | 129 | virtual void OnCancel() {} |
| 128 | virtual void OnClose() {} | 130 | virtual void OnClose() {} |
| 129 | virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */) { return false; } | 131 | virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */) { return false; } |
| 130 | virtual bool OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { return false; } | 132 | virtual bool OnTimer(WPARAM /* timerID */, LPARAM /* callback */) { return false; } |
| @@ -136,9 +138,11 @@ public: | |||
| 136 | 138 | ||
| 137 | bool GetMargins(int margin, int &x, int &y); | 139 | bool GetMargins(int margin, int &x, int &y); |
| 138 | int Units_To_Pixels_X(int units); | 140 | int Units_To_Pixels_X(int units); |
| 139 | bool GetItemSizes(int id, int &x, int &y); | 141 | bool GetItemSizes(unsigned id, int &x, int &y); |
| 140 | void GetClientRectOfItem(int id, RECT &rect); | 142 | void GetClientRectOfItem(unsigned id, RECT &rect); |
| 141 | bool MoveItem(int id, int x, int y, int width, int height, bool repaint = true); | 143 | bool MoveItem(unsigned id, int x, int y, int width, int height, bool repaint = true); |
| 144 | bool MoveItem_RECT(unsigned id, const RECT &r, bool repaint = true) | ||
| 145 | { return MoveItem(id, r.left, r.top, RECT_SIZE_X(r), RECT_SIZE_Y(r), repaint); } | ||
| 142 | 146 | ||
| 143 | void NormalizeSize(bool fullNormalize = false); | 147 | void NormalizeSize(bool fullNormalize = false); |
| 144 | void NormalizePosition(); | 148 | void NormalizePosition(); |
| @@ -152,9 +156,9 @@ public: | |||
| 152 | #ifndef _UNICODE | 156 | #ifndef _UNICODE |
| 153 | bool Create(LPCWSTR templateName, HWND parentWindow); | 157 | bool Create(LPCWSTR templateName, HWND parentWindow); |
| 154 | #endif | 158 | #endif |
| 155 | virtual void OnOK() { Destroy(); } | 159 | virtual void OnOK() Z7_override { Destroy(); } |
| 156 | virtual void OnCancel() { Destroy(); } | 160 | virtual void OnCancel() Z7_override { Destroy(); } |
| 157 | virtual void OnClose() { Destroy(); } | 161 | virtual void OnClose() Z7_override { Destroy(); } |
| 158 | }; | 162 | }; |
| 159 | 163 | ||
| 160 | class CModalDialog: public CDialog | 164 | class CModalDialog: public CDialog |
| @@ -167,18 +171,18 @@ public: | |||
| 167 | #endif | 171 | #endif |
| 168 | 172 | ||
| 169 | bool End(INT_PTR result) { return BOOLToBool(::EndDialog(_window, result)); } | 173 | bool End(INT_PTR result) { return BOOLToBool(::EndDialog(_window, result)); } |
| 170 | virtual void OnOK() { End(IDOK); } | 174 | virtual void OnOK() Z7_override { End(IDOK); } |
| 171 | virtual void OnCancel() { End(IDCANCEL); } | 175 | virtual void OnCancel() Z7_override { End(IDCANCEL); } |
| 172 | virtual void OnClose() { End(IDCLOSE); } | 176 | virtual void OnClose() Z7_override { End(IDCLOSE); } |
| 173 | }; | 177 | }; |
| 174 | 178 | ||
| 175 | class CDialogChildControl: public NWindows::CWindow | 179 | class CDialogChildControl: public NWindows::CWindow |
| 176 | { | 180 | { |
| 177 | int m_ID; | 181 | // unsigned m_ID; |
| 178 | public: | 182 | public: |
| 179 | void Init(const NWindows::NControl::CDialog &parentDialog, int id) | 183 | void Init(const NWindows::NControl::CDialog &parentDialog, unsigned id) |
| 180 | { | 184 | { |
| 181 | m_ID = id; | 185 | // m_ID = id; |
| 182 | Attach(parentDialog.GetItem(id)); | 186 | Attach(parentDialog.GetItem(id)); |
| 183 | } | 187 | } |
| 184 | }; | 188 | }; |
diff --git a/CPP/Windows/Control/Edit.h b/CPP/Windows/Control/Edit.h index 51a22c5..963470d 100644 --- a/CPP/Windows/Control/Edit.h +++ b/CPP/Windows/Control/Edit.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/Edit.h | 1 | // Windows/Control/Edit.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_EDIT_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_EDIT_H |
| 4 | #define __WINDOWS_CONTROL_EDIT_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_EDIT_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
diff --git a/CPP/Windows/Control/ImageList.h b/CPP/Windows/Control/ImageList.h index 19feb11..688f177 100644 --- a/CPP/Windows/Control/ImageList.h +++ b/CPP/Windows/Control/ImageList.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ImageList.h | 1 | // Windows/Control/ImageList.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_IMAGE_LIST_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_IMAGE_LIST_H |
| 4 | #define __WINDOWS_CONTROL_IMAGE_LIST_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_IMAGE_LIST_H |
| 5 | 5 | ||
| 6 | #include <CommCtrl.h> | 6 | #include <CommCtrl.h> |
| 7 | 7 | ||
| @@ -56,7 +56,7 @@ public: | |||
| 56 | bool GetImageInfo(int index, IMAGEINFO* imageInfo) const | 56 | bool GetImageInfo(int index, IMAGEINFO* imageInfo) const |
| 57 | { return BOOLToBool(ImageList_GetImageInfo(m_Object, index, imageInfo)); } | 57 | { return BOOLToBool(ImageList_GetImageInfo(m_Object, index, imageInfo)); } |
| 58 | 58 | ||
| 59 | int Add(HBITMAP hbmImage, HBITMAP hbmMask = 0) | 59 | int Add(HBITMAP hbmImage, HBITMAP hbmMask = NULL) |
| 60 | { return ImageList_Add(m_Object, hbmImage, hbmMask); } | 60 | { return ImageList_Add(m_Object, hbmImage, hbmMask); } |
| 61 | int AddMasked(HBITMAP hbmImage, COLORREF mask) | 61 | int AddMasked(HBITMAP hbmImage, COLORREF mask) |
| 62 | { return ImageList_AddMasked(m_Object, hbmImage, mask); } | 62 | { return ImageList_AddMasked(m_Object, hbmImage, mask); } |
diff --git a/CPP/Windows/Control/ListView.cpp b/CPP/Windows/Control/ListView.cpp index 16cfd39..3e8786a 100644 --- a/CPP/Windows/Control/ListView.cpp +++ b/CPP/Windows/Control/ListView.cpp | |||
| @@ -20,78 +20,85 @@ bool CListView::CreateEx(DWORD exStyle, DWORD style, | |||
| 20 | height, parentWindow, idOrHMenu, instance, createParam); | 20 | height, parentWindow, idOrHMenu, instance, createParam); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | bool CListView::GetItemParam(int index, LPARAM ¶m) const | 23 | /* note: LVITEM and LVCOLUMN structures contain optional fields |
| 24 | depending from preprocessor macros: | ||
| 25 | #if (_WIN32_IE >= 0x0300) | ||
| 26 | #if (_WIN32_WINNT >= 0x0501) | ||
| 27 | #if (_WIN32_WINNT >= 0x0600) | ||
| 28 | */ | ||
| 29 | |||
| 30 | bool CListView::GetItemParam(unsigned index, LPARAM ¶m) const | ||
| 24 | { | 31 | { |
| 25 | LVITEM item; | 32 | LVITEM item; |
| 26 | item.iItem = index; | 33 | item.iItem = (int)index; |
| 27 | item.iSubItem = 0; | 34 | item.iSubItem = 0; |
| 28 | item.mask = LVIF_PARAM; | 35 | item.mask = LVIF_PARAM; |
| 29 | bool aResult = GetItem(&item); | 36 | const bool res = GetItem(&item); |
| 30 | param = item.lParam; | 37 | param = item.lParam; |
| 31 | return aResult; | 38 | return res; |
| 32 | } | 39 | } |
| 33 | 40 | ||
| 34 | int CListView::InsertColumn(int columnIndex, LPCTSTR text, int width) | 41 | int CListView::InsertColumn(unsigned columnIndex, LPCTSTR text, int width) |
| 35 | { | 42 | { |
| 36 | LVCOLUMN ci; | 43 | LVCOLUMN ci; |
| 37 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; | 44 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; |
| 38 | ci.pszText = (LPTSTR)(void *)text; | 45 | ci.pszText = (LPTSTR)(void *)text; |
| 39 | ci.iSubItem = columnIndex; | 46 | ci.iSubItem = (int)columnIndex; |
| 40 | ci.cx = width; | 47 | ci.cx = width; |
| 41 | return InsertColumn(columnIndex, &ci); | 48 | return InsertColumn(columnIndex, &ci); |
| 42 | } | 49 | } |
| 43 | 50 | ||
| 44 | int CListView::InsertItem(int index, LPCTSTR text) | 51 | int CListView::InsertItem(unsigned index, LPCTSTR text) |
| 45 | { | 52 | { |
| 46 | LVITEM item; | 53 | LVITEM item; |
| 47 | item.mask = LVIF_TEXT | LVIF_PARAM; | 54 | item.mask = LVIF_TEXT | LVIF_PARAM; |
| 48 | item.iItem = index; | 55 | item.iItem = (int)index; |
| 49 | item.lParam = index; | 56 | item.lParam = (LPARAM)index; |
| 50 | item.pszText = (LPTSTR)(void *)text; | 57 | item.pszText = (LPTSTR)(void *)text; |
| 51 | item.iSubItem = 0; | 58 | item.iSubItem = 0; |
| 52 | return InsertItem(&item); | 59 | return InsertItem(&item); |
| 53 | } | 60 | } |
| 54 | 61 | ||
| 55 | int CListView::SetSubItem(int index, int subIndex, LPCTSTR text) | 62 | int CListView::SetSubItem(unsigned index, unsigned subIndex, LPCTSTR text) |
| 56 | { | 63 | { |
| 57 | LVITEM item; | 64 | LVITEM item; |
| 58 | item.mask = LVIF_TEXT; | 65 | item.mask = LVIF_TEXT; |
| 59 | item.iItem = index; | 66 | item.iItem = (int)index; |
| 60 | item.pszText = (LPTSTR)(void *)text; | 67 | item.pszText = (LPTSTR)(void *)text; |
| 61 | item.iSubItem = subIndex; | 68 | item.iSubItem = (int)subIndex; |
| 62 | return SetItem(&item); | 69 | return SetItem(&item); |
| 63 | } | 70 | } |
| 64 | 71 | ||
| 65 | #ifndef _UNICODE | 72 | #ifndef _UNICODE |
| 66 | 73 | ||
| 67 | int CListView::InsertColumn(int columnIndex, LPCWSTR text, int width) | 74 | int CListView::InsertColumn(unsigned columnIndex, LPCWSTR text, int width) |
| 68 | { | 75 | { |
| 69 | LVCOLUMNW ci; | 76 | LVCOLUMNW ci; |
| 70 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; | 77 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; |
| 71 | ci.pszText = (LPWSTR)(void *)text; | 78 | ci.pszText = (LPWSTR)(void *)text; |
| 72 | ci.iSubItem = columnIndex; | 79 | ci.iSubItem = (int)columnIndex; |
| 73 | ci.cx = width; | 80 | ci.cx = width; |
| 74 | return InsertColumn(columnIndex, &ci); | 81 | return InsertColumn(columnIndex, &ci); |
| 75 | } | 82 | } |
| 76 | 83 | ||
| 77 | int CListView::InsertItem(int index, LPCWSTR text) | 84 | int CListView::InsertItem(unsigned index, LPCWSTR text) |
| 78 | { | 85 | { |
| 79 | LVITEMW item; | 86 | LVITEMW item; |
| 80 | item.mask = LVIF_TEXT | LVIF_PARAM; | 87 | item.mask = LVIF_TEXT | LVIF_PARAM; |
| 81 | item.iItem = index; | 88 | item.iItem = (int)index; |
| 82 | item.lParam = index; | 89 | item.lParam = (LPARAM)index; |
| 83 | item.pszText = (LPWSTR)(void *)text; | 90 | item.pszText = (LPWSTR)(void *)text; |
| 84 | item.iSubItem = 0; | 91 | item.iSubItem = 0; |
| 85 | return InsertItem(&item); | 92 | return InsertItem(&item); |
| 86 | } | 93 | } |
| 87 | 94 | ||
| 88 | int CListView::SetSubItem(int index, int subIndex, LPCWSTR text) | 95 | int CListView::SetSubItem(unsigned index, unsigned subIndex, LPCWSTR text) |
| 89 | { | 96 | { |
| 90 | LVITEMW item; | 97 | LVITEMW item; |
| 91 | item.mask = LVIF_TEXT; | 98 | item.mask = LVIF_TEXT; |
| 92 | item.iItem = index; | 99 | item.iItem = (int)index; |
| 93 | item.pszText = (LPWSTR)(void *)text; | 100 | item.pszText = (LPWSTR)(void *)text; |
| 94 | item.iSubItem = subIndex; | 101 | item.iSubItem = (int)subIndex; |
| 95 | return SetItem(&item); | 102 | return SetItem(&item); |
| 96 | } | 103 | } |
| 97 | 104 | ||
diff --git a/CPP/Windows/Control/ListView.h b/CPP/Windows/Control/ListView.h index a13b104..11a33a0 100644 --- a/CPP/Windows/Control/ListView.h +++ b/CPP/Windows/Control/ListView.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ListView.h | 1 | // Windows/Control/ListView.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_LISTVIEW_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_LISTVIEW_H |
| 4 | #define __WINDOWS_CONTROL_LISTVIEW_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_LISTVIEW_H |
| 5 | 5 | ||
| 6 | #include "../../Common/MyWindows.h" | 6 | #include "../../Common/MyWindows.h" |
| 7 | 7 | ||
| @@ -28,11 +28,11 @@ public: | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | bool DeleteAllItems() { return BOOLToBool(ListView_DeleteAllItems(_window)); } | 30 | bool DeleteAllItems() { return BOOLToBool(ListView_DeleteAllItems(_window)); } |
| 31 | bool DeleteColumn(int columnIndex) { return BOOLToBool(ListView_DeleteColumn(_window, columnIndex)); } | 31 | bool DeleteColumn(unsigned columnIndex) { return BOOLToBool(ListView_DeleteColumn(_window, columnIndex)); } |
| 32 | 32 | ||
| 33 | int InsertColumn(int columnIndex, const LVCOLUMN *columnInfo) { return ListView_InsertColumn(_window, columnIndex, columnInfo); } | 33 | int InsertColumn(unsigned columnIndex, const LVCOLUMN *columnInfo) { return ListView_InsertColumn(_window, columnIndex, columnInfo); } |
| 34 | int InsertColumn(int columnIndex, LPCTSTR text, int width); | 34 | int InsertColumn(unsigned columnIndex, LPCTSTR text, int width); |
| 35 | bool SetColumnOrderArray(int count, const int *columns) | 35 | bool SetColumnOrderArray(unsigned count, const int *columns) |
| 36 | { return BOOLToBool(ListView_SetColumnOrderArray(_window, count, (int *)(void *)columns)); } | 36 | { return BOOLToBool(ListView_SetColumnOrderArray(_window, count, (int *)(void *)columns)); } |
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| @@ -46,43 +46,49 @@ public: | |||
| 46 | */ | 46 | */ |
| 47 | 47 | ||
| 48 | int InsertItem(const LVITEM* item) { return ListView_InsertItem(_window, item); } | 48 | int InsertItem(const LVITEM* item) { return ListView_InsertItem(_window, item); } |
| 49 | int InsertItem(int index, LPCTSTR text); | 49 | int InsertItem(unsigned index, LPCTSTR text); |
| 50 | bool SetItem(const LVITEM* item) { return BOOLToBool(ListView_SetItem(_window, item)); } | 50 | bool SetItem(const LVITEM* item) { return BOOLToBool(ListView_SetItem(_window, item)); } |
| 51 | int SetSubItem(int index, int subIndex, LPCTSTR text); | 51 | int SetSubItem(unsigned index, unsigned subIndex, LPCTSTR text); |
| 52 | 52 | ||
| 53 | #ifndef _UNICODE | 53 | #ifndef _UNICODE |
| 54 | 54 | ||
| 55 | int InsertColumn(int columnIndex, const LVCOLUMNW *columnInfo) { return (int)SendMsg(LVM_INSERTCOLUMNW, (WPARAM)columnIndex, (LPARAM)columnInfo); } | 55 | int InsertColumn(unsigned columnIndex, const LVCOLUMNW *columnInfo) { return (int)SendMsg(LVM_INSERTCOLUMNW, (WPARAM)columnIndex, (LPARAM)columnInfo); } |
| 56 | int InsertColumn(int columnIndex, LPCWSTR text, int width); | 56 | int InsertColumn(unsigned columnIndex, LPCWSTR text, int width); |
| 57 | int InsertItem(const LV_ITEMW* item) { return (int)SendMsg(LVM_INSERTITEMW, 0, (LPARAM)item); } | 57 | int InsertItem(const LV_ITEMW* item) { return (int)SendMsg(LVM_INSERTITEMW, 0, (LPARAM)item); } |
| 58 | int InsertItem(int index, LPCWSTR text); | 58 | int InsertItem(unsigned index, LPCWSTR text); |
| 59 | bool SetItem(const LV_ITEMW* item) { return BOOLToBool((BOOL)SendMsg(LVM_SETITEMW, 0, (LPARAM)item)); } | 59 | bool SetItem(const LV_ITEMW* item) { return BOOLToBool((BOOL)SendMsg(LVM_SETITEMW, 0, (LPARAM)item)); } |
| 60 | int SetSubItem(int index, int subIndex, LPCWSTR text); | 60 | int SetSubItem(unsigned index, unsigned subIndex, LPCWSTR text); |
| 61 | 61 | ||
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | bool DeleteItem(int itemIndex) { return BOOLToBool(ListView_DeleteItem(_window, itemIndex)); } | 64 | bool DeleteItem(unsigned itemIndex) { return BOOLToBool(ListView_DeleteItem(_window, itemIndex)); } |
| 65 | 65 | ||
| 66 | UINT GetSelectedCount() const { return ListView_GetSelectedCount(_window); } | 66 | UINT GetSelectedCount() const { return ListView_GetSelectedCount(_window); } |
| 67 | int GetItemCount() const { return ListView_GetItemCount(_window); } | 67 | int GetItemCount() const { return ListView_GetItemCount(_window); } |
| 68 | 68 | ||
| 69 | INT GetSelectionMark() const { return ListView_GetSelectionMark(_window); } | 69 | INT GetSelectionMark() const { return ListView_GetSelectionMark(_window); } |
| 70 | 70 | ||
| 71 | void SetItemCount(int numItems) { ListView_SetItemCount(_window, numItems); } | 71 | void SetItemCount(unsigned numItems) { ListView_SetItemCount(_window, numItems); } |
| 72 | void SetItemCountEx(int numItems, DWORD flags) { ListView_SetItemCountEx(_window, numItems, flags); } | 72 | void SetItemCountEx(unsigned numItems, DWORD flags) { ListView_SetItemCountEx(_window, numItems, flags); } |
| 73 | 73 | ||
| 74 | /* startIndex : The index of the item with which to begin the search, | ||
| 75 | or -1 to find the first item that matches the specified flags. | ||
| 76 | The specified item itself is excluded from the search. */ | ||
| 74 | int GetNextItem(int startIndex, UINT flags) const { return ListView_GetNextItem(_window, startIndex, flags); } | 77 | int GetNextItem(int startIndex, UINT flags) const { return ListView_GetNextItem(_window, startIndex, flags); } |
| 75 | int GetNextSelectedItem(int startIndex) const { return GetNextItem(startIndex, LVNI_SELECTED); } | 78 | int GetNextSelectedItem(int startIndex) const { return GetNextItem(startIndex, LVNI_SELECTED); } |
| 76 | int GetFocusedItem() const { return GetNextItem(-1, LVNI_FOCUSED); } | 79 | int GetFocusedItem() const { return GetNextItem(-1, LVNI_FOCUSED); } |
| 77 | 80 | ||
| 78 | bool GetItem(LVITEM* item) const { return BOOLToBool(ListView_GetItem(_window, item)); } | 81 | bool GetItem(LVITEM* item) const { return BOOLToBool(ListView_GetItem(_window, item)); } |
| 79 | bool GetItemParam(int itemIndex, LPARAM ¶m) const; | 82 | bool GetItemParam(unsigned itemIndex, LPARAM ¶m) const; |
| 80 | void GetItemText(int itemIndex, int subItemIndex, LPTSTR text, int textSizeMax) const | 83 | /* |
| 81 | { ListView_GetItemText(_window, itemIndex, subItemIndex, text, textSizeMax); } | 84 | void GetItemText(unsigned itemIndex, unsigned subItemIndex, LPTSTR text, unsigned textSizeMax) const |
| 85 | { ListView_GetItemText(_window, itemIndex, subItemIndex, text, textSizeMax) } | ||
| 86 | */ | ||
| 82 | bool SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam) | 87 | bool SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam) |
| 83 | { return BOOLToBool(ListView_SortItems(_window, compareFunction, dataParam)); } | 88 | { return BOOLToBool(ListView_SortItems(_window, compareFunction, dataParam)); } |
| 84 | 89 | ||
| 85 | void SetItemState(int index, UINT state, UINT mask) { ListView_SetItemState(_window, index, state, mask); } | 90 | // If (index == -1), then the state change is applied to all items. |
| 91 | void SetItemState(int index, UINT state, UINT mask) { ListView_SetItemState(_window, index, state, mask) } | ||
| 86 | void SetItemState_Selected(int index, bool select) { SetItemState(index, select ? LVIS_SELECTED : 0, LVIS_SELECTED); } | 92 | void SetItemState_Selected(int index, bool select) { SetItemState(index, select ? LVIS_SELECTED : 0, LVIS_SELECTED); } |
| 87 | void SetItemState_Selected(int index) { SetItemState(index, LVIS_SELECTED, LVIS_SELECTED); } | 93 | void SetItemState_Selected(int index) { SetItemState(index, LVIS_SELECTED, LVIS_SELECTED); } |
| 88 | void SelectAll() { SetItemState_Selected(-1); } | 94 | void SelectAll() { SetItemState_Selected(-1); } |
| @@ -90,7 +96,7 @@ public: | |||
| 90 | UINT GetItemState(int index, UINT mask) const { return ListView_GetItemState(_window, index, mask); } | 96 | UINT GetItemState(int index, UINT mask) const { return ListView_GetItemState(_window, index, mask); } |
| 91 | bool IsItemSelected(int index) const { return GetItemState(index, LVIS_SELECTED) == LVIS_SELECTED; } | 97 | bool IsItemSelected(int index) const { return GetItemState(index, LVIS_SELECTED) == LVIS_SELECTED; } |
| 92 | 98 | ||
| 93 | bool GetColumn(int columnIndex, LVCOLUMN* columnInfo) const | 99 | bool GetColumn(unsigned columnIndex, LVCOLUMN* columnInfo) const |
| 94 | { return BOOLToBool(ListView_GetColumn(_window, columnIndex, columnInfo)); } | 100 | { return BOOLToBool(ListView_GetColumn(_window, columnIndex, columnInfo)); } |
| 95 | 101 | ||
| 96 | HIMAGELIST SetImageList(HIMAGELIST imageList, int imageListType) | 102 | HIMAGELIST SetImageList(HIMAGELIST imageList, int imageListType) |
| @@ -101,7 +107,7 @@ public: | |||
| 101 | void SetExtendedListViewStyle(DWORD exStyle) { ListView_SetExtendedListViewStyle(_window, exStyle); } | 107 | void SetExtendedListViewStyle(DWORD exStyle) { ListView_SetExtendedListViewStyle(_window, exStyle); } |
| 102 | void SetExtendedListViewStyle(DWORD exMask, DWORD exStyle) { ListView_SetExtendedListViewStyleEx(_window, exMask, exStyle); } | 108 | void SetExtendedListViewStyle(DWORD exMask, DWORD exStyle) { ListView_SetExtendedListViewStyleEx(_window, exMask, exStyle); } |
| 103 | 109 | ||
| 104 | void SetCheckState(UINT index, bool checkState) { ListView_SetCheckState(_window, index, BoolToBOOL(checkState)); } | 110 | void SetCheckState(UINT index, bool checkState) { ListView_SetCheckState(_window, index, BoolToBOOL(checkState)) } |
| 105 | bool GetCheckState(UINT index) { return BOOLToBool(ListView_GetCheckState(_window, index)); } | 111 | bool GetCheckState(UINT index) { return BOOLToBool(ListView_GetCheckState(_window, index)); } |
| 106 | 112 | ||
| 107 | bool EnsureVisible(int index, bool partialOK) { return BOOLToBool(ListView_EnsureVisible(_window, index, BoolToBOOL(partialOK))); } | 113 | bool EnsureVisible(int index, bool partialOK) { return BOOLToBool(ListView_EnsureVisible(_window, index, BoolToBOOL(partialOK))); } |
| @@ -129,7 +135,10 @@ public: | |||
| 129 | class CListView2: public CListView | 135 | class CListView2: public CListView |
| 130 | { | 136 | { |
| 131 | WNDPROC _origWindowProc; | 137 | WNDPROC _origWindowProc; |
| 138 | // ~CListView2() ZIP7_eq_delete; | ||
| 132 | public: | 139 | public: |
| 140 | virtual ~CListView2() {} | ||
| 141 | CListView2() {} | ||
| 133 | void SetWindowProc(); | 142 | void SetWindowProc(); |
| 134 | virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); | 143 | virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); |
| 135 | }; | 144 | }; |
diff --git a/CPP/Windows/Control/ProgressBar.h b/CPP/Windows/Control/ProgressBar.h index 0374306..2256aa9 100644 --- a/CPP/Windows/Control/ProgressBar.h +++ b/CPP/Windows/Control/ProgressBar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ProgressBar.h | 1 | // Windows/Control/ProgressBar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_PROGRESSBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_PROGRESSBAR_H |
| 4 | #define __WINDOWS_CONTROL_PROGRESSBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_PROGRESSBAR_H |
| 5 | 5 | ||
| 6 | #include "../../Common/MyWindows.h" | 6 | #include "../../Common/MyWindows.h" |
| 7 | 7 | ||
| @@ -15,18 +15,18 @@ namespace NControl { | |||
| 15 | class CProgressBar: public CWindow | 15 | class CProgressBar: public CWindow |
| 16 | { | 16 | { |
| 17 | public: | 17 | public: |
| 18 | LRESULT SetPos(int pos) { return SendMsg(PBM_SETPOS, pos, 0); } | 18 | LRESULT SetPos(int pos) { return SendMsg(PBM_SETPOS, (unsigned)pos, 0); } |
| 19 | LRESULT DeltaPos(int increment) { return SendMsg(PBM_DELTAPOS, increment, 0); } | 19 | // LRESULT DeltaPos(int increment) { return SendMsg(PBM_DELTAPOS, increment, 0); } |
| 20 | UINT GetPos() { return (UINT)SendMsg(PBM_GETPOS, 0, 0); } | 20 | // UINT GetPos() { return (UINT)SendMsg(PBM_GETPOS, 0, 0); } |
| 21 | LRESULT SetRange(unsigned short minValue, unsigned short maxValue) { return SendMsg(PBM_SETRANGE, 0, MAKELPARAM(minValue, maxValue)); } | 21 | // LRESULT SetRange(unsigned short minValue, unsigned short maxValue) { return SendMsg(PBM_SETRANGE, 0, MAKELPARAM(minValue, maxValue)); } |
| 22 | DWORD SetRange32(int minValue, int maxValue) { return (DWORD)SendMsg(PBM_SETRANGE32, minValue, maxValue); } | 22 | DWORD SetRange32(int minValue, int maxValue) { return (DWORD)SendMsg(PBM_SETRANGE32, (unsigned)minValue, (LPARAM)(unsigned)maxValue); } |
| 23 | int SetStep(int step) { return (int)SendMsg(PBM_SETSTEP, step, 0); } | 23 | // int SetStep(int step) { return (int)SendMsg(PBM_SETSTEP, step, 0); } |
| 24 | LRESULT StepIt() { return SendMsg(PBM_STEPIT, 0, 0); } | 24 | // LRESULT StepIt() { return SendMsg(PBM_STEPIT, 0, 0); } |
| 25 | INT GetRange(bool minValue, PPBRANGE range) { return (INT)SendMsg(PBM_GETRANGE, BoolToBOOL(minValue), (LPARAM)range); } | 25 | // INT GetRange(bool minValue, PPBRANGE range) { return (INT)SendMsg(PBM_GETRANGE, BoolToBOOL(minValue), (LPARAM)range); } |
| 26 | 26 | ||
| 27 | #ifndef UNDER_CE | 27 | #ifndef UNDER_CE |
| 28 | COLORREF SetBarColor(COLORREF color) { return (COLORREF)SendMsg(PBM_SETBARCOLOR, 0, color); } | 28 | COLORREF SetBarColor(COLORREF color) { return (COLORREF)SendMsg(PBM_SETBARCOLOR, 0, (LPARAM)color); } |
| 29 | COLORREF SetBackgroundColor(COLORREF color) { return (COLORREF)SendMsg(PBM_SETBKCOLOR, 0, color); } | 29 | COLORREF SetBackgroundColor(COLORREF color) { return (COLORREF)SendMsg(PBM_SETBKCOLOR, 0, (LPARAM)color); } |
| 30 | #endif | 30 | #endif |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
diff --git a/CPP/Windows/Control/PropertyPage.cpp b/CPP/Windows/Control/PropertyPage.cpp index ce8696d..f8effe6 100644 --- a/CPP/Windows/Control/PropertyPage.cpp +++ b/CPP/Windows/Control/PropertyPage.cpp | |||
| @@ -16,7 +16,13 @@ extern bool g_IsNT; | |||
| 16 | namespace NWindows { | 16 | namespace NWindows { |
| 17 | namespace NControl { | 17 | namespace NControl { |
| 18 | 18 | ||
| 19 | static INT_PTR APIENTRY MyProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam) | 19 | static |
| 20 | #ifdef Z7_OLD_WIN_SDK | ||
| 21 | BOOL | ||
| 22 | #else | ||
| 23 | INT_PTR | ||
| 24 | #endif | ||
| 25 | APIENTRY MyProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam) | ||
| 20 | { | 26 | { |
| 21 | CWindow tempDialog(dialogHWND); | 27 | CWindow tempDialog(dialogHWND); |
| 22 | if (message == WM_INITDIALOG) | 28 | if (message == WM_INITDIALOG) |
| @@ -34,75 +40,91 @@ bool CPropertyPage::OnNotify(UINT /* controlID */, LPNMHDR lParam) | |||
| 34 | { | 40 | { |
| 35 | switch (lParam->code) | 41 | switch (lParam->code) |
| 36 | { | 42 | { |
| 37 | case PSN_APPLY: SetMsgResult(OnApply(LPPSHNOTIFY(lParam))); break; | 43 | case PSN_APPLY: SetMsgResult(OnApply2(LPPSHNOTIFY(lParam))); break; |
| 38 | case PSN_KILLACTIVE: SetMsgResult(BoolToBOOL(OnKillActive(LPPSHNOTIFY(lParam)))); break; | 44 | case PSN_KILLACTIVE: SetMsgResult(BoolToBOOL(OnKillActive2(LPPSHNOTIFY(lParam)))); break; |
| 39 | case PSN_SETACTIVE: SetMsgResult(OnSetActive(LPPSHNOTIFY(lParam))); break; | 45 | case PSN_SETACTIVE: SetMsgResult(OnSetActive2(LPPSHNOTIFY(lParam))); break; |
| 40 | case PSN_RESET: OnReset(LPPSHNOTIFY(lParam)); break; | 46 | case PSN_RESET: OnReset2(LPPSHNOTIFY(lParam)); break; |
| 41 | case PSN_HELP: OnNotifyHelp(LPPSHNOTIFY(lParam)); break; | 47 | case PSN_HELP: OnNotifyHelp2(LPPSHNOTIFY(lParam)); break; |
| 42 | default: return false; | 48 | default: return false; |
| 43 | } | 49 | } |
| 44 | return true; | 50 | return true; |
| 45 | } | 51 | } |
| 46 | 52 | ||
| 53 | /* | ||
| 54 | PROPSHEETPAGE fields depend from | ||
| 55 | #if (_WIN32_WINNT >= 0x0600) | ||
| 56 | #elif (_WIN32_WINNT >= 0x0501) | ||
| 57 | #elif (_WIN32_IE >= 0x0400) | ||
| 58 | PROPSHEETHEADER fields depend from | ||
| 59 | #if (_WIN32_IE >= 0x0400) | ||
| 60 | */ | ||
| 61 | #if defined(PROPSHEETPAGEA_V1_SIZE) && !defined(Z7_OLD_WIN_SDK) | ||
| 62 | #ifndef _UNICODE | ||
| 63 | #define my_compatib_PROPSHEETPAGEA PROPSHEETPAGEA_V1 | ||
| 64 | #endif | ||
| 65 | #define my_compatib_PROPSHEETPAGEW PROPSHEETPAGEW_V1 | ||
| 66 | #else | ||
| 67 | // for old mingw: | ||
| 68 | #ifndef _UNICODE | ||
| 69 | #define my_compatib_PROPSHEETPAGEA PROPSHEETPAGEA | ||
| 70 | #endif | ||
| 71 | #define my_compatib_PROPSHEETPAGEW PROPSHEETPAGEW | ||
| 72 | #endif | ||
| 73 | |||
| 47 | INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndParent, const UString &title) | 74 | INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndParent, const UString &title) |
| 48 | { | 75 | { |
| 49 | #ifndef _UNICODE | ||
| 50 | AStringVector titles; | ||
| 51 | #endif | ||
| 52 | #ifndef _UNICODE | ||
| 53 | CRecordVector<PROPSHEETPAGEA> pagesA; | ||
| 54 | #endif | ||
| 55 | CRecordVector<PROPSHEETPAGEW> pagesW; | ||
| 56 | |||
| 57 | unsigned i; | 76 | unsigned i; |
| 58 | #ifndef _UNICODE | 77 | #ifndef _UNICODE |
| 78 | AStringVector titles; | ||
| 59 | for (i = 0; i < pagesInfo.Size(); i++) | 79 | for (i = 0; i < pagesInfo.Size(); i++) |
| 60 | titles.Add(GetSystemString(pagesInfo[i].Title)); | 80 | titles.Add(GetSystemString(pagesInfo[i].Title)); |
| 81 | CRecordVector<my_compatib_PROPSHEETPAGEA> pagesA; | ||
| 61 | #endif | 82 | #endif |
| 83 | CRecordVector<my_compatib_PROPSHEETPAGEW> pagesW; | ||
| 62 | 84 | ||
| 63 | for (i = 0; i < pagesInfo.Size(); i++) | 85 | for (i = 0; i < pagesInfo.Size(); i++) |
| 64 | { | 86 | { |
| 65 | const CPageInfo &pageInfo = pagesInfo[i]; | 87 | const CPageInfo &pageInfo = pagesInfo[i]; |
| 66 | #ifndef _UNICODE | 88 | #ifndef _UNICODE |
| 67 | { | 89 | { |
| 68 | PROPSHEETPAGE page; | 90 | my_compatib_PROPSHEETPAGEA page; |
| 91 | memset(&page, 0, sizeof(page)); | ||
| 69 | page.dwSize = sizeof(page); | 92 | page.dwSize = sizeof(page); |
| 70 | page.dwFlags = PSP_HASHELP; | 93 | page.dwFlags = PSP_HASHELP; |
| 71 | page.hInstance = g_hInstance; | 94 | page.hInstance = g_hInstance; |
| 72 | page.pszTemplate = MAKEINTRESOURCE(pageInfo.ID); | 95 | page.pszTemplate = MAKEINTRESOURCEA(pageInfo.ID); |
| 73 | page.pszIcon = NULL; | 96 | // page.pszIcon = NULL; |
| 74 | page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; | 97 | page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; |
| 75 | 98 | ||
| 76 | if (titles[i].IsEmpty()) | 99 | if (!titles[i].IsEmpty()) |
| 77 | page.pszTitle = NULL; | ||
| 78 | else | ||
| 79 | { | 100 | { |
| 80 | page.dwFlags |= PSP_USETITLE; | ||
| 81 | page.pszTitle = titles[i]; | 101 | page.pszTitle = titles[i]; |
| 102 | page.dwFlags |= PSP_USETITLE; | ||
| 82 | } | 103 | } |
| 104 | // else page.pszTitle = NULL; | ||
| 83 | page.lParam = (LPARAM)pageInfo.Page; | 105 | page.lParam = (LPARAM)pageInfo.Page; |
| 84 | page.pfnCallback = NULL; | 106 | // page.pfnCallback = NULL; |
| 85 | pagesA.Add(page); | 107 | pagesA.Add(page); |
| 86 | } | 108 | } |
| 87 | #endif | 109 | #endif |
| 88 | { | 110 | { |
| 89 | PROPSHEETPAGEW page; | 111 | my_compatib_PROPSHEETPAGEW page; |
| 112 | memset(&page, 0, sizeof(page)); | ||
| 90 | page.dwSize = sizeof(page); | 113 | page.dwSize = sizeof(page); |
| 91 | page.dwFlags = PSP_HASHELP; | 114 | page.dwFlags = PSP_HASHELP; |
| 92 | page.hInstance = g_hInstance; | 115 | page.hInstance = g_hInstance; |
| 93 | page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID); | 116 | page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID); |
| 94 | page.pszIcon = NULL; | 117 | // page.pszIcon = NULL; |
| 95 | page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; | 118 | page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; |
| 96 | 119 | ||
| 97 | if (pageInfo.Title.IsEmpty()) | 120 | if (!pageInfo.Title.IsEmpty()) |
| 98 | page.pszTitle = NULL; | ||
| 99 | else | ||
| 100 | { | 121 | { |
| 101 | page.dwFlags |= PSP_USETITLE; | ||
| 102 | page.pszTitle = pageInfo.Title; | 122 | page.pszTitle = pageInfo.Title; |
| 123 | page.dwFlags |= PSP_USETITLE; | ||
| 103 | } | 124 | } |
| 125 | // else page.pszTitle = NULL; | ||
| 104 | page.lParam = (LPARAM)pageInfo.Page; | 126 | page.lParam = (LPARAM)pageInfo.Page; |
| 105 | page.pfnCallback = NULL; | 127 | // page.pfnCallback = NULL; |
| 106 | pagesW.Add(page); | 128 | pagesW.Add(page); |
| 107 | } | 129 | } |
| 108 | } | 130 | } |
| @@ -110,16 +132,16 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare | |||
| 110 | #ifndef _UNICODE | 132 | #ifndef _UNICODE |
| 111 | if (!g_IsNT) | 133 | if (!g_IsNT) |
| 112 | { | 134 | { |
| 113 | PROPSHEETHEADER sheet; | 135 | PROPSHEETHEADERA sheet; |
| 114 | sheet.dwSize = sizeof(sheet); | 136 | sheet.dwSize = sizeof(sheet); |
| 115 | sheet.dwFlags = PSH_PROPSHEETPAGE; | 137 | sheet.dwFlags = PSH_PROPSHEETPAGE; |
| 116 | sheet.hwndParent = hwndParent; | 138 | sheet.hwndParent = hwndParent; |
| 117 | sheet.hInstance = g_hInstance; | 139 | sheet.hInstance = g_hInstance; |
| 118 | AString titleA (GetSystemString(title)); | 140 | AString titleA (GetSystemString(title)); |
| 119 | sheet.pszCaption = titleA; | 141 | sheet.pszCaption = titleA; |
| 120 | sheet.nPages = pagesInfo.Size(); | 142 | sheet.nPages = pagesA.Size(); |
| 121 | sheet.nStartPage = 0; | 143 | sheet.nStartPage = 0; |
| 122 | sheet.ppsp = &pagesA.Front(); | 144 | sheet.ppsp = (LPCPROPSHEETPAGEA)(const void *)&pagesA.Front(); |
| 123 | sheet.pfnCallback = NULL; | 145 | sheet.pfnCallback = NULL; |
| 124 | return ::PropertySheetA(&sheet); | 146 | return ::PropertySheetA(&sheet); |
| 125 | } | 147 | } |
| @@ -132,9 +154,9 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare | |||
| 132 | sheet.hwndParent = hwndParent; | 154 | sheet.hwndParent = hwndParent; |
| 133 | sheet.hInstance = g_hInstance; | 155 | sheet.hInstance = g_hInstance; |
| 134 | sheet.pszCaption = title; | 156 | sheet.pszCaption = title; |
| 135 | sheet.nPages = pagesInfo.Size(); | 157 | sheet.nPages = pagesW.Size(); |
| 136 | sheet.nStartPage = 0; | 158 | sheet.nStartPage = 0; |
| 137 | sheet.ppsp = &pagesW.Front(); | 159 | sheet.ppsp = (LPCPROPSHEETPAGEW)(const void *)&pagesW.Front(); |
| 138 | sheet.pfnCallback = NULL; | 160 | sheet.pfnCallback = NULL; |
| 139 | return ::PropertySheetW(&sheet); | 161 | return ::PropertySheetW(&sheet); |
| 140 | } | 162 | } |
diff --git a/CPP/Windows/Control/PropertyPage.h b/CPP/Windows/Control/PropertyPage.h index b68fd8f..264a5d2 100644 --- a/CPP/Windows/Control/PropertyPage.h +++ b/CPP/Windows/Control/PropertyPage.h | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | // Windows/Control/PropertyPage.h | 1 | // Windows/Control/PropertyPage.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_PROPERTYPAGE_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_PROPERTYPAGE_H |
| 4 | #define __WINDOWS_CONTROL_PROPERTYPAGE_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_PROPERTYPAGE_H |
| 5 | 5 | ||
| 6 | #include "../../Common/MyWindows.h" | 6 | #include "../../Common/MyWindows.h" |
| 7 | 7 | ||
| 8 | #include <PrSht.h> | 8 | #include <prsht.h> |
| 9 | 9 | ||
| 10 | #include "Dialog.h" | 10 | #include "Dialog.h" |
| 11 | 11 | ||
| @@ -17,23 +17,23 @@ INT_PTR APIENTRY ProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wPar | |||
| 17 | class CPropertyPage: public CDialog | 17 | class CPropertyPage: public CDialog |
| 18 | { | 18 | { |
| 19 | public: | 19 | public: |
| 20 | CPropertyPage(HWND window = NULL): CDialog(window){}; | 20 | CPropertyPage(HWND window = NULL): CDialog(window) {} |
| 21 | 21 | ||
| 22 | void Changed() { PropSheet_Changed(GetParent(), (HWND)*this); } | 22 | void Changed() { PropSheet_Changed(GetParent(), (HWND)*this); } |
| 23 | void UnChanged() { PropSheet_UnChanged(GetParent(), (HWND)*this); } | 23 | void UnChanged() { PropSheet_UnChanged(GetParent(), (HWND)*this); } |
| 24 | 24 | ||
| 25 | virtual bool OnNotify(UINT controlID, LPNMHDR lParam); | 25 | virtual bool OnNotify(UINT controlID, LPNMHDR lParam) Z7_override; |
| 26 | 26 | ||
| 27 | virtual bool OnKillActive() { return false; } // false = OK | 27 | virtual bool OnKillActive() { return false; } // false = OK |
| 28 | virtual bool OnKillActive(const PSHNOTIFY *) { return OnKillActive(); } | 28 | virtual bool OnKillActive2(const PSHNOTIFY *) { return OnKillActive(); } |
| 29 | virtual LONG OnSetActive() { return false; } // false = OK | 29 | virtual LONG OnSetActive() { return false; } // false = OK |
| 30 | virtual LONG OnSetActive(const PSHNOTIFY *) { return OnSetActive(); } | 30 | virtual LONG OnSetActive2(const PSHNOTIFY *) { return OnSetActive(); } |
| 31 | virtual LONG OnApply() { return PSNRET_NOERROR; } | 31 | virtual LONG OnApply() { return PSNRET_NOERROR; } |
| 32 | virtual LONG OnApply(const PSHNOTIFY *) { return OnApply(); } | 32 | virtual LONG OnApply2(const PSHNOTIFY *) { return OnApply(); } |
| 33 | virtual void OnNotifyHelp() {} | 33 | virtual void OnNotifyHelp() {} |
| 34 | virtual void OnNotifyHelp(const PSHNOTIFY *) { OnNotifyHelp(); } | 34 | virtual void OnNotifyHelp2(const PSHNOTIFY *) { OnNotifyHelp(); } |
| 35 | virtual void OnReset() {} | 35 | virtual void OnReset() {} |
| 36 | virtual void OnReset(const PSHNOTIFY *) { OnReset(); } | 36 | virtual void OnReset2(const PSHNOTIFY *) { OnReset(); } |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | struct CPageInfo | 39 | struct CPageInfo |
diff --git a/CPP/Windows/Control/ReBar.h b/CPP/Windows/Control/ReBar.h index c2d58db..b56f018 100644 --- a/CPP/Windows/Control/ReBar.h +++ b/CPP/Windows/Control/ReBar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ReBar.h | 1 | // Windows/Control/ReBar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_REBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_REBAR_H |
| 4 | #define __WINDOWS_CONTROL_REBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_REBAR_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
| @@ -14,7 +14,7 @@ public: | |||
| 14 | bool SetBarInfo(LPREBARINFO barInfo) | 14 | bool SetBarInfo(LPREBARINFO barInfo) |
| 15 | { return LRESULTToBool(SendMsg(RB_SETBARINFO, 0, (LPARAM)barInfo)); } | 15 | { return LRESULTToBool(SendMsg(RB_SETBARINFO, 0, (LPARAM)barInfo)); } |
| 16 | bool InsertBand(int index, LPREBARBANDINFO bandInfo) | 16 | bool InsertBand(int index, LPREBARBANDINFO bandInfo) |
| 17 | { return LRESULTToBool(SendMsg(RB_INSERTBAND, index, (LPARAM)bandInfo)); } | 17 | { return LRESULTToBool(SendMsg(RB_INSERTBAND, MY_int_TO_WPARAM(index), (LPARAM)bandInfo)); } |
| 18 | bool SetBandInfo(unsigned index, LPREBARBANDINFO bandInfo) | 18 | bool SetBandInfo(unsigned index, LPREBARBANDINFO bandInfo) |
| 19 | { return LRESULTToBool(SendMsg(RB_SETBANDINFO, index, (LPARAM)bandInfo)); } | 19 | { return LRESULTToBool(SendMsg(RB_SETBANDINFO, index, (LPARAM)bandInfo)); } |
| 20 | void MaximizeBand(unsigned index, bool ideal) | 20 | void MaximizeBand(unsigned index, bool ideal) |
diff --git a/CPP/Windows/Control/Static.h b/CPP/Windows/Control/Static.h index 5523b2e..ceeedf9 100644 --- a/CPP/Windows/Control/Static.h +++ b/CPP/Windows/Control/Static.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/Static.h | 1 | // Windows/Control/Static.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_STATIC_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_STATIC_H |
| 4 | #define __WINDOWS_CONTROL_STATIC_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_STATIC_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
diff --git a/CPP/Windows/Control/StatusBar.h b/CPP/Windows/Control/StatusBar.h index 988b847..38aca47 100644 --- a/CPP/Windows/Control/StatusBar.h +++ b/CPP/Windows/Control/StatusBar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/StatusBar.h | 1 | // Windows/Control/StatusBar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_STATUSBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_STATUSBAR_H |
| 4 | #define __WINDOWS_CONTROL_STATUSBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_STATUSBAR_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
| @@ -12,7 +12,7 @@ class CStatusBar: public NWindows::CWindow | |||
| 12 | { | 12 | { |
| 13 | public: | 13 | public: |
| 14 | bool Create(LONG style, LPCTSTR text, HWND hwndParent, UINT id) | 14 | bool Create(LONG style, LPCTSTR text, HWND hwndParent, UINT id) |
| 15 | { return (_window = ::CreateStatusWindow(style, text, hwndParent, id)) != 0; } | 15 | { return (_window = ::CreateStatusWindow(style, text, hwndParent, id)) != NULL; } |
| 16 | bool SetText(LPCTSTR text) | 16 | bool SetText(LPCTSTR text) |
| 17 | { return CWindow::SetText(text); } | 17 | { return CWindow::SetText(text); } |
| 18 | bool SetText(unsigned index, LPCTSTR text, UINT type) | 18 | bool SetText(unsigned index, LPCTSTR text, UINT type) |
| @@ -22,7 +22,7 @@ public: | |||
| 22 | 22 | ||
| 23 | #ifndef _UNICODE | 23 | #ifndef _UNICODE |
| 24 | bool Create(LONG style, LPCWSTR text, HWND hwndParent, UINT id) | 24 | bool Create(LONG style, LPCWSTR text, HWND hwndParent, UINT id) |
| 25 | { return (_window = ::CreateStatusWindowW(style, text, hwndParent, id)) != 0; } | 25 | { return (_window = ::CreateStatusWindowW(style, text, hwndParent, id)) != NULL; } |
| 26 | bool SetText(LPCWSTR text) | 26 | bool SetText(LPCWSTR text) |
| 27 | { return CWindow::SetText(text); } | 27 | { return CWindow::SetText(text); } |
| 28 | bool SetText(unsigned index, LPCWSTR text, UINT type) | 28 | bool SetText(unsigned index, LPCWSTR text, UINT type) |
| @@ -34,7 +34,7 @@ public: | |||
| 34 | bool SetParts(unsigned numParts, const int *edgePostions) | 34 | bool SetParts(unsigned numParts, const int *edgePostions) |
| 35 | { return LRESULTToBool(SendMsg(SB_SETPARTS, numParts, (LPARAM)edgePostions)); } | 35 | { return LRESULTToBool(SendMsg(SB_SETPARTS, numParts, (LPARAM)edgePostions)); } |
| 36 | void Simple(bool simple) | 36 | void Simple(bool simple) |
| 37 | { SendMsg(SB_SIMPLE, BoolToBOOL(simple), 0); } | 37 | { SendMsg(SB_SIMPLE, (WPARAM)BoolToBOOL(simple), 0); } |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | }} | 40 | }} |
diff --git a/CPP/Windows/Control/StdAfx.h b/CPP/Windows/Control/StdAfx.h index 1cbd7fe..8086655 100644 --- a/CPP/Windows/Control/StdAfx.h +++ b/CPP/Windows/Control/StdAfx.h | |||
| @@ -1,8 +1,11 @@ | |||
| 1 | // StdAfx.h | 1 | // StdAfx.h |
| 2 | 2 | ||
| 3 | #ifndef __STDAFX_H | 3 | #ifndef ZIP7_INC_STDAFX_H |
| 4 | #define __STDAFX_H | 4 | #define ZIP7_INC_STDAFX_H |
| 5 | 5 | ||
| 6 | #if defined(_MSC_VER) && _MSC_VER >= 1800 | ||
| 7 | #pragma warning(disable : 4464) // relative include path contains '..' | ||
| 8 | #endif | ||
| 6 | #include "../../Common/Common.h" | 9 | #include "../../Common/Common.h" |
| 7 | 10 | ||
| 8 | #endif | 11 | #endif |
diff --git a/CPP/Windows/Control/ToolBar.h b/CPP/Windows/Control/ToolBar.h index 7bc93a2..2bf20a5 100644 --- a/CPP/Windows/Control/ToolBar.h +++ b/CPP/Windows/Control/ToolBar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/ToolBar.h | 1 | // Windows/Control/ToolBar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_TOOLBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_TOOLBAR_H |
| 4 | #define __WINDOWS_CONTROL_TOOLBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_TOOLBAR_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
| @@ -18,7 +18,7 @@ public: | |||
| 18 | #ifdef UNDER_CE | 18 | #ifdef UNDER_CE |
| 19 | { | 19 | { |
| 20 | // maybe it must be fixed for more than 1 buttons | 20 | // maybe it must be fixed for more than 1 buttons |
| 21 | DWORD val = GetButtonSize(); | 21 | const DWORD val = GetButtonSize(); |
| 22 | size->cx = LOWORD(val); | 22 | size->cx = LOWORD(val); |
| 23 | size->cy = HIWORD(val); | 23 | size->cy = HIWORD(val); |
| 24 | return true; | 24 | return true; |
diff --git a/CPP/Windows/Control/Trackbar.h b/CPP/Windows/Control/Trackbar.h index 313e0c8..18d1b29 100644 --- a/CPP/Windows/Control/Trackbar.h +++ b/CPP/Windows/Control/Trackbar.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/Trackbar.h | 1 | // Windows/Control/Trackbar.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_TRACKBAR_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_TRACKBAR_H |
| 4 | #define __WINDOWS_CONTROL_TRACKBAR_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_TRACKBAR_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
diff --git a/CPP/Windows/Control/Window2.cpp b/CPP/Windows/Control/Window2.cpp index 994d96e..8fe908e 100644 --- a/CPP/Windows/Control/Window2.cpp +++ b/CPP/Windows/Control/Window2.cpp | |||
| @@ -32,9 +32,9 @@ static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message, WPARAM wParam, | |||
| 32 | if (message == MY_START_WM_CREATE) | 32 | if (message == MY_START_WM_CREATE) |
| 33 | tempWindow.SetUserDataLongPtr((LONG_PTR)(((LPCREATESTRUCT)lParam)->lpCreateParams)); | 33 | tempWindow.SetUserDataLongPtr((LONG_PTR)(((LPCREATESTRUCT)lParam)->lpCreateParams)); |
| 34 | CWindow2 *window = (CWindow2 *)(tempWindow.GetUserDataLongPtr()); | 34 | CWindow2 *window = (CWindow2 *)(tempWindow.GetUserDataLongPtr()); |
| 35 | if (window != NULL && message == MY_START_WM_CREATE) | 35 | if (window && message == MY_START_WM_CREATE) |
| 36 | window->Attach(aHWND); | 36 | window->Attach(aHWND); |
| 37 | if (window == 0) | 37 | if (!window) |
| 38 | { | 38 | { |
| 39 | #ifndef _UNICODE | 39 | #ifndef _UNICODE |
| 40 | if (g_IsNT) | 40 | if (g_IsNT) |
| @@ -140,7 +140,7 @@ LRESULT CWindow2::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) | |||
| 140 | return -1; | 140 | return -1; |
| 141 | break; | 141 | break; |
| 142 | case WM_COMMAND: | 142 | case WM_COMMAND: |
| 143 | if (OnCommand(wParam, lParam, result)) | 143 | if (OnCommand(HIWORD(wParam), LOWORD(wParam), lParam, result)) |
| 144 | return result; | 144 | return result; |
| 145 | break; | 145 | break; |
| 146 | case WM_NOTIFY: | 146 | case WM_NOTIFY: |
| @@ -160,12 +160,14 @@ LRESULT CWindow2::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) | |||
| 160 | return DefProc(message, wParam, lParam); | 160 | return DefProc(message, wParam, lParam); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | bool CWindow2::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result) | 163 | /* |
| 164 | bool CWindow2::OnCommand2(WPARAM wParam, LPARAM lParam, LRESULT &result) | ||
| 164 | { | 165 | { |
| 165 | return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam, result); | 166 | return OnCommand(HIWORD(wParam), LOWORD(wParam), lParam, result); |
| 166 | } | 167 | } |
| 168 | */ | ||
| 167 | 169 | ||
| 168 | bool CWindow2::OnCommand(int /* code */, int /* itemID */, LPARAM /* lParam */, LRESULT & /* result */) | 170 | bool CWindow2::OnCommand(unsigned /* code */, unsigned /* itemID */, LPARAM /* lParam */, LRESULT & /* result */) |
| 169 | { | 171 | { |
| 170 | return false; | 172 | return false; |
| 171 | // return DefProc(message, wParam, lParam); | 173 | // return DefProc(message, wParam, lParam); |
| @@ -176,7 +178,7 @@ bool CWindow2::OnCommand(int /* code */, int /* itemID */, LPARAM /* lParam */, | |||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | /* | 180 | /* |
| 179 | bool CDialog::OnButtonClicked(int buttonID, HWND buttonHWND) | 181 | bool CDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND) |
| 180 | { | 182 | { |
| 181 | switch (buttonID) | 183 | switch (buttonID) |
| 182 | { | 184 | { |
diff --git a/CPP/Windows/Control/Window2.h b/CPP/Windows/Control/Window2.h index 7ac580c..ebb5979 100644 --- a/CPP/Windows/Control/Window2.h +++ b/CPP/Windows/Control/Window2.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | // Windows/Control/Window2.h | 1 | // Windows/Control/Window2.h |
| 2 | 2 | ||
| 3 | #ifndef __WINDOWS_CONTROL_WINDOW2_H | 3 | #ifndef ZIP7_INC_WINDOWS_CONTROL_WINDOW2_H |
| 4 | #define __WINDOWS_CONTROL_WINDOW2_H | 4 | #define ZIP7_INC_WINDOWS_CONTROL_WINDOW2_H |
| 5 | 5 | ||
| 6 | #include "../Window.h" | 6 | #include "../Window.h" |
| 7 | 7 | ||
| @@ -10,10 +10,12 @@ namespace NControl { | |||
| 10 | 10 | ||
| 11 | class CWindow2: public CWindow | 11 | class CWindow2: public CWindow |
| 12 | { | 12 | { |
| 13 | // Z7_CLASS_NO_COPY(CWindow2) | ||
| 14 | |||
| 13 | LRESULT DefProc(UINT message, WPARAM wParam, LPARAM lParam); | 15 | LRESULT DefProc(UINT message, WPARAM wParam, LPARAM lParam); |
| 14 | public: | 16 | public: |
| 15 | CWindow2(HWND newWindow = NULL): CWindow(newWindow){}; | 17 | CWindow2(HWND newWindow = NULL): CWindow(newWindow) {} |
| 16 | virtual ~CWindow2() {}; | 18 | virtual ~CWindow2() {} |
| 17 | 19 | ||
| 18 | bool CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName, | 20 | bool CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName, |
| 19 | DWORD style, int x, int y, int width, int height, | 21 | DWORD style, int x, int y, int width, int height, |
| @@ -28,8 +30,8 @@ public: | |||
| 28 | virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); | 30 | virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); |
| 29 | virtual bool OnCreate(CREATESTRUCT * /* createStruct */) { return true; } | 31 | virtual bool OnCreate(CREATESTRUCT * /* createStruct */) { return true; } |
| 30 | // virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam); | 32 | // virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam); |
| 31 | virtual bool OnCommand(WPARAM wParam, LPARAM lParam, LRESULT &result); | 33 | // bool OnCommand2(WPARAM wParam, LPARAM lParam, LRESULT &result); |
| 32 | virtual bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result); | 34 | virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam, LRESULT &result); |
| 33 | virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; } | 35 | virtual bool OnSize(WPARAM /* wParam */, int /* xSize */, int /* ySize */) { return false; } |
| 34 | virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */, LRESULT & /* result */) { return false; } | 36 | virtual bool OnNotify(UINT /* controlID */, LPNMHDR /* lParam */, LRESULT & /* result */) { return false; } |
| 35 | virtual void OnDestroy() { PostQuitMessage(0); } | 37 | virtual void OnDestroy() { PostQuitMessage(0); } |
| @@ -37,7 +39,7 @@ public: | |||
| 37 | /* | 39 | /* |
| 38 | virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); } | 40 | virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); } |
| 39 | virtual LRESULT OnHelp() {}; | 41 | virtual LRESULT OnHelp() {}; |
| 40 | virtual bool OnButtonClicked(int buttonID, HWND buttonHWND); | 42 | virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND); |
| 41 | virtual void OnOK() {}; | 43 | virtual void OnOK() {}; |
| 42 | virtual void OnCancel() {}; | 44 | virtual void OnCancel() {}; |
| 43 | */ | 45 | */ |
