ReactOS 0.4.15-dev-7924-g5949c20
CEditCompatModes.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Compatibility Layer Shell Extension
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: CEditCompatModes implementation
5 * COPYRIGHT: Copyright 2015-2019 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9#include <windowsx.h>
10
11
12class CEditCompatModes : public CDialogImpl<CEditCompatModes>
13{
14private:
18
19 CStringW GetListText(HWND ListBox, int Cur)
20 {
22 int Length = ListBox_GetTextLen(ListBox, Cur);
23 LPWSTR Buffer = Str.GetBuffer(Length + 1);
24 ListBox_GetText(ListBox, Cur, Buffer);
25 Str.ReleaseBuffer(Length);
26 return Str;
27 }
28
29public:
31 : m_pPage(page)
32 {
33 m_pPage->AddRef();
34 }
35
37 {
39 }
40
42 {
44
47
49
50 while (TRUE)
51 {
53 HRESULT hr = pList.Next(1, &str, NULL);
54 if (hr != S_OK)
55 break;
57 }
58
59 for (int n = 0; n < m_pPage->m_CustomLayers.GetSize(); ++n)
60 {
61 const WCHAR* Str = m_pPage->m_CustomLayers[n].GetString();
63 if (Index == LB_ERR)
65 }
66
67 OnListboxUpdated(0, 0, 0, bHandled);
68 return 0;
69 }
70
71 LRESULT OnButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
72 {
73 if (wID == IDOK)
74 {
76 m_pPage->m_CustomLayers.RemoveAll();
77 for (int Cur = 0; Cur < Count; ++Cur)
78 {
81 }
82 }
83 EndDialog(wID);
84 return 0;
85 }
86
87 LRESULT OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
88 {
91
93 if (Index == LB_ERR)
95
97 return 0;
98 }
99
100 LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
101 {
104
107 if (Index != LB_ERR)
109 OnListboxUpdated(wNotifyCode, wID, hWndCtl, bHandled);
110 return 0;
111 }
112
113 LRESULT OnRemoveAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
114 {
116 OnListboxUpdated(wNotifyCode, wID, hWndCtl, bHandled);
117 return 0;
118 }
119
120 LRESULT OnListboxUpdated(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
121 {
122 if (m_hListAdd == hWndCtl)
124 else if (m_hListActive == hWndCtl)
126
130 bHandled = TRUE;
131 return 0;
132 }
133
134public:
136
142
148};
149
150
152{
153 CEditCompatModes modes(page);
154 INT_PTR Result = modes.DoModal(hWnd);
155 return Result == IDOK;
156}
157
158
BOOL ShowEditCompatModes(HWND hWnd, CLayerUIPropPage *page)
HWND hWnd
Definition: settings.c:17
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:48
BOOL EndDialog(_In_ int nRetCode)
Definition: atlwin.h:1519
INT_PTR DoModal(HWND hWndParent=::GetActiveWindow(), LPARAM dwInitParam=0)
Definition: atlwin.h:1504
HWND SetFocus()
Definition: atlwin.h:1198
CWindow GetParent() const
Definition: atlwin.h:700
Definition: bufpool.h:45
CLayerUIPropPage * m_pPage
CStringW GetListText(HWND ListBox, int Cur)
CEditCompatModes(CLayerUIPropPage *page)
LRESULT OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT OnRemoveAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT OnListboxUpdated(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT OnButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
CSimpleArray< CString > m_CustomLayers
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define IDC_COMPATIBILITYMODE
Definition: resource.h:8
#define IDC_REMOVEALL
Definition: resource.h:17
#define IDC_ADD
Definition: resource.h:16
#define IDD_EDITCOMPATIBILITYMODES
Definition: resource.h:4
#define IDC_REMOVE
Definition: resource.h:18
#define IDC_NEWCOMPATIBILITYMODE
Definition: resource.h:15
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
FxChildList * pList
GLdouble n
Definition: glext.h:7729
ULONG AddRef()
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define COMMAND_ID_HANDLER(id, func)
Definition: atlwin.h:1953
#define END_MSG_MAP()
Definition: atlwin.h:1917
unsigned int UINT
Definition: ndis.h:50
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
const WCHAR * str
HRESULT hr
Definition: shlfolder.c:183
Definition: module.h:576
int32_t INT_PTR
Definition: typedefs.h:64
_In_ WDFCOLLECTION _In_ ULONG Index
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:478
#define ListBox_GetTextLen(hwndCtl, index)
Definition: windowsx.h:490
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:481
#define ListBox_GetText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:489
#define ListBox_DeleteString(hwndCtl, index)
Definition: windowsx.h:473
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:500
#define ListBox_ResetContent(hwndCtl)
Definition: windowsx.h:494
#define ListBox_GetCount(hwndCtl)
Definition: windowsx.h:480
#define ListBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:472
#define LB_ERR
Definition: winuser.h:2432
#define IDCANCEL
Definition: winuser.h:831
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184