source: trunk/source/interfaces/basic/include/G4UIWin32.hh @ 989

Last change on this file since 989 was 989, checked in by garnier, 15 years ago

fichiers manquants

File size: 4.4 KB
Line 
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//
27// $Id: G4UIWin32.hh,v 1.14 2006/06/29 19:09:29 gunter Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30#ifndef G4UIWin32_h
31#define G4UIWin32_h
32
33#if defined(G4UI_BUILD_WIN32_SESSION) || defined(G4UI_USE_WIN32)
34
35#include <map>
36#include <vector>
37
38#include "G4VBasicShell.hh"
39#include "G4VInteractiveSession.hh"
40
41#include "G4Win32.hh"
42
43class G4VInteractorManager;
44
45// Class description :
46//
47//  G4UIWin32 : class to handle a Windows interactive session.
48// G4UIWin32 is the Windows version of G4UIterminal.
49//
50//  A command box is at disposal for entering/recalling Geant4 commands.
51//  A menubar could be customized through the AddMenu, AddButton methods.
52//  Note that there are corresponding Geant4 commands to add a
53// menus in the menubar and add buttons in a menu.
54//  Ex :
55//    /gui/addMenu   test Test
56//    /gui/addButton test Init /run/initialize
57//    /gui/addButton test "Set gun" "/control/execute gun.g4m"
58//    /gui/addButton test "Run one event" "/run/beamOn 1"
59//
60//  Command completion, by typing "tab" key, is available on the
61// command line.
62//
63// Class description - end :
64
65class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
66public: // With description
67  G4UIWin32();
68  // The WinMain arguments have to be given.
69  G4UIsession* SessionStart      ();
70  // To enter interactive Win32 loop ; waiting/executing command,...
71  void AddMenu (const char*,const char*);
72  // To add a pulldown menu in the menu bar.
73  // First argument is the name of the menu.
74  // Second argument is the label of the cascade button.
75  // Ex : AddMenu("my_menu","My menu")
76  void AddButton (const char*,const char*,const char*);
77  // To add a push button in a pulldown menu.
78  // First argument is the name of the menu.
79  // Second argument is the label of the button.
80  // Third argument is the Geant4 command executed when the button is fired.
81  // Ex : AddButton("my_menu","Run","/run/beamOn 1");
82public:
83  ~G4UIWin32 ();
84  void Prompt (G4String);
85  void SessionTerminate ();
86  void PauseSessionStart (G4String);
87  G4int ReceiveG4cout(G4String);
88  G4int ReceiveG4cerr(G4String);
89  G4String GetCommand (int);
90  void TextAppendString(char*);
91private:
92  void SecondaryLoop (G4String);
93  G4bool GetHelpChoice(G4int&);
94  void ExitHelp();
95private:
96  G4VInteractorManager* interactorManager;
97  HWND mainWindow;
98  HWND textWindow,editWindow;
99  HMENU menuBar,defaultMenu;
100  std::map<int,G4String, std::less<int> > commands;
101  void* textBuffer;
102  int textRows,textCols;
103  static LRESULT CALLBACK MainWindowProc(HWND,UINT,WPARAM,LPARAM);
104  static LRESULT CALLBACK TextWindowProc(HWND,UINT,WPARAM,LPARAM);
105  static LRESULT CALLBACK EditWindowProc(HWND,UINT,WPARAM,LPARAM);
106  G4bool fHelp;
107  G4int fHelpChoice;
108  std::vector<G4String> fHistory;
109  int fHistoryPos;
110};
111
112#endif
113
114#endif
115
Note: See TracBrowser for help on using the repository browser.