MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / WndProc

Method WndProc

DSView/pv/winnativewidget.cpp:155–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155LRESULT CALLBACK WinNativeWidget::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
156{
157 static bool bMoving = false;
158
159 WinNativeWidget *self = reinterpret_cast<WinNativeWidget*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
160
161 if (self == NULL){
162 return DefWindowProc(hWnd, message, wParam, lParam);
163 }
164
165 switch (message)
166 {
167 case WM_SYSCOMMAND:
168 {
169 if (wParam == SC_KEYMENU)
170 {
171 RECT rc;
172 GetWindowRect(hWnd, &rc);
173 TrackPopupMenu(GetSystemMenu(hWnd, false), TPM_TOPALIGN | TPM_LEFTALIGN,
174 rc.left + 5, rc.top + 5, 0, hWnd, NULL);
175 }
176 break;
177 }
178 case WM_KEYDOWN:
179 {
180 //enable the hot key.
181 QKeyEvent keyEvent(QEvent::KeyPress, (int)wParam, 0);
182 QApplication::sendEvent(self->_childWidget->GetBodyView(), &keyEvent);
183 break;
184 }
185 case WM_KEYUP:
186 {
187 QKeyEvent keyEvent(QEvent::KeyRelease, (int)wParam, 0);
188 QApplication::sendEvent(self->_childWidget->GetBodyView(), &keyEvent);
189 break;
190 }
191 case WM_ENTERSIZEMOVE:
192 {
193 bMoving = true;
194 break;
195 }
196 case WM_EXITSIZEMOVE:
197 {
198 bMoving = false;
199 break;
200 }
201 case WM_NCCALCSIZE:
202 {
203 if (!wParam || self->IsMaxsized()){
204 return 0;
205 }
206 if (!self->_is_native_border){
207 return 0;
208 }
209
210 int k = self->GetDevicePixelRatio();
211 NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
212 RECT* rect = &params->rgrc[0];

Callers

nothing calls this directly

Calls 10

IsMaxsizedMethod · 0.95
GetDevicePixelRatioMethod · 0.95
ResizeChildMethod · 0.95
IsNormalsizedMethod · 0.95
setShadowStatusMethod · 0.95
getMonitorWorkAreaMethod · 0.95
hitTestMethod · 0.95
closeMethod · 0.80
OnParentNativeEventMethod · 0.80
GetBodyViewMethod · 0.45

Tested by

no test coverage detected