Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2004, 4:14:47 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: implemented a new SignalHandler, signals for starting and quiting the Gui are now located in OrxonoxGuiExec.
Now thinking about a way to pass options to Orxonox (so the GUI really makes sense)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.cc

    r3297 r3300  
    2727#include <iostream>
    2828#include <string>
     29
     30HashTable* orxonoxFlagHash;
    2931
    3032/**
     
    4244  start = new Button ("Start");
    4345#ifdef HAVE_GTK2
    44   start->connectSignal ("clicked", startOrxonox);
     46  start->connectSignal ("clicked", this, startOrxonox);
    4547#endif /* HAVE_GTK2 */
    4648  execBox->fill (start);
     
    5961  quit = new Button ("Quit");
    6062#ifdef HAVE_GTK2
    61   quit->connectSignal ("clicked", orxonoxGUI->orxonox_gui_quit);
     63  quit->connectSignal ("clicked", this, OrxonoxGuiExec::quitOrxonox);
     64  orxonoxGUI->connectSignal ("destroy", this, OrxonoxGuiExec::quitOrxonox);
     65  //! orxonoxGUI->connectSignal ("delete_event", this, OrxonoxGuiExec::quitOrxonox); \todo fix this to work.
    6266#endif /* HAVE_GTK2 */
    6367  execBox->fill (quit);
     
    294298/**
    295299   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
    296    This is a Signal and can be executed through Widget::signal_connect
    297300   \param widget the widget that executed the start command
    298301   \param data additional data
    299 */
    300 int OrxonoxGuiExec::startOrxonox (GtkWidget* widget, Widget* data)
    301 {
     302
     303   This is a Signal and can be executed through Widget::signal_connect
     304*/
     305int OrxonoxGuiExec::startOrxonox (GtkWidget* widget, void* data)
     306{
     307  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     308  if (exec->shouldsave())
     309    exec->writeToFile (Window::mainWindow);
    302310  cout << "Starting Orxonox" <<endl;
    303 }
    304 #else /* HAVE_GTK2 */
     311  gtk_main_quit();
     312  system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real (coded not over the shell)
     313}
     314
    305315/**
    306316   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
    307    This is a Signal and can be executed through Widget::signal_connect
    308317   \param widget the widget that executed the start command
    309318   \param data additional data
    310 */
    311 int OrxonoxGuiExec::startOrxonox (void* widget, Widget* data)
    312 {
    313   cout << "Starting Orxonox" <<endl;
     319
     320   This is a Signal and can be executed through Widget::signal_connect
     321*/
     322int OrxonoxGuiExec::quitOrxonox (GtkWidget* widget, void* data)
     323{
     324  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     325  PRINT(3)( "Quitting Orxonox %p\n", exec);
     326  if (exec->shouldsave())
     327    exec->writeToFile (Window::mainWindow);
     328  gtk_main_quit();
     329}
     330#else /* HAVE_GTK2 */
     331/**
     332   \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
     333   \param widget the widget that executed the start command
     334   \param data additional data
     335*/
     336int OrxonoxGuiExec::startOrxonox (void* widget, void* data)
     337{
     338  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     339  COUT(3) << "Starting Orxonox" <<endl;
     340  if (exec->shouldsave())
     341    exec->writeToFile (Window::mainWindow);
     342}
     343/**
     344   \brief Quits ORXONOX.
     345   \param widget the widget that executed the Quit command
     346   \param data additional data
     347
     348   This is a Signal and can be executed through Widget::signal_connect
     349*/
     350int OrxonoxGuiExec::quitOrxonox (void* widget, void* data)
     351{
     352  OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     353  COUT(3) << "Quiting Orxonox" <<endl;
     354  if (exec->shouldsave())
     355    exec->writeToFile (Window::mainWindow);
    314356}
    315357
Note: See TracChangeset for help on using the changeset viewer.