source: trunk/geant4/interfaces/basic/src/G4UIQt.cc @ 496

Last change on this file since 496 was 496, checked in by garnier, 17 years ago

r589@mac-90108: laurentgarnier | 2007-06-08 15:41:35 +0200
probleme avec les layout, revenons a qq chose de simple

  • Property svn:mime-type set to text/cpp
File size: 21.4 KB
Line 
1// TODO !
2
3//
4// ********************************************************************
5// * License and Disclaimer                                           *
6// *                                                                  *
7// * The  Geant4 software  is  copyright of the Copyright Holders  of *
8// * the Geant4 Collaboration.  It is provided  under  the terms  and *
9// * conditions of the Geant4 Software License,  included in the file *
10// * LICENSE and available at  http://cern.ch/geant4/license .  These *
11// * include a list of copyright holders.                             *
12// *                                                                  *
13// * Neither the authors of this software system, nor their employing *
14// * institutes,nor the agencies providing financial support for this *
15// * work  make  any representation or  warranty, express or implied, *
16// * regarding  this  software system or assume any liability for its *
17// * use.  Please see the license in the file  LICENSE  and URL above *
18// * for the full disclaimer and the limitation of liability.         *
19// *                                                                  *
20// * This  code  implementation is the result of  the  scientific and *
21// * technical work of the GEANT4 collaboration.                      *
22// * By using,  copying,  modifying or  distributing the software (or *
23// * any work based  on the software)  you  agree  to acknowledge its *
24// * use  in  resulting  scientific  publications,  and indicate your *
25// * acceptance of all terms of the Geant4 Software license.          *
26// ********************************************************************
27//
28//
29// $Id: G4UIQt.cc,v 1.14 2007/05/29 11:09:49 $
30// GEANT4 tag $Name: geant4-08-01 $
31//
32// L. Garnier
33
34//#define DEBUG
35
36#ifdef G4UI_BUILD_QT_SESSION
37
38#include "G4Types.hh"
39
40#include <string.h>
41
42#include "G4UIQt.hh"
43#include "G4UImanager.hh"
44#include "G4StateManager.hh"
45#include "G4UIcommandTree.hh"
46#include "G4UIcommandStatus.hh"
47
48#include "G4Qt.hh"
49
50#include <QtGui/qapplication.h>
51#include <QtGui/qwidget.h>
52#include <QtGui/qmenu.h>
53#include <QtGui/qmenubar.h>
54#include <QtGui/qboxlayout.h>
55#include <QtGui/qpushbutton.h>
56#include <QtGui/qlabel.h>
57#include <QtGui/qsplitter.h>
58#include <QtGui/qlistview.h> // en test
59#include <QtGui/qtreeview.h> // en test
60
61#include <stdlib.h>
62
63static G4bool ConvertStringToInt(const char*,int&);
64//static void ExecuteChangeSizeFunction(Widget);
65
66static G4bool exitSession = true;
67static G4bool exitPause = true;
68static G4bool exitHelp = true;
69/***************************************************************************/
70/**
71 Build a Qt window with a menubar, output area and promt area
72      +-----------------------+
73      |exit menu|             |
74      |                       |
75      | +-------------------+ |
76      | |                   | |
77      | |  Output area      | |
78      | |                   | |
79      | +-------------------+ |
80      |     | clear |         |
81      | +-------------------+ |
82      | |  promt history    | |
83      | +-------------------+ |
84      | +-------------------+ |
85      | |> promt area       | |
86      | +-------------------+ |
87      +-----------------------+
88*/
89
90G4UIQt::G4UIQt (
91 int argc,
92 char** argv
93)
94/***************************************************************************/
95/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
96{
97  G4Qt* interactorManager = G4Qt::getInstance ();
98  G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP
99  if(UI!=NULL) UI->SetSession(this); // TO KEEP
100
101  fMainWindow = new QMainWindow();
102  fMainWindow->setWindowTitle( "G4UI Session" );
103
104  QWidget* central = new QWidget();
105
106  /*
107    QSplitter *splitter = new QSplitter(Qt::Vertical,central);
108    splitter->setMaximumSize(800,800);
109    QListView *listview = new QListView;
110    listview->setMaximumSize(800,800);
111    QTreeView *treeview = new QTreeView;
112    treeview->setMaximumSize(800,800);
113  */
114  QTextEdit *textedit = new QTextEdit;
115  //  textedit->setMaximumSize(800,800);
116  QPushButton *clearButton = new QPushButton("clear");
117 
118  QVBoxLayout *layout = new QVBoxLayout;
119  layout->addWidget(textedit);
120  layout->addWidget(clearButton);
121  central->setLayout(layout);
122  /*
123    QSizePolicy *test = new QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
124    if (splitter->sizePolicy().horizontalPolicy () == test->horizontalPolicy () ) {
125    printf ("splitter H is fixed\n");
126    }
127   
128    printf("list SP H: %d\n",listview->sizePolicy().horizontalPolicy ());
129    printf("list SP V: %d\n",listview->sizePolicy().verticalPolicy ());
130    printf("tree SP H: %d\n",treeview->sizePolicy().horizontalPolicy ());
131    printf("tree SP V: %d\n",treeview->sizePolicy().verticalPolicy ());
132    printf("text SP H: %d\n",textedit->sizePolicy().horizontalPolicy ());
133    printf("text SP V: %d\n",textedit->sizePolicy().verticalPolicy ());
134   
135    splitter->addWidget(listview);
136    splitter->addWidget(treeview);
137    splitter->addWidget(textedit);
138  */
139  fMainWindow->setCentralWidget(central);
140
141  //////////////
142//  fMainWindow->resize(600,400);
143//   QWidget* central = new QWidget();
144//   QWidget* topWidget = new QWidget();
145//   QWidget* bottomWidget = new QWidget();
146//   QVBoxLayout* vBox1 = new QVBoxLayout(topWidget);
147//   QVBoxLayout* vBox2 = new QVBoxLayout(bottomWidget);
148
149//   QSplitter *splitter = new QSplitter(Qt::Vertical);
150//   fTextArea = new QTextEdit();
151//   fCommandHistoryArea = new QTextEdit();
152//   fCommandLabel = new QLabel();
153
154//   QPushButton *clearButton = new QPushButton("clear");
155//   connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback()));
156
157//   fTextArea->setReadOnly(true);
158//   fCommandHistoryArea->setReadOnly(true);
159
160// //  QMenu *menuFile = new QMenu("File");
161// //  fMainWindow->menuBar()->addMenu(menuFile);
162
163//   fCommandArea = new QLineEdit();
164//   connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
165
166//   vBox1->addWidget(fTextArea);
167//   vBox1->addWidget(clearButton);
168//   vBox1->setStretchFactor(fTextArea,1);
169
170//   vBox2->addWidget(fCommandHistoryArea);
171//   vBox2->addWidget(fCommandLabel);
172//   vBox2->addWidget(fCommandArea);
173//   vBox2->setStretchFactor(fCommandHistoryArea,1);
174
175//   splitter->addWidget(topWidget);
176//   splitter->addWidget(bottomWidget);
177
178//   fMainWindow->setCentralWidget(central);
179////////////////
180
181//  QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor();
182
183//   if(getenv("XENVIRONMENT")==NULL) {
184//     XrmDatabase database = XrmGetDatabase(XtDisplay(top));
185//     if(database!=NULL) {
186//       XrmPutLineResource(&database,"*topShadowColor:white");
187//       XrmPutLineResource(&database,"*bottomShadowColor:black");
188//       XrmPutLineResource(&database,"*foreground:black");
189//       XrmPutLineResource(&database,"*background:lightgrey");
190//       XrmPutLineResource(&database,"*borderColor:lightgrey");
191//       XrmPutLineResource(&database,"*fontList:-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1");
192//       XrmPutLineResource(&database,"*text.background:white");
193//       XrmPutLineResource(&database,"*text.fontList:*courier*-r-*--14-*");
194//       XrmPutLineResource(&database,"*text.maxLength:8000");
195//     }
196//   }
197
198//   Arg args[9];
199//   XtSetArg(args[0],XmNkeyboardFocusPolicy,XmPOINTER); // For completion.
200//   shell = XtAppCreateShell ("G4UIXm","G4UIXm",
201//                          topLevelShellWidgetClass,XtDisplay(top),
202//                          args,1);
203//   form = XmCreateForm (shell,(char*)"form",NULL,0);
204//   XtManageChild (form);
205
206//   XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_FORM);
207//   XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
208//   XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
209//   menuBar = XmCreateMenuBar (form,(char*)"menuBar",args,3);
210
211//   XtSetArg(args[0],XmNtopAttachment      ,XmATTACH_NONE);
212//   XtSetArg(args[1],XmNleftAttachment     ,XmATTACH_FORM);
213//   XtSetArg(args[2],XmNrightAttachment    ,XmATTACH_FORM);
214//   XtSetArg(args[3],XmNbottomAttachment   ,XmATTACH_FORM);
215//   command = XmCreateCommand (form,(char*)"command",args,4);
216//   XtManageChild (command);
217
218//   XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_NONE);
219//   XtSetArg(args[1],XmNleftAttachment  ,XmATTACH_FORM);
220//   XtSetArg(args[2],XmNrightAttachment ,XmATTACH_FORM);
221//   XtSetArg(args[3],XmNbottomAttachment,XmATTACH_WIDGET);
222//   XtSetArg(args[4],XmNbottomWidget    ,command);
223//   XmString cps = XmStringLtoRCreate((char*)"Clear",XmSTRING_DEFAULT_CHARSET);
224//   XtSetArg (args[5],XmNlabelString,cps);
225//   Widget clearButton = XmCreatePushButton(form,(char*)"clearButton",args,6);
226//   XmStringFree (cps);
227//   XtManageChild (clearButton);
228
229//   XtSetArg(args[0],XmNtopAttachment   ,XmATTACH_WIDGET);
230//   XtSetArg(args[1],XmNtopWidget       ,menuBar);
231//   XtSetArg(args[2],XmNleftAttachment  ,XmATTACH_FORM);
232//   XtSetArg(args[3],XmNrightAttachment ,XmATTACH_FORM);
233//   XtSetArg(args[4],XmNbottomAttachment,XmATTACH_WIDGET);
234//   XtSetArg(args[5],XmNbottomWidget    ,clearButton);
235//   XtSetArg(args[6],XmNeditMode        ,XmMULTI_LINE_EDIT);
236//   XtSetArg(args[7],XmNrows            ,12);
237//   XtSetArg(args[8],XmNcolumns         ,80);
238//   text = XmCreateSGcrolledText (form,(char*)"text",args,9);
239//   XtManageChild (text);
240
241//   XtAddCallback(clearButton,XmNactivateCallback,
242//              clearButtonCallback,(XtPointer)text);
243//   XtAddCallback(command,XmNcommandEnteredCallback,
244//              commandEnteredCallback,(XtPointer)this);
245
246//   Widget commandText = XmCommandGetChild(command,XmDIALOG_COMMAND_TEXT);
247//   XtAddEventHandler(commandText,KeyPressMask,False,keyHandler,(XtPointer)this);
248
249//   XtRealizeWidget(shell);
250//   XtMapWidget(shell);
251
252  if(UI!=NULL) UI->SetCoutDestination(this);  // TO KEEP
253}
254/***************************************************************************/
255G4UIQt::~G4UIQt(
256)
257/***************************************************************************/
258/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
259{
260  G4UImanager* UI = G4UImanager::GetUIpointer();  // TO KEEP
261  if(UI!=NULL) {  // TO KEEP
262    UI->SetSession(NULL);  // TO KEEP
263    UI->SetCoutDestination(NULL);  // TO KEEP
264  }
265
266 
267  if (fMainWindow!=NULL)
268    delete fMainWindow;
269}
270/***************************************************************************/
271/*
272    Start the Qt main loop
273 */
274G4UIsession* G4UIQt::SessionStart (
275)
276/***************************************************************************/
277/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
278{
279
280  G4Qt* interactorManager = G4Qt::getInstance ();
281  fMainWindow->show();
282  Prompt("session");
283  exitSession = false;
284
285
286  printf("disable secondary loop\n");
287  interactorManager->DisableSecondaryLoop (); // TO KEEP
288  ((QApplication*)interactorManager->GetMainInteractor())->exec();
289  // on ne passe pas le dessous ? FIXME ????
290
291
292
293
294
295
296//   void* event; // TO KEEP
297//   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
298//     interactorManager->DispatchEvent(event); // TO KEEP
299//     if(exitSession==true) break; // TO KEEP
300//   } // TO KEEP
301   interactorManager->EnableSecondaryLoop (); // TO KEEP
302  printf("enable secondary loop\n");
303  return this; // TO KEEP
304}
305/***************************************************************************/
306
307/**
308  Display the prompt in the prompt area
309 */
310void G4UIQt::Prompt (
311 G4String aPrompt
312)
313/***************************************************************************/
314/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
315{
316  //  fCommandLabel->setText((char*)aPrompt.data());
317}
318/***************************************************************************/
319void G4UIQt::SessionTerminate (
320)
321/***************************************************************************/
322/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
323{
324}
325/***************************************************************************/
326void G4UIQt::PauseSessionStart (
327 G4String a_state
328)
329/***************************************************************************/
330/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
331{
332  if(a_state=="G4_pause> ") {  // TO KEEP
333    SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
334  } // TO KEEP
335
336  if(a_state=="EndOfEvent") { // TO KEEP
337    // Picking with feed back in event data Done here !!!
338    SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
339  } // TO KEEP
340}
341/***************************************************************************/
342void G4UIQt::SecondaryLoop (
343 G4String a_prompt
344)
345/***************************************************************************/
346/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
347{
348  G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
349  Prompt(a_prompt); // TO KEEP
350  exitPause = false; // TO KEEP
351  void* event; // TO KEEP
352  while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
353    interactorManager->DispatchEvent(event); // TO KEEP
354    if(exitPause==true) break; // TO KEEP
355  } // TO KEEP
356  Prompt("session"); // TO KEEP
357}
358/***************************************************************************/
359/**
360  Receive a cout from Geant4. We have to display it in the cout zone
361 */
362G4int G4UIQt::ReceiveG4cout (
363 G4String a_string
364)
365/***************************************************************************/
366/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
367{
368  //  fTextArea->append((char*)a_string.data());
369  return 0;
370}
371/***************************************************************************/
372/**
373  Receive a cerr from Geant4. We have to display it in the cout zone
374 */
375G4int G4UIQt::ReceiveG4cerr (
376 G4String a_string
377)
378/***************************************************************************/
379/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
380{
381  //  fTextArea->append((char*)a_string.data());
382  return 0;
383}
384/***************************************************************************/
385G4bool G4UIQt::GetHelpChoice(
386 G4int& aInt
387)
388/***************************************************************************/
389/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
390{
391//   fHelp = true; // TO KEEP
392//   // SecondaryLoop : // TO KEEP
393//   G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
394//   Prompt("Help"); // TO KEEP
395//   exitHelp = false; // TO KEEP
396//   void* event; // TO KEEP
397//   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
398//     interactorManager->DispatchEvent(event); // TO KEEP
399//     if(exitHelp==true) break; // TO KEEP
400//   } // TO KEEP
401//   Prompt("session"); // TO KEEP
402//   // // TO KEEP
403//   if(fHelp==false) return false; // TO KEEP
404//   aInt = fHelpChoice; // TO KEEP
405//   fHelp = false; // TO KEEP
406//   return true; // TO KEEP
407}
408/***************************************************************************/
409void G4UIQt::ExitHelp(
410)
411/***************************************************************************/
412/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
413{
414}
415/***************************************************************************/
416void G4UIQt::AddMenu (
417 const char* a_name
418,const char* a_label
419)
420/***************************************************************************/
421/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
422{
423//   if(menuBar==NULL) return;
424//   if(a_name==NULL) return;
425//   if(a_label==NULL) return;
426//   XtManageChild (menuBar);
427//   // Pulldown menu :
428//   Widget widget;
429//   widget = XmCreatePulldownMenu (menuBar,(char*)a_name,NULL,0);
430//   AddInteractor (a_name,(G4Interactor)widget);
431//   // Cascade button :
432//   Arg args[2];
433//   XmString cps = XmStringLtoRCreate((char*)a_label,XmSTRING_DEFAULT_CHARSET);
434//   XtSetArg (args[0],XmNlabelString,cps);
435//   XtSetArg (args[1],XmNsubMenuId,widget);
436//   widget = XmCreateCascadeButton (menuBar,(char*)a_name,args,2);
437//   XmStringFree (cps);
438//   XtManageChild (widget);
439//   ExecuteChangeSizeFunction(form);
440}
441/***************************************************************************/
442void G4UIQt::AddButton (
443 const char* a_menu
444,const char* a_label
445,const char* a_command
446)
447/***************************************************************************/
448/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
449{
450//   if(a_menu==NULL) return; // TO KEEP
451//   if(a_label==NULL) return; // TO KEEP
452//   if(a_command==NULL) return; // TO KEEP
453//   Widget parent = (Widget)GetInteractor(a_menu);
454//   if(parent==NULL) return;
455//   Widget widget = XmCreatePushButton(parent,(char*)a_label,NULL,0);
456//   XtManageChild (widget);
457//   XtAddCallback (widget,XmNactivateCallback,ButtonCallback,(XtPointer)this);
458//   commands[widget] = a_command;
459}
460// /***************************************************************************/
461// G4String G4UIXm::GetCommand (
462//  Widget a_widget
463// )
464// /***************************************************************************/
465// /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
466// {
467//   return commands[a_widget];
468// }
469/***************************************************************************/
470/***************************************************************************/
471/***************************************************************************/
472
473/**
474  Callback call when "enter" clicked on the command zone.
475  Send the command to geant4
476 */
477// TODO !
478void G4UIQt::commandEnteredCallback (
479)
480/***************************************************************************/
481/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
482{
483  /*   fCommandHistoryArea->append(fCommandArea->text());
484   G4String command (fCommandArea->text().toStdString().c_str());
485   if(fHelp==true) {
486     exitHelp = true;
487     fHelp = ConvertStringToInt(command.data(),fHelpChoice);
488   } else {
489     ApplyShellCommand (command,exitSession,exitPause);
490   }
491   fCommandArea->setText("");
492  */
493}
494// /***************************************************************************/
495// void G4UIXm::keyHandler (
496//  Widget a_widget
497// ,XtPointer a_tag
498// ,XEvent* a_event
499// ,Boolean*
500// )
501// /***************************************************************************/
502// /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
503// {
504//   KeySym keySym;
505//   XLookupString(&(a_event->xkey),NULL,0,&keySym,NULL);
506//   if(keySym!=XK_Tab) return;
507//   G4UIXm* This = (G4UIXm*)a_tag;
508//   char* s = XmTextGetString(a_widget);
509//   G4String ss = This->Complete(s);
510//   XmTextSetString(a_widget,(char*)ss.data());
511//   XtFree(s);
512//   XmTextSetInsertionPosition(a_widget,XmTextGetLastPosition(a_widget));
513//}
514
515 /***************************************************************************/
516void G4UIQt::clearButtonCallback (
517)
518/***************************************************************************/
519/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
520{
521  //  fTextArea->clear();
522}
523
524/***************************************************************************/
525// TODO !
526//void G4UIQt::ButtonCallback (
527// Widget a_widget
528//,XtPointer a_tag
529//,XtPointer
530//)
531/***************************************************************************/
532/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
533//{
534//   G4UIXm* This = (G4UIXm*)a_tag;
535//   if(This->fHelp==true) return; // Disabled when in help.
536//   G4String ss = This->GetCommand (a_widget);
537//   //printf ("debug : execute:\n%s\n",ss.data());
538//   This->ApplyShellCommand(ss,exitSession,exitPause);
539//}
540/***************************************************************************/
541/***************************************************************************/
542/***************************************************************************/
543// char* XmConvertCompoundStringToString (
544//  XmString a_cps
545// ,int a_number
546// )
547// /***************************************************************************/
548// /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
549// {
550//   if(a_cps==NULL) return NULL;
551//   char* ss = NULL;
552//   XmStringContext context;
553//   XmStringInitContext(&context,a_cps);
554//   int icount = 0;
555//   Boolean Done = False;
556//   while(Done==False) { 
557//     char* text = NULL;
558//     XmStringCharSet charset = NULL;
559//     XmStringDirection direct;
560//     Boolean sep;
561//     if(XmStringGetNextSegment(context,&text,&charset,&direct,&sep)==True) {
562//       XtFree(charset);
563//       if(sep==True) Done = True;
564//       if(icount==a_number) {
565//      ss = text;
566//      break;
567//       }
568//       icount++;
569//       XtFree(text);
570//     }
571//     else
572//       Done = True;
573//   }
574//   XmStringFreeContext(context);
575//   return ss;
576//}
577//////////////////////////////////////////////////////////////////////////////
578G4bool ConvertStringToInt(
579 const char* aString
580,int& aInt
581)
582//////////////////////////////////////////////////////////////////////////////
583//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
584{
585  aInt = 0; // TO KEEP
586  if(aString==NULL) return false; // TO KEEP
587  char* s; // TO KEEP
588  long value = strtol(aString,&s,10); // TO KEEP
589  if(s==aString) return false; // TO KEEP
590  aInt = value; // TO KEEP
591  return true; // TO KEEP
592}
593#include <X11/IntrinsicP.h>
594//////////////////////////////////////////////////////////////////////////////
595// void ExecuteChangeSizeFunction (
596//  Widget aWidget
597// )
598// //////////////////////////////////////////////////////////////////////////////
599// //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
600// {
601//   if(aWidget==NULL) return;
602//   if(aWidget->core.widget_class->core_class.resize==NULL) return;
603//   (aWidget->core.widget_class->core_class.resize)(aWidget);
604// }
605
606
607#endif
Note: See TracBrowser for help on using the repository browser.