MCPcopy Create free account
hub / github.com/Geant4/geant4 / WindowProc

Method WindowProc

source/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc:211–354  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

209
210//////////////////////////////////////////////////////////////////////////////
211LRESULT CALLBACK G4OpenGLWin32Viewer::WindowProc(
212 HWND aWindow
213,UINT aMessage
214,WPARAM aWParam
215,LPARAM aLParam
216)
217//////////////////////////////////////////////////////////////////////////////
218//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
219{
220 switch (aMessage) {
221 case WM_SIZE: {
222 //FIXME : have to handle WM_RESIZE
223 // Seems to be done (ovidio.pena AT upm.es, 2021/02/23)
224 auto* This = (G4OpenGLWin32Viewer*)
225 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
226 if (This) {
227 This->fWinSize_x = (G4int) LOWORD(aLParam);
228 This->fWinSize_y = (G4int) HIWORD(aLParam);
229 if (!This->fInCreateWindow) {
230 This->SetView();
231 glViewport(0, 0, This->fWinSize_x, This->fWinSize_y);
232 This->DrawView();
233 }
234 }
235 return 0;
236 }
237
238 case WM_PAINT: {
239 PAINTSTRUCT ps;
240 BeginPaint(aWindow, &ps);
241 auto* This = (G4OpenGLWin32Viewer*)
242 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
243 if (This) {
244 //FIXME : To have an automatic refresh someone have to redraw here.
245 // Seems to be done (ovidio.pena AT upm.es, 2021/02/23)
246 if(!This->fInCreateWindow) {
247 This->SetView();
248 This->ClearView();
249 This->DrawView();
250 }
251 }
252 EndPaint(aWindow, &ps);
253 return 0;
254 }
255
256 case WM_LBUTTONDOWN: {
257 auto* This = (G4OpenGLWin32Viewer*)
258 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
259 This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
260 return 0;
261 }
262
263 case WM_RBUTTONDOWN: {
264 auto* This = (G4OpenGLWin32Viewer*)
265 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
266 This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
267 return 0;
268 }

Callers

nothing calls this directly

Calls 8

TrackMouseMethod · 0.80
ReleaseMouseMethod · 0.80
SetShiftMethod · 0.80
SetZoomMethod · 0.80
SetViewMethod · 0.45
DrawViewMethod · 0.45
ClearViewMethod · 0.45
SetRotationMethod · 0.45

Tested by

no test coverage detected