Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4UIWin32.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Original author: G.Barrand, 1998
27// Rewrite: O.Pena-Rodriguez, March 2021
28// --------------------------------------------------------------------
29
30#include "G4UIWin32.hh"
31
32#include <cstring>
33#include <utility>
34
35#include <windows.h>
36#include <commctrl.h>
37#include <wingdi.h>
38
39#include "G4UImanager.hh"
40#include "G4UIcommand.hh"
41#include "G4StateManager.hh"
42#include "G4UIcommandTree.hh"
44#include "G4Win32.hh"
45
46
47/***************************************************************************/
48static char mainClassName[] = "G4UIWin32";
49static G4bool exitSession = true;
50static G4bool exitPause = true;
51static G4bool exitHelp = true;
52static G4UIsession* tmpSession = nullptr;
53
54// Original wndproc for the Combo Editor
55static WNDPROC origComboEditorWindowProc;
56
57static G4bool ConvertStringToInt(const char*, G4int&);
58
59static G4int actionIdentifier = 0;
60
61
62/****************************************************************************************************/
63/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
65 : fHWndMainWindow(nullptr), fHWndEditor(nullptr),
66 fHWndToolBar(nullptr), fHWndComboBox(nullptr),
67 fHWndComboEditor(nullptr), fHWndHelpTree(nullptr),
68 fHWndStatus(nullptr), menuBar(nullptr),
69 fHelp(false), fHelpChoice(0), fHistoryPos(-1) {
70
72 if (UI != nullptr) {
73 UI->SetSession(this);
74 UI->SetG4UIWindow(this);
75 }
76
77 // Ensure that the common control DLL is loaded
78 INITCOMMONCONTROLSEX commCtrls;
79 commCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
80 commCtrls.dwICC = ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES;
81 // this loads list-view and toolbar classes.
82 InitCommonControlsEx(&commCtrls);
83
84 interactorManager = G4Win32::getInstance();
85
86 static G4bool Done = false;
87 if (!Done) {
88 WNDCLASS wc;
89 wc.style = 0;
90 wc.lpfnWndProc = (WNDPROC) G4UIWin32::MainWindowProc;
91 wc.cbClsExtra = 0;
92 wc.cbWndExtra = 0;
93 wc.hInstance = ::GetModuleHandle(nullptr);
94 wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
95 wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
96 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
97 wc.lpszMenuName = mainClassName;
98 wc.lpszClassName = mainClassName;
99
100 if (!RegisterClass(&wc)) {
101 MessageBox(nullptr, "G4UIWin32: Win32 window registration failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
102 G4cout << "G4UIWin32: Win32 window registration failed!" << G4endl;
103 return;
104 }
105
106 Done = true;
107 }
108
109 menuBar = CreateMenu();
110
111 // Add some initial options to the menu
112 HMENU hMenu = CreatePopupMenu();
113 AppendMenu(menuBar, MF_POPUP, (UINT_PTR) hMenu, "&Geant4");
114 AddInteractor("Geant4", (G4Interactor) hMenu);
115
116 AppendMenu(hMenu, MF_STRING, ID_OPEN_MACRO, "&Open macro...");
117 AppendMenu(hMenu, MF_STRING, ID_SAVE_VIEWER_STATE, "&Save viewer state...");
118 AppendMenu(hMenu, MF_SEPARATOR, -1, "");
119 AppendMenu(hMenu, MF_STRING, ID_RUN_BEAMON, "&Beam On");
120 AppendMenu(hMenu, MF_SEPARATOR, -1, "");
121 AppendMenu(hMenu, MF_STRING, ID_EXIT_APP, "E&xit");
122
123 hMenu = CreatePopupMenu();
124 AppendMenu(menuBar, MF_POPUP, (UINT_PTR) hMenu, "&View");
125 AddInteractor("View", (G4Interactor) hMenu);
126
127 AppendMenu(hMenu, MF_STRING, ID_VIEW_SOLID, "S&olid");
128 AppendMenu(hMenu, MF_STRING, ID_VIEW_WIREFRAME, "&Wireframe");
129 AppendMenu(hMenu, MF_SEPARATOR, -1, "");
130 AppendMenu(hMenu, MF_STRING, ID_PROJ_ORTHOGRAPHIC, "&Orthographic");
131 AppendMenu(hMenu, MF_STRING, ID_PROJ_PERSPECTIVE, "P&erspective");
132 AppendMenu(hMenu, MF_SEPARATOR, -1, "");
133 AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_XY, "&X-Y Plane");
134 AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_XZ, "X-&Z Plane");
135 AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_YZ, "&Y-Z Plane");
136 AppendMenu(hMenu, MF_STRING, ID_ORIENTATION_OBLIQUE, "&Oblique");
137
138 hMenu = CreatePopupMenu();
139 AppendMenu(menuBar, MF_POPUP, (UINT_PTR) hMenu, "&Zoom");
140 AddInteractor("Zoom", (G4Interactor) hMenu);
141
142 AppendMenu(hMenu, MF_STRING, ID_ZOOM_IN, "Zoom &In");
143 AppendMenu(hMenu, MF_STRING, ID_ZOOM_OUT, "Zoom &Out");
144
145 tmpSession = this;
146 fHWndMainWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE, mainClassName, "Geant4",
147 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
148 CW_USEDEFAULT, CW_USEDEFAULT,
149 CW_USEDEFAULT, CW_USEDEFAULT,
150 nullptr, menuBar,
151 ::GetModuleHandle(nullptr), nullptr);
152
153 if (fHWndMainWindow == nullptr) {
154 MessageBox(nullptr, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
155 return;
156 }
157 tmpSession = nullptr;
158 ::SetWindowLongPtr(fHWndMainWindow, GWLP_USERDATA, (LONG_PTR) this);
159
160 ::SetForegroundWindow(fHWndMainWindow);
161 ::ShowWindow(fHWndMainWindow, SW_SHOWDEFAULT);
162 ::UpdateWindow(fHWndMainWindow);
163
164 if (UI != nullptr) UI->SetCoutDestination(this);
165
166// TODO: Manage multithreaded output
167//#ifdef G4MULTITHREADED
168 // explicitly request that cout/cerr messages from threads are ALSO propagated to the master.
169 //masterG4coutDestination = this;
170//#endif
171}
172/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
173/****************************************************************************************************/
174
175/****************************************************************************************************/
176/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
179 if (UI != nullptr) {
180 UI->SetSession(nullptr);
181 UI->SetG4UIWindow(nullptr);
182 UI->SetCoutDestination(nullptr);
183 }
184
185// TODO: Manage multithreaded output
186//#ifdef G4MULTITHREADED
187 //masterG4coutDestination = 0; // set to cout when UI is deleted
188//#endif
189
190 if (fHWndStatus != nullptr) ::SetWindowLongPtr(fHWndStatus, GWLP_USERDATA, LONG(NULL));
191 if (fHWndHelpTree != nullptr) ::SetWindowLongPtr(fHWndHelpTree, GWLP_USERDATA, LONG(NULL));
192 if (fHWndComboBox != nullptr) ::SetWindowLongPtr(fHWndComboBox, GWLP_USERDATA, LONG(NULL));
193 if (fHWndToolBar != nullptr) ::SetWindowLongPtr(fHWndToolBar, GWLP_USERDATA, LONG(NULL));
194 if (fHWndEditor != nullptr) ::SetWindowLongPtr(fHWndEditor, GWLP_USERDATA, LONG(NULL));
195 if (fHWndMainWindow != nullptr) {
196 ::SetWindowLongPtr(fHWndMainWindow, GWLP_USERDATA, LONG(NULL));
197 ::DestroyWindow(fHWndMainWindow);
198 }
199}
200/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
201/****************************************************************************************************/
202
203/****************************************************************************************************/
204/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
206 if (interactorManager != nullptr) {
207 Prompt("session");
208 exitSession = false;
209
210 // TODO: Ensure that the list of commands is updated
211 // Load commands into Help Tree View
212 InitHelpTreeItems();
213
214 interactorManager->DisableSecondaryLoop();
215 void* event;
216 while ((event = interactorManager->GetEvent()) != nullptr) {
217 interactorManager->DispatchEvent(event);
218 if (exitSession) break;
219 }
220 interactorManager->EnableSecondaryLoop();
221 return this;
222 } else return this;
223}
224/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
225/****************************************************************************************************/
226
227/****************************************************************************************************/
228/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
229void G4UIWin32::Prompt(const G4String& a_prompt) {}
230/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
231/****************************************************************************************************/
232
233/****************************************************************************************************/
234/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
236/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
237/****************************************************************************************************/
238
239/****************************************************************************************************/
240/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
242 if (a_state == "G4_pause> ") {
243 SecondaryLoop("Pause, type continue to exit this state");
244 }
245
246 if (a_state == "EndOfEvent") {
247 // Picking with feed back in event data Done here !!!
248 SecondaryLoop("End of event, type continue to exit this state");
249 }
250}
251/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
252/****************************************************************************************************/
253
254/****************************************************************************************************/
255/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
256void G4UIWin32::SecondaryLoop(const G4String& a_prompt) {
257 if (interactorManager != nullptr) {
258 Prompt(a_prompt);
259 exitPause = false;
260 void* event;
261 while ((event = interactorManager->GetEvent()) != nullptr) {
262 interactorManager->DispatchEvent(event);
263 if (exitPause) break;
264 }
265 Prompt("session");
266 }
267}
268/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
269/****************************************************************************************************/
270
271/****************************************************************************************************/
272/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
274 // Geant4 uses UNIX's style for new lines (\n)
275 // we must convert them to Windows' style (\r\n)
276 G4String str = ConvertNewLines(a_string);
277
278 AddText((LPSTR) str.data());
279
280 return 0;
281}
282/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
283/****************************************************************************************************/
284
285/****************************************************************************************************/
286/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
288 // Geant4 uses UNIX's style for new lines (\n)
289 // we must convert them to Windows' style (\r\n)
290 G4String str = ConvertNewLines(a_string);
291
292 AddText((LPSTR) str.data());
293
294 return 0;
295}
296/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
297/****************************************************************************************************/
298
299/****************************************************************************************************/
300/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
301G4bool G4UIWin32::GetHelpChoice(G4int& aInt) {
302 fHelp = true;
303
304 if (interactorManager != nullptr) {
305 Prompt("Help");
306 exitHelp = false;
307 void* event;
308 while ((event = interactorManager->GetEvent()) != nullptr) {
309 interactorManager->DispatchEvent(event);
310 if (exitHelp) break;
311 }
312 Prompt("session");
313 //
314 if (!fHelp) return false;
315 aInt = fHelpChoice;
316 fHelp = false;
317 return true;
318 } else return false;
319}
320/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
321/****************************************************************************************************/
322
323/****************************************************************************************************/
324/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
325void G4UIWin32::ExitHelp() const {}
326/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
327/****************************************************************************************************/
328
329/****************************************************************************************************/
330/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
331void G4UIWin32::AddMenu(const char* a_name, const char* a_label) {
332 if (a_name != nullptr) {
333 HMENU hMenu = CreatePopupMenu();
334 AppendMenu(menuBar, MF_POPUP, (UINT_PTR) hMenu, a_label);
335 AddInteractor(a_name, (G4Interactor) hMenu);
336 DrawMenuBar(fHWndMainWindow);
337 }
338}
339/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
340/****************************************************************************************************/
341
342/****************************************************************************************************/
343/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
344void G4UIWin32::AddButton(const char* a_menu,
345 const char* a_label,
346 const char* a_command) {
347
348 if ((a_menu != nullptr) && (a_label != nullptr) && (a_command != nullptr)) {
349 HMENU hMenu = (HMENU) GetInteractor(a_menu);
350 actionIdentifier++;
351 commands[actionIdentifier] = a_command;
352 AppendMenu(hMenu, MF_STRING, actionIdentifier, a_label);
353 }
354}
355/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
356/****************************************************************************************************/
357
358/****************************************************************************************************/
359/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
361 return commands[a_id];
362}
363/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
364/****************************************************************************************************/
365
366/****************************************************************************************************/
367/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
368LRESULT CALLBACK G4UIWin32::MainWindowProc(HWND aWindow, UINT aMessage,
369 WPARAM wParam, LPARAM lParam) {
370 switch (aMessage) {
371 case WM_CREATE: {
372 auto* This = (G4UIWin32*) tmpSession;
373 if (This != nullptr) {
374 if (!This->CreateComponents(aWindow)) {
375 MessageBox(aWindow, "Could not create components.", "Error", MB_OK | MB_ICONERROR);
376 return false;
377 }
378 }
379 } return 0;
380
381 case WM_SIZE: {
382 auto* This = (G4UIWin32*) ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
383 if (This != nullptr) {
384 if (!This->ResizeComponents(aWindow)) {
385 MessageBox(aWindow, "Could not resize components.", "Error", MB_OK | MB_ICONERROR);
386 return false;
387 }
388 }
389 } return 0;
390
391 case WM_CLOSE:
392 DestroyWindow(aWindow);
393 return 0;
394
395 case WM_DESTROY:
396 PostQuitMessage(0);
397 return 0;
398
399 case WM_SETFOCUS: {
400 auto* This = (G4UIWin32*) ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
401 if (This != nullptr)
402 SetFocus(This->fHWndComboBox);
403 } return 0;
404
405 case WM_NOTIFY: {
406 auto* This = (G4UIWin32*) ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
407 if (This != nullptr) {
408 switch (((LPNMHDR) lParam)->code) {
409 // Tooltip for Toolbar
410 case TTN_NEEDTEXT: {
411 auto lpttt = (LPTOOLTIPTEXT) lParam;
412 lpttt->hinst = nullptr;
413 UINT idButton = lpttt->hdr.idFrom;
414 lpttt->lpszText = (LPSTR) This->GetToolTips(idButton).c_str();
415 } break;
416
417 // Tooltip for TreeView
418 case TVN_GETINFOTIP: {
419 auto pTip = (LPNMTVGETINFOTIP) lParam;
420 pTip->pszText = (LPSTR) This->GetHelpTreeToolTips(pTip->hItem).c_str();
421 } break;
422
423 // Double click for TreeView
424 case NM_DBLCLK: {
425 auto lpnmh = (LPNMHDR) lParam;
426 auto item = TreeView_GetSelection(lpnmh->hwndFrom);
427 This->HelpTreeDoubleClick(item);
428 } break;
429 }
430 }
431 } return 0;
432
433 case WM_COMMAND: {
434 auto* This = (G4UIWin32*) ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
435 if (This != nullptr)
436 if (!This->ProcessDefaultCommands(LOWORD(wParam)))
437 // If the command was not processed, do it now
438 switch (LOWORD(wParam)) {
439 case IDC_MAIN_EDIT: {
440 // We have to release some space when the buffer is full
441 if (HIWORD(wParam) == EN_ERRSPACE || HIWORD(wParam) == EN_MAXTEXT) {
442 G4int bufferSize = SendMessage(This->fHWndEditor, EM_GETLIMITTEXT,
443 (WPARAM) 0, (LPARAM) 0);
444
445 // Select the first third of the text
446 SendMessage(This->fHWndEditor, EM_SETSEL, (WPARAM) 0, (LPARAM) bufferSize/3);
447 // Delete it
448 SendMessage(This->fHWndEditor, EM_REPLACESEL, (WPARAM) 0, (LPARAM) "");
449 // Scroll to the bottom
450 SendMessage(This->fHWndEditor, WM_VSCROLL, SB_BOTTOM, NULL);
451 }
452 }
453 break;
454 default:
455 if (!This->fHelp) {
456 G4String command = This->GetCommand(wParam);
457 This->ApplyShellCommand(command, exitSession, exitPause);
458 }
459 }
460 } return 0;
461 default:
462 // For all the other cases, call the default window procedure.
463 return DefWindowProc(aWindow, aMessage, wParam, lParam);
464 }
465}
466/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
467/****************************************************************************************************/
468
469/****************************************************************************************************/
470/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
471LRESULT CALLBACK G4UIWin32::ComboEditorWindowProc(HWND aWindow, UINT aMessage, WPARAM wParam, LPARAM lParam) {
472
473 // We need to go two steps up: Editor -> ComboBox -> Window
474 HWND parent = GetParent(GetParent(aWindow));
475 auto* This = (G4UIWin32*) ::GetWindowLongPtr(parent, GWLP_USERDATA);
476
477 switch (aMessage) {
478 case WM_KEYDOWN:
479 switch (wParam) {
480 case VK_TAB: {
481 if (This != nullptr) {
482 if (This->fHelp) break;
483
484 This->ProcessTabKey();
485 }
486 } return 0; //Do not jump into origComboEditorWindowProc.
487
488 case VK_ESCAPE: {
489 if (This != nullptr)
490 This->ProcessEscKey();
491 } return 0; //Do not jump into origComboEditorWindowProc.
492
493 case VK_RETURN: {
494 if (This != nullptr)
495 This->ProcessEnterKey();
496 } return 0; //Do not jump into origComboEditorWindowProc.
497
498 case VK_UP: {
499 if (This != nullptr)
500 This->ProcessUpKey();
501 } return 0; //Do not jump into origComboEditorWindowProc.
502
503 case VK_DOWN: {
504 if (This != nullptr)
505 This->ProcessDownKey();
506 } return 0; //Do not jump into origComboEditorWindowProc.
507 }
508 break;
509
510 case WM_KEYUP:
511 case WM_CHAR:
512 switch (wParam) {
513 case VK_TAB:
514 case VK_ESCAPE:
515 case VK_RETURN:
516 case VK_UP:
517 case VK_DOWN:
518 return 0; //Do not jump into origComboEditorWindowProc.
519 }
520 }
521
522 // Call the original window procedure for default processing.
523 return CallWindowProc(origComboEditorWindowProc, aWindow, aMessage, wParam, lParam);
524}
525/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
526/****************************************************************************************************/
527
528/****************************************************************************************************/
529/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
530G4bool G4UIWin32::CreateComponents(HWND aWindow) {
531 HFONT hfDefault;
532 TBBUTTON tbb[NUM_BUTTONS];
533 TBADDBITMAP tbab;
534 RECT rcClient; // dimensions of client area
535
536 G4int statwidths[] = {100, -1};
537
538 // Create Edit Control
539 fHWndEditor = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
540 WS_CHILD | WS_VISIBLE | WS_VSCROLL |
541 WS_HSCROLL | ES_MULTILINE |
542 ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY,
543 0, 0, 100, 100, aWindow, (HMENU) IDC_MAIN_EDIT,
544 GetModuleHandle(nullptr), nullptr);
545 if (fHWndEditor == nullptr)
546 MessageBox(aWindow, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);
547
548 // Set editor font
549 //hfDefault = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
550 hfDefault = CreateFont(-10, -8, 0, 0, 0, false, 0, 0, OEM_CHARSET,
551 OUT_RASTER_PRECIS, CLIP_DEFAULT_PRECIS,
552 DEFAULT_QUALITY, FIXED_PITCH, "System");
553 SendMessage(fHWndEditor, WM_SETFONT, (WPARAM) hfDefault, MAKELPARAM(false, 0));
554
555 // Set editor's buffer size (the default value is too small)
556 SendMessage(fHWndEditor, EM_SETLIMITTEXT, (WPARAM) 500000, (LPARAM) 0);
557
558 // Create Toolbar
559 fHWndToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, nullptr,
560 WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT |
561 TBSTYLE_TOOLTIPS, 0, 0, 0, 0,
562 aWindow, (HMENU) IDC_MAIN_TOOL,
563 GetModuleHandle(nullptr), nullptr);
564 if (fHWndToolBar == nullptr)
565 MessageBox(aWindow, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR);
566
567 // Required for backward compatibility.
568 SendMessage(fHWndToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), (LPARAM) 0);
569
570 // Load standard images
571 tbab.hInst = HINST_COMMCTRL;
572 tbab.nID = IDB_STD_SMALL_COLOR;
573 SendMessage(fHWndToolBar, TB_ADDBITMAP, (WPARAM) 0, (LPARAM) &tbab);
574
575 // Load history images
576 tbab.hInst = HINST_COMMCTRL;
577 tbab.nID = IDB_HIST_SMALL_COLOR;
578 SendMessage(fHWndToolBar, TB_ADDBITMAP, (WPARAM) 0, (LPARAM) &tbab);
579
580 G4int btnBMP[NUM_BUTTONS] = {STD_FILEOPEN, STD_FILESAVE, -1,
581 STD_FIND, STD_FIND, -1,
582 15 + HIST_FORWARD, -1,
583 STD_HELP, -1,
584 STD_FILENEW, STD_FILESAVE};
585 G4int btnSTL[NUM_BUTTONS] = {TBSTYLE_BUTTON, TBSTYLE_BUTTON, TBSTYLE_SEP,
586 TBSTYLE_BUTTON, TBSTYLE_BUTTON, TBSTYLE_SEP,
587 TBSTYLE_BUTTON, TBSTYLE_SEP,
588 TBSTYLE_BUTTON, TBSTYLE_SEP,
589 TBSTYLE_BUTTON, TBSTYLE_BUTTON};
592 ID_RUN_BEAMON, -1,
593 ID_HELP_ABOUT, -1,
595 ZeroMemory(tbb, sizeof(tbb));
596 for (G4int i = 0; i < NUM_BUTTONS; i++) {
597 tbb[i].iBitmap = btnBMP[i];
598 tbb[i].fsState = TBSTATE_ENABLED;
599 tbb[i].fsStyle = btnSTL[i];
600 tbb[i].idCommand = btnCMD[i];
601 }
602
603 SendMessage(fHWndToolBar, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM) &tbb);
604
605 // Create the Combobox
606 fHWndComboBox = CreateWindowEx(0, WC_COMBOBOX, TEXT(""),
607 CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD |
608 WS_OVERLAPPED | WS_VISIBLE,
609 150, 0, 200, 200, aWindow, (HMENU) IDC_MAIN_COMBO,
610 GetModuleHandle(nullptr), nullptr);
611
612 // Display an initial item in the selection field
613 SendMessage(fHWndComboBox, CB_SETCURSEL, (WPARAM) 2, (LPARAM) 0);
614
615 //Get aWindow of edit control in combobox created earlier.
616 fHWndComboEditor = FindWindowEx(fHWndComboBox, nullptr, WC_EDIT, nullptr);
617
618 // Change the window procedure for the edit windows to the subclass procedure.
619 origComboEditorWindowProc = (WNDPROC) SetWindowLongPtr(fHWndComboEditor, GWLP_WNDPROC,
620 (LONG_PTR) ComboEditorWindowProc);
621
622 // Create TreeView
623
624 // Get the dimensions of the parent window's client area, and create
625 // the tree-view control.
626 GetClientRect(aWindow, &rcClient);
627 fHWndHelpTree = CreateWindowEx(0, WC_TREEVIEW,
628 TEXT("Tree View"),
629 WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_INFOTIP |
630 TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT,
631 0, 0,
632 rcClient.right, rcClient.bottom,
633 aWindow, (HMENU) IDC_MAIN_TREE_VIEW,
634 GetModuleHandle(nullptr), nullptr);
635
636 // Initialize the Help Tree View.
637/* if (!InitHelpTreeItems()) {
638 DestroyWindow(fHWndHelpTree);
639 return false;
640 }*/
641
642 // Create Status bar
643 fHWndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr,
644 WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
645 100, 100, 200, 200,
646 aWindow, (HMENU) IDC_MAIN_STATUS,
647 GetModuleHandle(nullptr), nullptr);
648
649 SendMessage(fHWndStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM) statwidths);
650 //SendMessage(fHWndStatus, SB_SETTEXT, 0, (LPARAM) "Hi there :)");
651
652 return true;
653}
654/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
655/****************************************************************************************************/
656
657/****************************************************************************************************/
658/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
659G4bool G4UIWin32::ResizeComponents(HWND aWindow) {
660 RECT rcTool;
661 G4int iToolHeight, iToolWidth;
662
663 RECT rcStatus;
664 G4int iStatusHeight;
665
666 RECT rcComboBox;
667 G4int iComboBoxHeight;
668
669 G4int iTreeViewHeight, iTreeViewWidth;
670 G4int iEditHeight, iEditWidth;
671
672 RECT rcClient;
673
674 // Size toolbar and get height and width
675 SendMessage(fHWndToolBar, TB_AUTOSIZE, 0, 0);
676
677 GetWindowRect(fHWndToolBar, &rcTool);
678 iToolHeight = rcTool.bottom - rcTool.top;
679 iToolWidth = rcTool.right - rcTool.left;
680
681 // Size status bar and get height
682 SendMessage(fHWndStatus, WM_SIZE, 0, 0);
683
684 GetWindowRect(fHWndStatus, &rcStatus);
685 iStatusHeight = rcStatus.bottom - rcStatus.top;
686
687 // Size status the Combo Box and get height
688 SendMessage(fHWndComboBox, WM_SIZE, 0, 0);
689
690 GetWindowRect(fHWndComboBox, &rcComboBox);
691 iComboBoxHeight = rcComboBox.bottom - rcComboBox.top;
692
693 // Calculate remaining height and size edit
694 GetClientRect(aWindow, &rcClient);
695
696 iTreeViewHeight = rcClient.bottom - iToolHeight - iStatusHeight;
697 iTreeViewWidth = iToolWidth/4;
698
699 iEditHeight = rcClient.bottom - iToolHeight - iComboBoxHeight - iStatusHeight;
700 iEditWidth = iToolWidth - iTreeViewWidth;
701
702 // TreeView location and size
703 SetWindowPos(fHWndHelpTree, nullptr, 0, iToolHeight,
704 iTreeViewWidth, iTreeViewHeight, SWP_NOZORDER);
705
706 // Editor location and size
707 SetWindowPos(fHWndEditor, nullptr, iTreeViewWidth, iToolHeight,
708 iEditWidth, iEditHeight, SWP_NOZORDER);
709
710 // ComboBox location and size
711 SetWindowPos(fHWndComboBox, nullptr, iTreeViewWidth, iToolHeight + iEditHeight,
712 iEditWidth, 200, 0);
713
714 return true;
715}
716/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
717/****************************************************************************************************/
718
719/****************************************************************************************************/
720/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
721void G4UIWin32::ProcessTabKey() {
722 char buffer[256];
723
724 // Only process the command it the user has written something
725 if (SendMessage(fHWndComboBox, WM_GETTEXT, (WPARAM) sizeof(buffer), (LPARAM) buffer) != 0) {
726 G4String command(buffer);
727
728 SetFocus(fHWndComboBox);
729
730 G4String cmd = Complete(command);
731 const char* d = cmd.data();
732 G4int l = strlen(d);
733 Edit_SetText(fHWndComboEditor, d);
734 Edit_SetSel(fHWndComboEditor, l, l);
735 } else {
736 if (GetFocus() == fHWndComboEditor)
737 SetFocus(fHWndHelpTree);
738 else
739 SetFocus(fHWndComboBox);
740 }
741}
742/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
743/****************************************************************************************************/
744
745/****************************************************************************************************/
746/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
747void G4UIWin32::ProcessEscKey() {
748 // Clear the current selection.
749 SendMessage(fHWndComboBox, CB_SETCURSEL, (WPARAM) (-1), (LPARAM) 0);
750 // Set the focus to the Combo Box.
751 SetFocus(fHWndComboBox);
752}
753/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
754/****************************************************************************************************/
755
756/****************************************************************************************************/
757/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
758void G4UIWin32::ProcessEnterKey() {
759 char buffer[256];
760 DWORD dwIndex, numItems;
761
762 // Only process the command it the user has written something
763 if (SendMessage(fHWndComboBox, WM_GETTEXT, (WPARAM) sizeof(buffer), (LPARAM) buffer) != 0) {
764 SetFocus(fHWndComboBox);
765
766 // Read command
767 G4String command(buffer);
768
769 // Now clear the current selection.
770 SendMessage(fHWndComboBox, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);
771
772 if (fHelp) {
773 exitHelp = true;
774 fHelp = ConvertStringToInt(command.data(), fHelpChoice);
775 } else {
776 fHistory.push_back(command);
777 fHistoryPos = -1;
778 ApplyShellCommand(command, exitSession, exitPause);
779
780 // Now update the history in the ComboBox
781
782 // Check if this command exists in the ComboBox
783 dwIndex = SendMessage(fHWndComboBox, CB_FINDSTRINGEXACT, (WPARAM) (-1), (LPARAM) buffer);
784
785 // Add the string, if necessary
786 if (dwIndex == CB_ERR)
787 dwIndex = SendMessage(fHWndComboBox, CB_INSERTSTRING, (WPARAM) 0, (LPARAM) buffer);
788 // If the string exists, move it to the first position
789 if (dwIndex != CB_ERR) {
790 SendMessage(fHWndComboBox, CB_DELETESTRING, (WPARAM) dwIndex, (LPARAM) 0);
791 dwIndex = SendMessage(fHWndComboBox, CB_INSERTSTRING, (WPARAM) 0, (LPARAM) buffer);
792 }
793
794 numItems = SendMessage(fHWndComboBox, CB_GETCOUNT, (WPARAM) 0, (LPARAM) 0);
795 while (numItems > MAX_HISTORY_ITEMS) {
796 SendMessage(fHWndComboBox, CB_DELETESTRING, (WPARAM) (numItems - 1), (LPARAM) 0);
797 numItems = SendMessage(fHWndComboBox, CB_GETCOUNT, (WPARAM) 0, (LPARAM) 0);
798 }
799 }
800 }
801}
802/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
803/****************************************************************************************************/
804
805/****************************************************************************************************/
806/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
807void G4UIWin32::ProcessUpKey() {
808 G4int pos = fHistoryPos == -1 ?
809 fHistory.size() - 1: fHistoryPos - 1;
810 if ((pos >= 0) && (pos < (G4int) fHistory.size())) {
811 G4String command = fHistory[pos];
812 const char* d = command.data();
813 G4int l = strlen(d);
814 Edit_SetText(fHWndComboEditor, d);
815 Edit_SetSel(fHWndComboEditor, l, l);
816
817 fHistoryPos = pos;
818 }
819}
820/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
821/****************************************************************************************************/
822
823/****************************************************************************************************/
824/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
825void G4UIWin32::ProcessDownKey() {
826 G4int pos = fHistoryPos + 1;
827 if ((pos >= 0) && (pos < (G4int) fHistory.size())) {
828 G4String command = fHistory[pos];
829 const char* d = command.data();
830 G4int l = strlen(d);
831 Edit_SetText(fHWndComboEditor, d);
832 Edit_SetSel(fHWndComboEditor, l, l);
833
834 fHistoryPos = pos;
835 } else if (pos >= (G4int) fHistory.size()) {
836 Edit_SetText(fHWndComboEditor, "");
837 Edit_SetSel(fHWndComboEditor, 0, 0);
838
839 fHistoryPos = -1;
840 }
841}
842/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
843/****************************************************************************************************/
844
845/****************************************************************************************************/
846/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
847G4bool G4UIWin32::ProcessDefaultCommands(G4int idCommand) {
848 switch (idCommand) {
849 case ID_EXIT_APP:
850 PostMessage(fHWndMainWindow, WM_CLOSE, 0, 0);
851 return true;
852 case ID_OPEN_MACRO:
853 DoOpenMacro(fHWndMainWindow);
854 return true;
856 DoSaveViewer(fHWndMainWindow);
857 return true;
858 case ID_RUN_BEAMON:
859 if(!fHelp) {
860 G4String command = "/run/beamOn 1";
861 ApplyShellCommand(command,exitSession,exitPause);
862 } return true;
863 case ID_RUN_CMD:
864 return true;
865 case ID_VIEW_SOLID:
866 if(!fHelp) {
867 G4String command = "/vis/viewer/set/style s";
868 ApplyShellCommand(command,exitSession,exitPause);
869 } return true;
871 if(!fHelp) {
872 G4String command = "/vis/viewer/set/style w";
873 ApplyShellCommand(command,exitSession,exitPause);
874 } return true;
876 if(!fHelp) {
877 G4String command = "/vis/viewer/set/projection o";
878 ApplyShellCommand(command,exitSession,exitPause);
879 } return true;
881 if(!fHelp) {
882 G4String command = "/vis/viewer/set/projection p";
883 ApplyShellCommand(command,exitSession,exitPause);
884 } return true;
885 case ID_ZOOM_IN:
886 if(!fHelp) {
887 G4String command = "/vis/viewer/zoom 1.2";
888 ApplyShellCommand(command,exitSession,exitPause);
889 } return true;
890 case ID_ZOOM_OUT:
891 if(!fHelp) {
892 G4String command = "/vis/viewer/zoom 0.8";
893 ApplyShellCommand(command,exitSession,exitPause);
894 } return true;
896 if(!fHelp) {
897 G4String command = "/vis/viewer/set/viewpointThetaPhi 0. 0.";
898 ApplyShellCommand(command,exitSession,exitPause);
899 } return true;
901 if(!fHelp) {
902 G4String command = "/vis/viewer/set/viewpointThetaPhi 90. 0.";
903 ApplyShellCommand(command,exitSession,exitPause);
904 } return true;
906 if(!fHelp) {
907 G4String command = "/vis/viewer/set/viewpointThetaPhi 0. 90.";
908 ApplyShellCommand(command,exitSession,exitPause);
909 } return true;
911 if(!fHelp) {
912 G4String command = "/vis/viewer/set/viewpointThetaPhi 45. -45.";
913 ApplyShellCommand(command,exitSession,exitPause);
914 } return true;
915 case ID_HELP_ABOUT:
916 return true;
917 case ID_LOG_CLEAN:
918 SetDlgItemText(fHWndMainWindow, IDC_MAIN_EDIT, "");
919 return true;
920 case ID_LOG_SAVE:
921 DoSaveLog(fHWndMainWindow);
922 return true;
923 default:
924 return false;
925 }
926}
927/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
928/****************************************************************************************************/
929
930/****************************************************************************************************/
931/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
932G4String G4UIWin32::GetToolTips(G4int idButton) {
933 switch (idButton) {
934 case ID_OPEN_MACRO:
935 return "Open and execute macro file";
936
938 return "Save viewer state";
939
940 case ID_ZOOM_IN:
941 return "Zoom in";
942
943 case ID_ZOOM_OUT:
944 return "Zoom out";
945
946 case ID_RUN_BEAMON:
947 return "Beam on (one particle)";
948
949 case ID_HELP_ABOUT:
950 return "About G4UIWin32";
951
952 case ID_LOG_CLEAN:
953 return "Clean log";
954
955 case ID_LOG_SAVE:
956 return "Save log";
957
958 default:
959 return "";
960 }
961}
962/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
963/****************************************************************************************************/
964
965/****************************************************************************************************/
966/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
967G4String G4UIWin32::GetHelpTreeToolTips(HTREEITEM item) {
968 // Tooltips for the help tree
970 if (UI == nullptr) return "";
971 G4UIcommandTree* treeTop = UI->GetTree();
972
973 G4String itemText = GetItemPath(item);
974
975 // Check if it is a command path
976 if (TreeView_GetChild(fHWndHelpTree, item) != nullptr)
977 itemText += "/";
978
979 G4UIcommand* command = treeTop->FindPath(itemText.c_str());
980
981 if (command) {
982 // This is a command, return the first line of help
983 return command->GetGuidanceLine(0).data();
984 } else {
985 // This is not a command, but a sub directory, return the title
986 G4UIcommandTree* path = treeTop->FindCommandTree(itemText.c_str());
987 if (path) return path->GetTitle().data();
988 }
989
990 return "";
991}
992/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
993/****************************************************************************************************/
994
995/****************************************************************************************************/
996/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
997G4String G4UIWin32::ConvertNewLines(G4String a_string) {
998
999 // Geant4 uses UNIX's style for new lines (\n)
1000 // we must convert them to Windows' style (\r\n)
1001 G4String str = std::move(a_string);
1002 size_t index = str.find("\n", 0);
1003 while (index < str.length()) {
1004 str.replace(index, 2, "\r\n");
1005 // Advance index forward so the next iteration doesn't pick it up as well.
1006 index = str.find("\n", index + 2);
1007 }
1008 return str;
1009}
1010/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1011/****************************************************************************************************/
1012
1013/****************************************************************************************************/
1014/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1015void G4UIWin32::HelpTreeDoubleClick(HTREEITEM item) {
1016 const char* item_path = GetItemPath(item);
1017 G4int l = strlen(item_path);
1018 Edit_SetText(fHWndComboEditor, item_path);
1019 Edit_SetSel(fHWndComboEditor, l, l);
1020
1021 SetFocus(fHWndComboEditor);
1022}
1023/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1024/****************************************************************************************************/
1025
1026/****************************************************************************************************/
1027/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1028G4bool G4UIWin32::SaveLogFile(LPCTSTR fileName) {
1029 HANDLE hFile;
1030 G4bool bSuccess = false;
1031
1032 hFile = CreateFile(fileName, GENERIC_WRITE, 0, nullptr,
1033 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
1034 if (hFile != INVALID_HANDLE_VALUE) {
1035 DWORD dwTextLength;
1036
1037 dwTextLength = GetWindowTextLength(fHWndEditor);
1038 // No need to bother if there's no text.
1039 if (dwTextLength > 0) {
1040 LPSTR text;
1041 DWORD dwBufferSize = dwTextLength + 1;
1042
1043 text = (LPSTR) GlobalAlloc(GPTR, dwBufferSize);
1044 if (text != nullptr) {
1045 if (GetWindowText(fHWndEditor, text, dwBufferSize)) {
1046 DWORD dwWritten;
1047
1048 if (WriteFile(hFile, text, dwTextLength, &dwWritten, nullptr))
1049 bSuccess = true;
1050 }
1051 GlobalFree(text);
1052 }
1053 }
1054 CloseHandle(hFile);
1055 }
1056 return bSuccess;
1057}
1058/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1059/****************************************************************************************************/
1060
1061/****************************************************************************************************/
1062/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1063void G4UIWin32::AddText(LPSTR text) {
1064 if ((fHWndEditor != nullptr) && (text != nullptr) && (text[0] != '\0')) {
1065 // Get current text length
1066 G4int ndx = GetWindowTextLength(fHWndEditor);
1067
1068 // Select the end of the text
1069 SendMessage(fHWndEditor, EM_SETSEL, (WPARAM) ndx, (LPARAM) ndx);
1070 //Add the new text
1071 SendMessage(fHWndEditor, EM_REPLACESEL, (WPARAM) 0, (LPARAM) text);
1072 // Scroll to the bottom
1073 SendMessage(fHWndEditor, WM_VSCROLL, SB_BOTTOM, NULL);
1074 }
1075}
1076/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1077/****************************************************************************************************/
1078
1079/****************************************************************************************************/
1080/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1081void G4UIWin32::DoOpenMacro(HWND aWindow) {
1082 OPENFILENAME ofn;
1083 char szFileName[MAX_PATH] = "";
1084
1085 ZeroMemory(&ofn, sizeof(ofn));
1086
1087 ofn.lStructSize = sizeof(ofn);
1088 ofn.hwndOwner = aWindow;
1089 ofn.lpstrFilter = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
1090 ofn.lpstrFile = szFileName;
1091 ofn.nMaxFile = MAX_PATH;
1092 ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
1093 ofn.lpstrDefExt = "mac";
1094
1095 if (GetOpenFileName(&ofn)) {
1096 G4String command = "/control/execute " + G4String(szFileName);
1097 ApplyShellCommand(command,exitSession,exitPause);
1098
1099 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM) "Opened macro...");
1100 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM) szFileName);
1101 }
1102}
1103/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1104/****************************************************************************************************/
1105
1106/****************************************************************************************************/
1107/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1108void G4UIWin32::DoSaveViewer(HWND aWindow) {
1109 OPENFILENAME ofn;
1110 char szFileName[MAX_PATH] = "";
1111
1112 ZeroMemory(&ofn, sizeof(ofn));
1113
1114 ofn.lStructSize = sizeof(ofn);
1115 ofn.hwndOwner = aWindow;
1116 ofn.lpstrFilter = "Macro Files (*.mac)\0*.mac\0All Files (*.*)\0*.*\0";
1117 ofn.lpstrFile = szFileName;
1118 ofn.nMaxFile = MAX_PATH;
1119 ofn.lpstrDefExt = "mac";
1120 ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
1121
1122 if (GetSaveFileName(&ofn)) {
1123 G4String command = "/vis/viewer/save " + G4String(szFileName);
1124 ApplyShellCommand(command,exitSession,exitPause);
1125
1126 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM) "State saved...");
1127 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM) szFileName);
1128 }
1129}
1130/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1131/****************************************************************************************************/
1132
1133/****************************************************************************************************/
1134/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1135void G4UIWin32::DoSaveLog(HWND aWindow) {
1136 OPENFILENAME ofn;
1137 char szFileName[MAX_PATH] = "";
1138
1139 ZeroMemory(&ofn, sizeof(ofn));
1140
1141 ofn.lStructSize = sizeof(ofn);
1142 ofn.hwndOwner = aWindow;
1143 ofn.lpstrFilter = "Log Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
1144 ofn.lpstrFile = szFileName;
1145 ofn.nMaxFile = MAX_PATH;
1146 ofn.lpstrDefExt = "txt";
1147 ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
1148
1149 if (GetSaveFileName(&ofn)) {
1150 if (SaveLogFile(szFileName)) {
1151 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM) "Saved log file...");
1152 SendDlgItemMessage(aWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM) szFileName);
1153 }
1154 }
1155}
1156/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1157/****************************************************************************************************/
1158
1159/****************************************************************************************************/
1160/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1161G4bool G4UIWin32::InitHelpTreeItems() {
1162 HTREEITEM newItem;
1163
1165 if (UI == nullptr) return false;
1166 G4UIcommandTree* treeTop = UI->GetTree();
1167
1168 G4int treeSize = treeTop->GetTreeEntry();
1169 G4String commandText;
1170 for (G4int a = 0; a < treeSize; a++) {
1171 // Creating new item
1172 commandText = treeTop->GetTree(a + 1)->GetPathName().data();
1173
1174 // Add the item to the tree-view control.
1175 newItem = AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()));
1176
1177 if (newItem == nullptr)
1178 return false;
1179
1180 // Look for children
1181 CreateHelpTree(newItem, treeTop->GetTree(a + 1));
1182 }
1183
1184 return true;
1185}
1186/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1187/****************************************************************************************************/
1188
1189/****************************************************************************************************/
1190/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1191void G4UIWin32::CreateHelpTree(HTREEITEM aParent, G4UIcommandTree* aCommandTree) {
1192 if ((aParent != nullptr) && (aCommandTree != nullptr)) {
1193 // Creating new item
1194 HTREEITEM newItem;
1195
1196 G4String commandText;
1197 // Get the Sub directories
1198 for (G4int a = 0; a < aCommandTree->GetTreeEntry(); a++) {
1199 commandText = aCommandTree->GetTree(a + 1)->GetPathName().data();
1200
1201 // Add the item to the tree-view control.
1202 newItem = AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()), aParent);
1203
1204 // Look for children
1205 CreateHelpTree(newItem, aCommandTree->GetTree(a + 1));
1206 }
1207
1208 // Get the Commands
1209 for (G4int a = 0; a < aCommandTree->GetCommandEntry(); a++) {
1210 commandText = aCommandTree->GetCommand(a + 1)->GetCommandPath().data();
1211
1212 // Add the item to the tree-view control.
1213 AddItemToHelpTree(const_cast<LPTSTR>(GetShortCommandPath(commandText).c_str()), aParent);
1214 }
1215 }
1216}
1217/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1218/****************************************************************************************************/
1219
1220/****************************************************************************************************/
1221/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1222HTREEITEM G4UIWin32::AddItemToHelpTree(LPTSTR lpszItem, HTREEITEM aParent) {
1223 TVITEM tvi;
1224 TVINSERTSTRUCT tvins;
1225 static auto hPrev = (HTREEITEM) TVI_FIRST;
1226
1227 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
1228
1229 // Set the text of the item.
1230 tvi.pszText = lpszItem;
1231 tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]);
1232
1233 // Save the heading level in the item's application-defined
1234 // data area.
1235 tvi.lParam = (LPARAM) aParent;
1236 tvins.item = tvi;
1237 tvins.hInsertAfter = hPrev;
1238 // Set the parent item.
1239 tvins.hParent = aParent;
1240
1241 // Add the item to the tree-view control.
1242 hPrev = (HTREEITEM) SendMessage(fHWndHelpTree, TVM_INSERTITEM, (WPARAM) 0,
1243 (LPARAM) (LPTVINSERTSTRUCT) &tvins);
1244
1245 if (hPrev == nullptr)
1246 return nullptr;
1247 else
1248 return hPrev;
1249}
1250/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1251/****************************************************************************************************/
1252
1253/****************************************************************************************************/
1254/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1255G4String G4UIWin32::GetShortCommandPath(G4String commandPath) {
1256 G4String str = std::move(commandPath);
1257
1258 if (str.find_last_of("/") == (str.size() - 1))
1259 str = str.erase(str.size() - 1, 1);
1260
1261 str = str.erase(0, str.find_last_of("/") + 1);
1262
1263 return str;
1264}
1265/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1266/****************************************************************************************************/
1267
1268/****************************************************************************************************/
1269/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1270LPSTR G4UIWin32::GetItemPath(HTREEITEM item) {
1271 // Get the text for the item.
1272 TVITEM tvitem;
1273 tvitem.mask = TVIF_TEXT;
1274 tvitem.hItem = item;
1275 TCHAR infoTipBuf[1024];
1276 tvitem.pszText = infoTipBuf;
1277 tvitem.cchTextMax = sizeof(infoTipBuf)/sizeof(TCHAR);
1278
1279 std::string str = "";
1280 while (item != nullptr) {
1281 TreeView_GetItem(fHWndHelpTree, &tvitem);
1282 str = "/" + std::string(tvitem.pszText) + str;
1283
1284 item = TreeView_GetParent(fHWndHelpTree, item);
1285 tvitem.hItem = item;
1286 }
1287
1288 auto* result = new TCHAR[str.size() + 1];
1289 result[str.size()] = 0;
1290 std::copy(str.begin(), str.end(), result);
1291
1292 return result;
1293}
1294/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1295/****************************************************************************************************/
1296
1297/****************************************************************************************************/
1298/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1299G4bool ConvertStringToInt(const char* aString, G4int& aInt) {
1300 aInt = 0;
1301 if (aString == nullptr) return false;
1302 char* s;
1303 G4long value = strtol(aString, &s, 10);
1304 if (s == aString) return false;
1305 aInt = value;
1306 return true;
1307}
1308/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
1309/****************************************************************************************************/
long G4long
Definition: G4Types.hh:87
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define ID_ORIENTATION_YZ
Definition: G4UIWin32.hh:65
#define ID_RUN_BEAMON
Definition: G4UIWin32.hh:55
#define IDC_MAIN_EDIT
Definition: G4UIWin32.hh:74
#define ID_ORIENTATION_OBLIQUE
Definition: G4UIWin32.hh:66
#define ID_LOG_CLEAN
Definition: G4UIWin32.hh:68
#define NUM_BUTTONS
Definition: G4UIWin32.hh:71
#define ID_OPEN_MACRO
Definition: G4UIWin32.hh:53
#define IDC_MAIN_TREE_VIEW
Definition: G4UIWin32.hh:76
#define ID_EXIT_APP
Definition: G4UIWin32.hh:52
#define IDC_MAIN_COMBO
Definition: G4UIWin32.hh:77
#define ID_LOG_SAVE
Definition: G4UIWin32.hh:69
#define ID_ZOOM_IN
Definition: G4UIWin32.hh:61
#define IDC_MAIN_STATUS
Definition: G4UIWin32.hh:78
#define ID_VIEW_SOLID
Definition: G4UIWin32.hh:57
#define ID_RUN_CMD
Definition: G4UIWin32.hh:56
#define ID_SAVE_VIEWER_STATE
Definition: G4UIWin32.hh:54
#define MAX_HISTORY_ITEMS
Definition: G4UIWin32.hh:72
#define ID_PROJ_ORTHOGRAPHIC
Definition: G4UIWin32.hh:59
#define ID_HELP_ABOUT
Definition: G4UIWin32.hh:67
#define ID_ZOOM_OUT
Definition: G4UIWin32.hh:62
#define IDC_MAIN_TOOL
Definition: G4UIWin32.hh:75
#define ID_ORIENTATION_XY
Definition: G4UIWin32.hh:63
#define ID_PROJ_PERSPECTIVE
Definition: G4UIWin32.hh:60
#define ID_ORIENTATION_XZ
Definition: G4UIWin32.hh:64
#define ID_VIEW_WIREFRAME
Definition: G4UIWin32.hh:58
void * G4Interactor
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int ReceiveG4cout(const G4String &) override
Definition: G4UIWin32.cc:273
G4UIsession * SessionStart() override
Definition: G4UIWin32.cc:205
~G4UIWin32() override
Definition: G4UIWin32.cc:177
void AddMenu(const char *, const char *) override
Definition: G4UIWin32.cc:331
void PauseSessionStart(const G4String &) override
Definition: G4UIWin32.cc:241
G4String GetCommand(G4int)
Definition: G4UIWin32.cc:360
void AddButton(const char *, const char *, const char *) override
Definition: G4UIWin32.cc:344
G4int ReceiveG4cerr(const G4String &) override
Definition: G4UIWin32.cc:287
void Prompt(const G4String &)
Definition: G4UIWin32.cc:229
void SessionTerminate()
Definition: G4UIWin32.cc:235
G4int GetCommandEntry() const
G4UIcommand * GetCommand(G4int i)
const G4String & GetPathName() const
G4int GetTreeEntry() const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * FindCommandTree(const char *commandPath)
const G4String GetTitle() const
G4UIcommand * FindPath(const char *commandPath) const
const G4String & GetGuidanceLine(G4int i) const
Definition: G4UIcommand.hh:133
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:137
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:747
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetSession(G4UIsession *const value)
Definition: G4UImanager.hh:190
void SetG4UIWindow(G4UIsession *const value)
Definition: G4UImanager.hh:191
G4String Complete(const G4String &)
void ApplyShellCommand(const G4String &, G4bool &, G4bool &)
void AddInteractor(G4String, G4Interactor)
G4Interactor GetInteractor(G4String)
virtual void * GetEvent()=0
static G4Win32 * getInstance()
Definition: G4Win32.cc:43