forked from maximmenshikov/common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageManager.hpp
More file actions
257 lines (217 loc) · 7.84 KB
/
Copy pathPageManager.hpp
File metadata and controls
257 lines (217 loc) · 7.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#pragma once
/* Types */
typedef HANDLE SHELL_PAGEMANAGER;
typedef HANDLE SHELL_PAGEMANAGER_CALLBACK;
typedef HANDLE SHELL_PAGE_CALLBACK;
typedef HANDLE SHELL_PAGE;
typedef HANDLE SHELL_SYSTEM_TRAY;
typedef HANDLE SHELL_APPLICATION_BAR;
typedef DWORD TASKID;
/* Enumerations */
namespace Shl
{
namespace Direction
{
typedef enum
{
Forward,
Back,
Invalid,
}Direction;
};
namespace Directions
{
typedef enum
{
Forward = 1,
Back = 2,
ForwardAndBack = Forward | Back
}Directions;
};
namespace NavigationType
{
typedef enum
{
To,
Away
}NavigationType;
};
namespace NavigationTypes
{
typedef enum
{
To = 1,
Away = 2,
ToAndAway = 3
}NavigationTypes;
};
namespace AnimationType
{
enum AnimationType
{
None,
Default,
};
};
namespace CallbackThreading
{
enum CallbackThreading
{
SameThread = 0,
AnyThread = 1,
};
};
namespace Obscurity
{
enum Obscurity
{
Obscured,
PartiallyObscured,
NotObscured,
};
};
namespace Orientation
{
enum Orientation
{
Angle0 = 1,
Angle90 = 2,
Angle180 = 4 ,
Angle270 = 8,
};
}
namespace KeyboardPosition
{
enum KeyboardPosition
{
Closed,
Open,
};
}
namespace AnimationIds
{
enum AnimationId
{
Invalid = 0,
HideStart = 1,
ShowStart = 2,
First = 3
};
}
}
using namespace Shl;
typedef void (*OnNavigateTo)(SHELL_PAGE hPage, Direction::Direction direction, SHELL_PAGE hPagePrevious);
typedef void (*OnNavigateAway)(SHELL_PAGE hPage, Direction::Direction direction, SHELL_PAGE hPageNext);
typedef void (*OnRemove)(SHELL_PAGE hPage);
typedef void (*OnVisibleRegionChange)(SHELL_PAGE hPage, RECT rcVisibleRegion, DWORD dwDuration);
typedef void (*OnSipDeployChange)(SHELL_PAGE hPage, bool deployed);
typedef BOOL (*OnBackRequest)(SHELL_PAGE hPage);
typedef void (*OnUiOrientationChange)(Orientation::Orientation orientation, bool animate);
typedef void (*OnObscurityChange)(bool obscured);
typedef void (*OnLockStateChange)(bool locked);
typedef void (*OnShowRequest)(Direction::Direction direction, AnimationIds::AnimationId idAnimation, AnimationType::AnimationType animationType);
typedef void (*OnHideRequest)(Direction::Direction direction, AnimationIds::AnimationId idAnimation, SHELL_PAGE hPageNext);
typedef struct
{
OnNavigateTo onNavigateTo;
OnNavigateAway onNavigateAway;
OnRemove onRemove;
OnVisibleRegionChange onVisibleRegionChange;
OnSipDeployChange onSipDeployChange;
OnBackRequest onBackRequest;
OnUiOrientationChange onUiOrientationChange;
OnObscurityChange onObscurityChange;
OnLockStateChange onLockStateChange;
OnShowRequest onShowRequest;
OnHideRequest onHideRequest;
}PageCallbacks;
typedef void (*OnInvokeReturning)(SHELL_PAGEMANAGER_CALLBACK hPMC, TASKID qwTaskId, DWORD cbData);
typedef void (*OnCancelRequested)(SHELL_PAGEMANAGER_CALLBACK hPM);
typedef void (*OnPageStackReactivated)(SHELL_PAGEMANAGER_CALLBACK hPMC, DWORD cbParameters);
typedef void (*OnMemoryNotification)(SHELL_PAGEMANAGER_CALLBACK hPM);
typedef void (*OnResumePageRequest)(SHELL_PAGEMANAGER_CALLBACK hPM, SHELL_PAGE pPage);
typedef struct
{
OnInvokeReturning onInvokeReturning;
OnCancelRequested onCancelRequested;
OnPageStackReactivated onPageStackReactivated;
OnMemoryNotification onMemoryNotification;
OnResumePageRequest onResumePageRequest;
}PageManagerCallbacks;
extern "C"
{
// Page Manager-related Frame functions.
HRESULT SHPMCreatePageManager(TASKID dwTaskId, SHELL_PAGEMANAGER* phPageManager);
HRESULT SHPMCreatePageManagerEx(TASKID dwTaskId,
PageManagerCallbacks* pCallback,
SHELL_PAGEMANAGER* phPageManager,
SHELL_PAGEMANAGER_CALLBACK* phPageManagerCallback);
HRESULT SHPMCreatePage(SHELL_PAGEMANAGER hPageManager, PageCallbacks *pCallback, CallbackThreading::CallbackThreading callbackThreading, HWND hWnd, LPCWSTR pszName, SHELL_PAGE *phPage,
SHELL_PAGE_CALLBACK *phPageCallback);
HRESULT SHPMReleasePageManager(SHELL_PAGEMANAGER hPageManager);
HRESULT SHPMNavigateBack(SHELL_PAGEMANAGER hPageManager);
HRESULT SHPMNavigateBackToTargetPage(SHELL_PAGEMANAGER hPageManager, SHELL_PAGE hPage);
HRESULT SHPMNavigateTo(SHELL_PAGEMANAGER hPageManager, SHELL_PAGE hPage);
HRESULT SHPMNavigateToExternalPage(SHELL_PAGEMANAGER hPageManager, LPCWSTR pszPageUri,
BOOL fIsInvocation, BYTE* pPageArgs, DWORD cbPageArgs);
HRESULT SHPMRemovePage(SHELL_PAGEMANAGER hPageManager, SHELL_PAGE hPage);
HRESULT SHPMResumePage(SHELL_PAGEMANAGER hPageManager, PageCallbacks *pCallbacks, CallbackThreading::CallbackThreading callbackThreading,
HWND hWnd, SHELL_PAGE hPage, SHELL_PAGE_CALLBACK *phPageCallback);
HRESULT SHPMSetPropertyBlob(SHELL_PAGEMANAGER hPageManager, PCWSTR pszPropertyName, const BYTE* pbData, size_t cbData);
HRESULT SHPMGetPropertyBlob(SHELL_PAGEMANAGER hPageManager, PCWSTR pszPropertyName, LPBYTE pbData, size_t cbData, size_t* pcbActual);
HRESULT SHPMSetPauseSupported(SHELL_PAGEMANAGER hPageManager, BOOL pauseSupported);
HRESULT SHPMSetPauseOnLock(SHELL_PAGEMANAGER hPageManager, BOOL pauseOnLock);
HRESULT SHPMGetPauseSupported(SHELL_PAGEMANAGER hPageManager, BOOL * pauseSupported);
HRESULT SHPMSetTerminateOnCancel(TASKID dwTaskId, BOOL terminateOnCancel);
HRESULT SHPMGetTerminateOnCancel(TASKID dwTaskId, BOOL* terminateOnCancel);
HRESULT SHPMSetProgressIndicatorIsVisible(SHELL_PAGEMANAGER hPageManager, BOOL isVisible);
HRESULT SHPMSetProgressIndicatorIsIndeterminate(SHELL_PAGEMANAGER hPageManager, BOOL isIndeterminate);
HRESULT SHPMSetProgressIndicatorText(SHELL_PAGEMANAGER hPageManager, LPCWSTR pszText);
HRESULT SHPMSetProgressIndicatorValue(SHELL_PAGEMANAGER hPageManager, float value);
HRESULT SHPMSetOrientationQuery(SHELL_PAGEMANAGER hPageManager, BOOL fQuery);
// Page-related Frame functions.
HRESULT SHReleasePage(SHELL_PAGE hPage);
HRESULT SHGetApplicationBar(SHELL_PAGE hPage, SHELL_APPLICATION_BAR* phAppbar) ;
HRESULT SHSetApplicationBar(SHELL_PAGE hPage, SHELL_APPLICATION_BAR hAppbar);
HRESULT SHSetPropertyBlob(SHELL_PAGE hPage, PCWSTR pszPropertyName, const BYTE* pbData, size_t cbData);
HRESULT SHSetPropertyDword(SHELL_PAGE hPage, PCWSTR pszPropertyName, DWORD dwPropertyValue);
HRESULT SHSetPropertyString(SHELL_PAGE hPage, PCWSTR pszPropertyName, PCWSTR pszPropertyValue);
HRESULT SHGetPropertyBlob(SHELL_PAGE hPage, PCWSTR pszPropertyName, LPBYTE pbData, size_t cbData, size_t* pcbActual);
HRESULT SHGetPropertyDword(SHELL_PAGE hPage, PCWSTR pszPropertyName, DWORD* pdwPropertyValue);
HRESULT SHGetPropertyString(SHELL_PAGE hPage, PCWSTR pszPropertyName, PWSTR pszPropertyValue, size_t cchPropertyValue);
HRESULT SHGetPreviousPage(SHELL_PAGE hPage, SHELL_PAGE* phPage, bool allowDehydrated, LPWSTR pszPageName, UINT cchPageName);
HRESULT SHGetNextPage(SHELL_PAGE hPage, SHELL_PAGE* phPage);
HRESULT SHSetSupportedOrientations(SHELL_PAGE hPage, DWORD orientation);
HRESULT SHGetPageOrientation(SHELL_PAGE hPage, DWORD& po);
HRESULT SHGetVisibleRegion(SHELL_PAGE hPage, RECT &rcVisibleRegion);
HRESULT SHSetSystemTrayVisible(SHELL_PAGE hPage, BOOL visible);
HRESULT SHSetOverrideAnimation(SHELL_PAGE hPage, NavigationTypes::NavigationTypes types, Directions::Directions directions, BOOL override);
HRESULT SHShowDone(SHELL_PAGE hPage, AnimationIds::AnimationId idAnimation);
HRESULT SHHideDone(SHELL_PAGE hPage, AnimationIds::AnimationId idAnimation);
}
namespace Shl
{
class Frame
{
public:
static HRESULT Initialize(void);
static HRESULT Uninitialize(void);
static HRESULT VerifyInitialized(void);
};
};
class CFrameInitializer
{
public:
CFrameInitializer()
{
if (Shl::Frame::VerifyInitialized() != S_OK)
Shl::Frame::Initialize();
}
~CFrameInitializer()
{
if (Shl::Frame::VerifyInitialized() == S_OK)
Shl::Frame::Uninitialize();
}
};
/* We don't want to make user worry about initialization */
static CFrameInitializer _FrameInitializer;