Changeset 501


Ignore:
Timestamp:
Jun 12, 2007, 10:34:32 AM (17 years ago)
Author:
garnier
Message:

r605@mac-90108: laurentgarnier | 2007-06-12 10:37:44 +0200
pb sur les menus, voici une version bien bancale

Location:
trunk/geant4/interfaces/basic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/interfaces/basic/include/G4UIQt.hh

    r494 r501  
    110110  QTextEdit *fTextArea;
    111111  QTextEdit *fCommandHistoryArea;
     112  std::vector <QString*> menuName;
     113  std::vector <QString*> menuLabel;
    112114
    113115private slots :
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r500 r501  
    6161
    6262static G4bool ConvertStringToInt(const char*,int&);
    63 //static void ExecuteChangeSizeFunction(Widget);
    6463
    6564static G4bool exitSession = true;
     
    145144
    146145
    147   //  QMenu *menuFile = new QMenu("File");
    148   //  fMainWindow->menuBar()->addMenu(menuFile);
    149 
     146  QMenu *fileMenu = fMainWindow->menuBar()->addMenu(tr("&File"));
     147  fileMenu->addAction("Quitter", this, SLOT(fMainWindow->close()));
     148  fileMenu->addAction("Quitter2", this, SLOT(fMainWindow->close()));
     149  fileMenu->addSeparator();
    150150
    151151
     
    301301/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    302302{
     303  printf("G4UIQt::PauseSessionStart\n");
    303304  if(a_state=="G4_pause> ") {  // TO KEEP
    304305    SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
     
    317318/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    318319{
     320  printf("G4UIQt::SecondaryLoop\n");
    319321  G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
    320322  Prompt(a_prompt); // TO KEEP
     
    355357  fTextArea->append(QString((char*)a_string.data()).trimmed());
    356358  fTextArea->setTextColor(previousColor);
     359  fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
    357360  return 0;
    358361}
     
    364367/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    365368{
    366 //   fHelp = true; // TO KEEP
     369  printf("G4UIQt::GetHelpChoice\n");
     370 
     371  fHelp = true; // TO KEEP
    367372//   // SecondaryLoop : // TO KEEP
    368 //   G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
    369 //   Prompt("Help"); // TO KEEP
    370 //   exitHelp = false; // TO KEEP
    371 //   void* event; // TO KEEP
    372 //   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
    373 //     interactorManager->DispatchEvent(event); // TO KEEP
    374 //     if(exitHelp==true) break; // TO KEEP
    375 //   } // TO KEEP
    376 //   Prompt("session"); // TO KEEP
    377 //   // // TO KEEP
    378 //   if(fHelp==false) return false; // TO KEEP
    379 //   aInt = fHelpChoice; // TO KEEP
    380 //   fHelp = false; // TO KEEP
    381 //   return true; // TO KEEP
     373  G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
     374  Prompt("Help"); // TO KEEP
     375  exitHelp = false; // TO KEEP
     376  void* event; // TO KEEP
     377  while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
     378    interactorManager->DispatchEvent(event); // TO KEEP
     379    if(exitHelp==true) break; // TO KEEP
     380  } // TO KEEP
     381  Prompt("session"); // TO KEEP
     382  // // TO KEEP
     383  if(fHelp==false) return false; // TO KEEP
     384  aInt = fHelpChoice; // TO KEEP
     385  fHelp = false; // TO KEEP
     386  return true; // TO KEEP
    382387}
    383388/***************************************************************************/
     
    387392/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    388393{
    389 }
     394  printf("G4UIQt::ExitHelp\n");
     395}
     396
    390397/***************************************************************************/
    391398void G4UIQt::AddMenu (
     
    396403/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    397404{
     405  printf("G4UIQt::AddMenu %s %s\n",a_name,a_label);
     406  QString *name = new QString(a_name);
     407  QString *label = new QString(a_label);
     408  menuName.push_back(name);
     409  menuLabel.push_back(label);
     410
     411  //  QMenu *menu = new QMenu("test");//a_label);
     412  //  fMainWindow->menuBar()->addMenu(menu);
     413
    398414//   if(menuBar==NULL) return;
    399415//   if(a_name==NULL) return;
     
    423439/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    424440{
     441  printf("G4UIQt::AddButton %s %s %s\n",a_menu,a_label,a_command);
    425442//   if(a_menu==NULL) return; // TO KEEP
    426443//   if(a_label==NULL) return; // TO KEEP
     
    468485  fCommandArea->setText("");
    469486}
    470 // /***************************************************************************/
    471 // void G4UIXm::keyHandler (
    472 //  Widget a_widget
    473 // ,XtPointer a_tag
    474 // ,XEvent* a_event
    475 // ,Boolean*
    476 // )
    477 // /***************************************************************************/
    478 // /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    479 // {
    480 //   KeySym keySym;
    481 //   XLookupString(&(a_event->xkey),NULL,0,&keySym,NULL);
    482 //   if(keySym!=XK_Tab) return;
    483 //   G4UIXm* This = (G4UIXm*)a_tag;
    484 //   char* s = XmTextGetString(a_widget);
    485 //   G4String ss = This->Complete(s);
    486 //   XmTextSetString(a_widget,(char*)ss.data());
    487 //   XtFree(s);
    488 //   XmTextSetInsertionPosition(a_widget,XmTextGetLastPosition(a_widget));
    489 //}
    490487
    491488 /***************************************************************************/
     
    498495}
    499496
    500 /***************************************************************************/
    501 // TODO !
    502 //void G4UIQt::ButtonCallback (
    503 // Widget a_widget
    504 //,XtPointer a_tag
    505 //,XtPointer
    506 //)
    507 /***************************************************************************/
    508 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    509 //{
    510 //   G4UIXm* This = (G4UIXm*)a_tag;
    511 //   if(This->fHelp==true) return; // Disabled when in help.
    512 //   G4String ss = This->GetCommand (a_widget);
    513 //   //printf ("debug : execute:\n%s\n",ss.data());
    514 //   This->ApplyShellCommand(ss,exitSession,exitPause);
    515 //}
    516 /***************************************************************************/
    517 /***************************************************************************/
    518 /***************************************************************************/
    519 // char* XmConvertCompoundStringToString (
    520 //  XmString a_cps
    521 // ,int a_number
    522 // )
    523 // /***************************************************************************/
    524 // /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    525 // {
    526 //   if(a_cps==NULL) return NULL;
    527 //   char* ss = NULL;
    528 //   XmStringContext context;
    529 //   XmStringInitContext(&context,a_cps);
    530 //   int icount = 0;
    531 //   Boolean Done = False;
    532 //   while(Done==False) { 
    533 //     char* text = NULL;
    534 //     XmStringCharSet charset = NULL;
    535 //     XmStringDirection direct;
    536 //     Boolean sep;
    537 //     if(XmStringGetNextSegment(context,&text,&charset,&direct,&sep)==True) {
    538 //       XtFree(charset);
    539 //       if(sep==True) Done = True;
    540 //       if(icount==a_number) {
    541 //      ss = text;
    542 //      break;
    543 //       }
    544 //       icount++;
    545 //       XtFree(text);
    546 //     }
    547 //     else
    548 //       Done = True;
    549 //   }
    550 //   XmStringFreeContext(context);
    551 //   return ss;
    552 //}
    553497//////////////////////////////////////////////////////////////////////////////
    554498G4bool ConvertStringToInt(
     
    567511  return true; // TO KEEP
    568512}
    569 #include <X11/IntrinsicP.h>
    570 //////////////////////////////////////////////////////////////////////////////
    571 // void ExecuteChangeSizeFunction (
    572 //  Widget aWidget
    573 // )
    574 // //////////////////////////////////////////////////////////////////////////////
    575 // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
    576 // {
    577 //   if(aWidget==NULL) return;
    578 //   if(aWidget->core.widget_class->core_class.resize==NULL) return;
    579 //   (aWidget->core.widget_class->core_class.resize)(aWidget);
    580 // }
    581 
    582513
    583514#endif
Note: See TracChangeset for help on using the changeset viewer.