Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2005, 12:13:38 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: code-standartisation updated in all files.

  1. member → this→member
  2. function (bla) → function(bla)
  3. other small fixes
File:
1 edited

Legend:

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

    r3313 r3315  
    5050  gdk_threads_init();
    5151#endif /* HAVE_GTHREAD */
    52   gtk_init (&argc, &argv);
     52  gtk_init(&argc, &argv);
    5353  gtk_rc_parse( "rc" );
    5454#endif /* HAVE_GTK2 */
     
    138138   This is still pretty crappy.
    139139*/
    140 Widget::~Widget()
     140Widget::~Widget(void)
    141141{
    142142  this->destroy();
     
    147147   Initializes the next Pointer and the other Widget-specific Defaults.
    148148*/
    149 void Widget::init()
     149void Widget::init(void)
    150150{
    151151  next = NULL;
     
    181181   \brief makes the widget visible.
    182182*/
    183 void Widget::show()
    184 {
    185 #ifdef HAVE_GTK2
    186   gtk_widget_show (this->widget);
     183void Widget::show(void)
     184{
     185#ifdef HAVE_GTK2
     186  gtk_widget_show(this->widget);
    187187#endif /* HAVE_GTK2 */
    188188}
     
    191191   \brief hides the widget.
    192192*/
    193 void Widget::hide()
    194 {
    195 #ifdef HAVE_GTK2
    196   gtk_widget_hide (this->widget);
     193void Widget::hide(void)
     194{
     195#ifdef HAVE_GTK2
     196  gtk_widget_hide(this->widget);
    197197#endif /* HAVE_GTK2 */
    198198}
     
    206206{
    207207#ifdef HAVE_GTK2
    208   gtk_widget_set_usize (this->widget, width, height);
     208  gtk_widget_set_usize(this->widget, width, height);
    209209#endif /* HAVE_GTK2 */
    210210}
     
    237237   \param depth the current depth. if > 0 then the next Widget will also be walked through.
    238238*/
    239 void Widget::walkThrough (void (*function)(Widget*), unsigned int depth)
     239void Widget::walkThrough(void(*function)(Widget*), unsigned int depth)
    240240{
    241241  function(this);
    242242  if (this->isOption < 0)
    243243    {
    244       static_cast<Packer*>(this)->down->walkThrough (function, depth+1);
     244      static_cast<Packer*>(this)->down->walkThrough(function, depth+1);
    245245    }
    246246
     
    255255   \param depth the current depth. if > 0 then the next Widget will also be walked through.
    256256*/
    257 void Widget::walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth)
     257void Widget::walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth)
    258258{
    259259  function(this, data);
     
    270270    \param widget specifies the widget that should be listed
    271271*/
    272 void Widget::listOptionsAndGroups (Widget* widget)
     272void Widget::listOptionsAndGroups(Widget* widget)
    273273{
    274274  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     
    284284    \param widget specifies the widget that should be listed
    285285*/
    286 void Widget::listOptions (Widget* widget)
     286void Widget::listOptions(Widget* widget)
    287287{
    288288  if (widget->isOption >= 1 && widget->isOption <= 3)
     
    297297    \param data A Counter, that always knows how many Options have been found yet.
    298298*/
    299 void Widget::listOptions (Widget* widget, void* data)
     299void Widget::listOptions(Widget* widget, void* data)
    300300{
    301301 
    302302  if (widget->isOption >= 1 && widget->isOption <= 3)
    303303    {
    304       int* count = (int*)data;
     304      int* count =(int*)data;
    305305      *count = *count +1;
    306306      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
     
    308308  else if (widget->isOption == 5)
    309309    {
    310       int* count = (int*)data;
     310      int* count =(int*)data;
    311311      *count = *count +1;
    312312      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     
    315315
    316316/**
    317     \brief Finds an Option by a given number (the n'th option found away from this Widget)
    318     \param number The Count of options to wait (by reference)
     317    \brief Finds an Option by a given number(the n'th option found away from this Widget)
     318    \param number The Count of options to wait(by reference)
    319319    \param depth The depth of the sarch. if 0 it will not search next pointer
    320320   
     
    349349void Widget::listGroups(Widget* widget)
    350350{
    351   if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     351  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    352352    cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
    353353}
     
    356356    \brief This is for listing the Groups of "widget". It also displays the n'th number found.
    357357    \param widget specifies the widget that should be listed
    358     \param data the Counter, that will show the number (this function will raise it by one if a Group is fount.
     358    \param data the Counter, that will show the number(this function will raise it by one if a Group is fount.
    359359*/
    360360void Widget::listGroups(Widget* widget, void* data)
    361361{
    362   if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    363     {
    364       int* count = (int*)data;
     362  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     363    {
     364      int* count =(int*)data;
    365365      *count = *count +1;
    366366      cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n";
     
    369369
    370370/**
    371     \brief Finds a Group by a given number (the n'th Group found away from this Widget)
    372     \param number The Count of options to wait (by reference)
     371    \brief Finds a Group by a given number(the n'th Group found away from this Widget)
     372    \param number The Count of options to wait(by reference)
    373373    \param depth The depth of the sarch. if 0 it will not search next pointer
    374374*/
     
    399399    \param widget specifies the widget that should be set.
    400400*/
    401 void Widget::setOptions (Widget* widget)
     401void Widget::setOptions(Widget* widget)
    402402{
    403403  if (widget->isOption >= 1)
     
    412412  if (widget->isOption>=1)
    413413    {     
    414       Option* option = (Option*)widget;
    415       char* name = (char*)flagName;
     414      Option* option =(Option*)widget;
     415      char* name =(char*)flagName;
    416416      char* value = NULL;
    417417      bool found = false;
    418418      // check if long flag matches
    419       if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) && (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
     419      if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) &&(name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
    420420        {
    421421          found = true;
     
    425425            }
    426426        }
    427       else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&& (name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches
     427      else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&&(name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches
    428428        {
    429429          found = true;
     
    456456    \brief Connect any signal to any given Sub-widget
    457457*/
    458 gulong Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    459 {
    460   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL);
     458gulong Widget::connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void *))
     459{
     460  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), NULL);
    461461}
    462462
     
    464464   \brief Connect a signal with additionally passing the whole Object
    465465*/
    466 gulong Widget::connectSignal (char* event, gint (*signal)( GtkWidget*, Widget *))
    467 {
    468   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), this);
     466gulong Widget::connectSignal(char* event, gint(*signal)( GtkWidget*, Widget *))
     467{
     468  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), this);
    469469}
    470470
     
    472472   \brief Connect a signal with additionally passing a whole external Object
    473473*/
    474 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    475 {
    476   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     474gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void *))
     475{
     476  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
    477477}
    478478
     
    480480   \brief Connect a signal with additionally passing a whole external Object
    481481*/
    482 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, void *))
    483 {
    484   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     482gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void *))
     483{
     484  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
    485485}
    486486
     
    488488   \brief Connect a signal with additionally passing a whole external Object
    489489*/
    490 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *))
    491 {
    492   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
    493 }
    494 
    495 void Widget::disconnectSignal (gulong signalID)
    496 {
    497   g_signal_handler_disconnect (G_OBJECT (this->widget), signalID);
     490gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void *))
     491{
     492  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
     493}
     494
     495void Widget::disconnectSignal(gulong signalID)
     496{
     497  g_signal_handler_disconnect(G_OBJECT(this->widget), signalID);
    498498}
    499499
     
    504504   \param nothing nothin.
    505505*/
    506 gint Widget::doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing)
     506gint Widget::doNothingSignal(GtkWidget *widget, GdkEvent* event, void* nothing)
    507507{
    508508}
     
    519519   Sets the down-pinter to NULL and other PackerSpecific-values to their defaults.
    520520*/
    521 void Packer::init (void)
    522 {
    523   down = NULL;
    524   groupName = NULL;
     521void Packer::init(void)
     522{
     523  this->down = NULL;
     524  this->groupName = NULL;
    525525
    526526
     
    536536  PRINTF(4)("deleting the Packer part.\n");
    537537 
    538   if (groupName)
    539     delete []groupName;
     538  if (this->groupName)
     539    delete []this->groupName;
    540540
    541541  //deleting recursively.
     
    551551   \param name The name of the group.
    552552*/
    553 void Packer::setGroupName (char* name)
    554 {
    555   if (groupName)
    556     delete groupName;
    557   groupName = new char [strlen(name)+1];
    558   strcpy(groupName, name);
     553void Packer::setGroupName(char* name)
     554{
     555  if (this->groupName)
     556    delete []this->groupName;
     557  this->groupName = new char[strlen(name)+1];
     558  strcpy(this->groupName, name);
    559559}
    560560
     
    563563   \returns name The name of the group.
    564564*/
    565 char* Packer::getGroupName (void)
    566 {
    567   return groupName;
     565char* Packer::getGroupName(void)
     566{
     567  return this->groupName;
    568568}
    569569
     
    575575   sets the Container-Specific defaults.
    576576*/
    577 void Container::init (void)
    578 {
    579   isOption = -1;
     577void Container::init(void)
     578{
     579  this->isOption = -1;
    580580
    581581  static_cast<Packer*>(this)->init();
     
    600600   It does this by filling up the down pointer only if down points to NULL.
    601601*/
    602 void Container::fill (Widget *lowerWidget)
     602void Container::fill(Widget *lowerWidget)
    603603{
    604604  if (this->down == NULL)
    605605    {
    606606#ifdef HAVE_GTK2
    607       gtk_container_add (GTK_CONTAINER (this->widget), lowerWidget->widget);
     607      gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget);
    608608#endif /* HAVE_GTK2 */
    609609      this->down = lowerWidget;
     
    613613}
    614614
    615 // gtk_container_set_border_width (GTK_CONTAINER (widget), 5);
     615// gtk_container_set_border_width(GTK_CONTAINER(widget), 5);
    616616
    617617/* WINDOW */
     
    622622   \brief Adds a new Window Windows to the List of Windows.
    623623   \param windowToAdd The Windows that should be added to the List
    624    \todo this instead of windowToAdd (possibly)
     624   \todo this instead of windowToAdd(possibly)
    625625*/
    626626void Window::addWindow(Window* windowToAdd)
     
    633633
    634634  Widget* tmpWindow = mainWindow;
    635   while (tmpWindow->next)
     635  while(tmpWindow->next)
    636636    tmpWindow = tmpWindow->next;
    637637  tmpWindow->next = windowToAdd;
     
    644644   \brief Creating a new Window without a Name
    645645*/
    646 Window::Window (void)
     646Window::Window(void)
    647647{
    648648  this->init();
     
    654654*/
    655655
    656 Window::Window (char* windowName)
     656Window::Window(char* windowName)
    657657{
    658658  this->init();
    659   this->setTitle (windowName);
     659  this->setTitle(windowName);
    660660}
    661661
     
    671671   \brief initializes a new Window
    672672*/
    673 void Window::init()
     673void Window::init(void)
    674674{
    675675  if (!mainWindow)
     
    681681
    682682#ifdef HAVE_GTK2
    683   widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    684   gtk_window_set_policy (GTK_WINDOW(widget), TRUE, TRUE, TRUE);
     683  widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     684  gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE);
    685685#if !defined(__WIN32__)
    686   //  gtk_window_set_decorated (GTK_WINDOW (widget), FALSE);
     686  //  gtk_window_set_decorated(GTK_WINDOW(widget), FALSE);
    687687#endif
    688   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     688  gtk_container_set_border_width(GTK_CONTAINER(widget), 3);
    689689#endif /* HAVE_GTK2 */
    690690}
     
    708708   \brief Shows all Widgets that are included within this->widget.
    709709*/
    710 void Window::showall ()
    711 {
    712   if (!isOpen)
    713     {
    714       //      printf ("showall\n");
    715 #ifdef HAVE_GTK2
    716       gtk_widget_show_all  (widget);
     710void Window::showall(void)
     711{
     712  if (!this->isOpen)
     713    {
     714      //      printf("showall\n");
     715#ifdef HAVE_GTK2
     716      gtk_widget_show_all(this->widget);
    717717#endif /* HAVE_GTK2 */
    718      isOpen = true;
     718     this->isOpen = true;
    719719    }
    720720  else
    721721    {
    722       //      printf ("showone\n");
    723 #ifdef HAVE_GTK2
    724       gtk_widget_show (widget);
     722      //      printf("showone\n");
     723#ifdef HAVE_GTK2
     724      gtk_widget_show(this->widget);
    725725#endif /* HAVE_GTK2 */
    726726    }
     
    731731   \param title title the Window should get.
    732732*/
    733 void Window::setTitle (char* title)
     733void Window::setTitle(char* title)
    734734{
    735735  if (this->title)
     
    738738  strcpy(this->title, title);
    739739#ifdef HAVE_GTK2
    740   gtk_window_set_title (GTK_WINDOW (widget), title);
     740  gtk_window_set_title(GTK_WINDOW(widget), title);
    741741#endif /* HAVE_GTK2 */
    742742}
     
    745745   \brief opens up a Window and fixes the Focus to it
    746746*/
    747 void Window::open()
     747void Window::open(void)
    748748{
    749749  if (this != mainWindow)
     
    751751      isOpen = true;
    752752#ifdef HAVE_GTK2
    753       gtk_widget_show_all(widget);
    754       gtk_grab_add(widget);
     753      gtk_widget_show_all(this->widget);
     754      gtk_grab_add(this->widget);
    755755#endif /* HAVE_GTK2 */
    756756    }
     
    760760   \brief closes up a Window and removes the Focus from it
    761761*/
    762 void Window::close()
     762void Window::close(void)
    763763{
    764764  if (this != mainWindow)
    765765    {
    766       isOpen = false;
    767 #ifdef HAVE_GTK2
    768       gtk_grab_remove(widget);
    769       gtk_widget_hide (widget);
    770 #endif /* HAVE_GTK2 */
    771     }
    772 }
    773 
    774 #ifdef HAVE_GTK2
    775 /**
    776    \brief opens up a window (not topmost Window).
     766      this->isOpen = false;
     767#ifdef HAVE_GTK2
     768      gtk_grab_remove(this->widget);
     769      gtk_widget_hide(this->widget);
     770#endif /* HAVE_GTK2 */
     771    }
     772}
     773
     774#ifdef HAVE_GTK2
     775/**
     776   \brief opens up a window(not topmost Window).
    777777   this is the Signal that does it. !!SIGNALS ARE STATIC!!
    778778   \param widget the widget that did it.
     
    780780   \param window the Window that should be opened
    781781*/
    782 gint Window::windowOpen (GtkWidget *widget, GdkEvent* event, void* window)
     782gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window)
    783783{
    784784  static_cast<Window*>(window)->open();
     
    786786
    787787/**
    788    \brief closes a window (not topmost Window).
     788   \brief closes a window(not topmost Window).
    789789   this is the Signal that does it. !!SIGNALS ARE STATIC!!
    790790   \param widget the widget that did it!
     
    792792   \param window the Window that should be closed
    793793*/
    794 gint Window::windowClose (GtkWidget *widget, GdkEvent* event, void* window)
     794gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window)
    795795{
    796796  static_cast<Window*>(window)->close();
     
    805805    \brief Creates a new Frame without a name
    806806*/
    807 Frame::Frame (void)
     807Frame::Frame(void)
    808808{
    809809  this->init();
     
    813813   \brief Creates a new Frame with name title
    814814*/
    815 Frame::Frame (char* title)
     815Frame::Frame(char* title)
    816816{
    817817  this->init();
     
    822822   \brief destrcucts a Frame
    823823*/
    824 Frame::~Frame()
     824Frame::~Frame(void)
    825825{
    826826  this->destroy();
     
    830830    \brief Initializes a new Frame with default settings
    831831*/
    832 void Frame::init()
     832void Frame::init(void)
    833833{
    834834  static_cast<Container*>(this)->init();
    835835
    836836#ifdef HAVE_GTK2
    837   widget = gtk_frame_new ("");
    838   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     837  this->widget = gtk_frame_new("");
     838  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    839839#endif /* HAVE_GTK2 */
    840840}
     
    857857   \param title The title the Frame should get.
    858858*/
    859 void Frame::setTitle (char* title)
     859void Frame::setTitle(char* title)
    860860{
    861861  if (this->title)
     
    864864  strcpy(this->title, title);
    865865#ifdef HAVE_GTK2
    866   gtk_frame_set_label (GTK_FRAME (widget), title);
     866  gtk_frame_set_label(GTK_FRAME(widget), title);
    867867#endif /* HAVE_GTK2 */
    868868}
     
    873873   \brief Creates a new EventBox with default settings.
    874874*/
    875 EventBox::EventBox (void)
     875EventBox::EventBox(void)
    876876{
    877877  this->init();
     
    880880/**
    881881   \brief Creates a new EventBox with name title
    882    \param title title the Eventbox should get (only data-structure-internal)
    883 */
    884 EventBox::EventBox (char* title)
     882   \param title title the Eventbox should get(only data-structure-internal)
     883*/
     884EventBox::EventBox(char* title)
    885885{
    886886  this->init();
     
    902902void EventBox::init(void)
    903903{
    904   isOption = -1;
     904  this->isOption = -1;
    905905
    906906  static_cast<Container*>(this)->init();
    907907
    908908#ifdef HAVE_GTK2
    909   widget = gtk_event_box_new ();
    910   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     909  this->widget = gtk_event_box_new();
     910  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    911911#endif /* HAVE_GTK2 */
    912912}
     
    926926
    927927/**
    928    \brief Sets the Title of the EventBox (not implemented)
    929    \param title Name the EventBox should get (only datastructure-internal).
    930 */
    931 void EventBox::setTitle (char* title)
     928   \brief Sets the Title of the EventBox(not implemented)
     929   \param title Name the EventBox should get(only datastructure-internal).
     930*/
     931void EventBox::setTitle(char* title)
    932932{
    933933  if (this->title)
     
    942942   \brief Creates a new horizontal Box
    943943*/
    944 Box::Box (void)
     944Box::Box(void)
    945945{
    946946  this->init('h');
     
    951951   \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally
    952952*/
    953 Box::Box (char boxtype)
     953Box::Box(char boxtype)
    954954{
    955955  this->init(boxtype);
     
    970970void Box::init(char boxtype)
    971971{
    972   isOption = -2;
     972  this->isOption = -2;
    973973
    974974  static_cast<Packer*>(this)->init();
     
    976976  if (boxtype == 'v')
    977977    {
    978       widget = gtk_vbox_new (FALSE, 0);
     978      this->widget = gtk_vbox_new(FALSE, 0);
    979979    }
    980980  else
    981981    {
    982       widget = gtk_hbox_new (FALSE, 0);
     982      this->widget = gtk_hbox_new(FALSE, 0);
    983983    }
    984984#endif /* HAVE_GTK2 */
     
    10041004    It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next
    10051005*/
    1006 void Box::fill (Widget *lowerWidget)
    1007 {
    1008 #ifdef HAVE_GTK2
    1009   gtk_box_pack_start (GTK_BOX (this->widget), lowerWidget->widget, TRUE, TRUE, 0);
     1006void Box::fill(Widget* lowerWidget)
     1007{
     1008#ifdef HAVE_GTK2
     1009  gtk_box_pack_start(GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0);
    10101010#endif /* HAVE_GTK2 */
    10111011  if (this->down == NULL)
     
    10151015      Widget* tmp;
    10161016      tmp = this->down;
    1017       while (tmp->next != NULL)
     1017      while(tmp->next != NULL)
    10181018        {
    10191019          tmp = tmp->next;
     
    10411041   sets all Option-Specific-Values to their defaults.
    10421042*/
    1043 void Option::init()
    1044 {
    1045   value = 0;
    1046   flagName = NULL;
    1047   flagNameShort = NULL;
    1048   saveable = false;
    1049   defaultValue = 0;
     1043void Option::init(void)
     1044{
     1045  this->value = 0;
     1046  this->flagName = NULL;
     1047  this->flagNameShort = NULL;
     1048  this->saveable = false;
     1049  this->defaultValue = 0;
    10501050
    10511051  static_cast<Widget*>(this)->init();
     
    10601060{
    10611061  PRINTF(4)("deleting the Option Part.\n");
    1062   if (flagName)
    1063     delete []flagName;
    1064   if (flagNameShort)
    1065     delete []flagNameShort;
     1062  if (this->flagName)
     1063    delete []this->flagName;
     1064  if (this->flagNameShort)
     1065    delete []this->flagNameShort;
    10661066
    10671067  static_cast<Widget*>(this)->destroy();
     
    10721072   !! Options will be saved if flagname is different from NULL !!
    10731073   \param flagname the Name that will be displayed in the output
    1074    \param defaultvalue the default Value for this Option (see definition of defaultvalue
    1075 */
    1076 void Option::setFlagName (char* flagname, int defaultvalue)
    1077 {
    1078   if (flagName)
    1079     delete flagName;
    1080   flagName = new char [strlen(flagname)+1];
    1081   strcpy(flagName, flagname);
    1082   defaultValue = defaultvalue;
     1074   \param defaultvalue the default Value for this Option(see definition of defaultvalue
     1075*/
     1076void Option::setFlagName(char* flagname, int defaultvalue)
     1077{
     1078  if (this->flagName)
     1079    delete this->flagName;
     1080  this->flagName = new char [strlen(flagname)+1];
     1081  strcpy(this->flagName, flagname);
     1082  this->defaultValue = defaultvalue;
    10831083
    10841084  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
     
    10861086
    10871087/**
    1088     \brief see Option::setFlagName (char* flagname, int defaultvalue)
     1088    \brief see Option::setFlagName(char* flagname, int defaultvalue)
    10891089    \param flagname the Name that will be displayed in the output
    1090     \param defaultvalue the default Value for this Option (see definition of defaultvalue
     1090    \param defaultvalue the default Value for this Option(see definition of defaultvalue
    10911091    \param flagnameshort a short flagname to be displayed in the output
    10921092*/
    1093 void Option::setFlagName (char* flagname, char* flagnameshort,  int defaultvalue)
    1094 {
    1095   if (flagName)
    1096     delete flagName;
    1097   flagName = new char [strlen(flagname)+1];
    1098   strcpy(flagName, flagname);
    1099 
    1100   if (flagNameShort)
    1101     delete flagNameShort;
    1102   flagNameShort = new char [strlen(flagnameshort)+1];
    1103   strcpy(flagNameShort, flagnameshort);
    1104   defaultValue = defaultvalue;
     1093void Option::setFlagName(char* flagname, char* flagnameshort,  int defaultvalue)
     1094{
     1095  if (this->flagName)
     1096    delete []this->flagName;
     1097  this->flagName = new char [strlen(flagname)+1];
     1098  strcpy(this->flagName, flagname);
     1099
     1100  if (this->flagNameShort)
     1101    delete []this->flagNameShort;
     1102  this->flagNameShort = new char [strlen(flagnameshort)+1];
     1103  strcpy(this->flagNameShort, flagnameshort);
     1104  this->defaultValue = defaultvalue;
    11051105  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
    11061106}
     
    11371137    \param slider the Slider-Object that should receive the change.
    11381138*/
    1139 gint Option::OptionChange (GtkWidget *widget, Widget* option)
     1139gint Option::OptionChange(GtkWidget *widget, Widget* option)
    11401140{
    11411141  static_cast<Option*>(option)->changeOption();
    1142   flags->setTextFromFlags(orxonoxGUI);  //// must be different !!!
     1142  flags->setTextFromFlags(Window::mainWindow);  //// must be different !!!
    11431143}
    11441144#endif /* HAVE_GTK2 */
     
    11751175
    11761176#ifdef HAVE_GTK2
    1177   widget = gtk_button_new_with_label ("");
     1177  widget = gtk_button_new_with_label("");
    11781178#endif /* HAVE_GTK2 */
    11791179}
     
    11961196   \param title The name the Button should get
    11971197*/
    1198 void Button::setTitle (char *title)
     1198void Button::setTitle(char *title)
    11991199{
    12001200  if (this->title)
     
    12031203  strcpy(this->title, title);
    12041204#ifdef HAVE_GTK2
    1205   gtk_button_set_label (GTK_BUTTON(widget), title);
     1205  gtk_button_set_label(GTK_BUTTON(widget), title);
    12061206#endif /* HAVE_GTK2 */
    12071207}
     
    12111211   not implemented yet
    12121212*/
    1213 void Button::redraw (void)
     1213void Button::redraw(void)
    12141214{
    12151215}
     
    12171217/**
    12181218   \brief Button can not be changed, optionChange is empty)
     1219
     1220   \todo Actions for non-GTK-mode
    12191221*/
    12201222void Button::changeOption(void)
     
    12291231   \param buttonname The name the CheckButton should display.
    12301232*/
    1231 CheckButton::CheckButton (char* buttonname)
     1233CheckButton::CheckButton(char* buttonname)
    12321234{
    12331235  this->init();
     
    12351237
    12361238#ifdef HAVE_GTK2
    1237   this->connectSignal ("clicked", this->OptionChange);
     1239  this->connectSignal("clicked", this->OptionChange);
    12381240#endif /* HAVE_GTK2 */
    12391241}
     
    12521254void CheckButton::init(void)
    12531255{
    1254   isOption = 1;
     1256  this->isOption = 1;
    12551257
    12561258  static_cast<Option*>(this)->init();
    12571259
    12581260#ifdef HAVE_GTK2
    1259   widget = gtk_check_button_new_with_label ("");
     1261  this->widget = gtk_check_button_new_with_label("");
    12601262#endif /* HAVE_GTK2 */
    12611263}
     
    12891291}
    12901292
    1291 bool CheckButton::isActive()
     1293bool CheckButton::isActive(void)
    12921294{
    12931295#ifdef HAVE_GTK2
     
    12991301   \brief Changed the Option, call this Function
    13001302*/
    1301 void CheckButton::changeOption()
    1302 {
    1303 #ifdef HAVE_GTK2
    1304   this->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this->widget));
     1303void CheckButton::changeOption(void)
     1304{
     1305#ifdef HAVE_GTK2
     1306  this->value =(int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this->widget));
    13051307#else /* HAVE_GTK2 */
    13061308  char tmpChar[20];
     
    13161318
    13171319/**
    1318    \brief Redraws the CheckButton (if option has changed).
     1320   \brief Redraws the CheckButton(if option has changed).
    13191321   Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change
    13201322*/
    1321 void CheckButton::redraw ()
    1322 {
    1323 #ifdef HAVE_GTK2
    1324   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
     1323void CheckButton::redraw(void)
     1324{
     1325#ifdef HAVE_GTK2
     1326  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(this->widget), value);
    13251327#endif /* HAVE_GTK2 */
    13261328}
     
    13341336   \param end The maximal Value of the slider.
    13351337*/
    1336 Slider::Slider (char* slidername, int start, int end)
     1338Slider::Slider(char* slidername, int start, int end)
    13371339{
    13381340  this->init(start, end);
     
    13401342  this->setTitle(slidername);
    13411343#ifdef HAVE_GTK2
    1342   this->connectSignal ("value_changed", this->OptionChange);
     1344  this->connectSignal("value_changed", this->OptionChange);
    13431345#endif /* HAVE_GTK2 */
    13441346}
     
    13541356/**
    13551357   \brief Initializes a Slider with start and end Values
    1356    params: see Slider::Slider (char* slidername, int start, int end)
     1358   params: see Slider::Slider(char* slidername, int start, int end)
    13571359*/
    13581360void Slider::init(int start, int end)
    13591361{
    1360   isOption = 2;
     1362  this->isOption = 2;
    13611363
    13621364  static_cast<Option*>(this)->init();
     
    13651367  this->end = end;
    13661368#ifdef HAVE_GTK2
    1367  widget = gtk_hscale_new_with_range (start, end, 5);
     1369 widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    13681370#endif /* HAVE_GTK2 */
    13691371}
     
    14061408/**
    14071409   \brief Redraws the widget
    1408    Example: see void CheckButton::redraw ()
    1409 */
    1410 void Slider::redraw ()
    1411 {
    1412 #ifdef HAVE_GTK2
    1413   gtk_range_set_value (GTK_RANGE (widget), value);
     1410   Example: see void CheckButton::redraw(void)
     1411*/
     1412void Slider::redraw(void)
     1413{
     1414#ifdef HAVE_GTK2
     1415  gtk_range_set_value(GTK_RANGE(this->widget), value);
    14141416#endif /* HAVE_GTK2 */
    14151417}
     
    14181420   \brief Changed the Option, call this Function
    14191421*/
    1420 void Slider::changeOption()
    1421 {
    1422 #ifdef HAVE_GTK2
    1423   this->value = (int)gtk_range_get_value(GTK_RANGE(this->widget));
     1422void Slider::changeOption(void)
     1423{
     1424#ifdef HAVE_GTK2
     1425  this->value =(int)gtk_range_get_value(GTK_RANGE(this->widget));
    14241426#else /* HAVE_GTK2 */
    14251427  char tmpChar[20];
     
    14431445    \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!!
    14441446*/
    1445 Menu::Menu (char* menuname, ...)
     1447Menu::Menu(char* menuname, ...)
    14461448{
    14471449  this->init();
     
    14511453
    14521454#ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
    1453   va_start (itemlist, menuname);
    1454   while (strcmp (itemName = va_arg (itemlist, char*), "lastItem"))
     1455  va_start(itemlist, menuname);
     1456  while(strcmp(itemName = va_arg(itemlist, char*), "lastItem"))
    14551457    {
    14561458      this->addItem(itemName);
     
    14601462
    14611463#ifdef HAVE_GTK2
    1462   gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);
    1463   this->connectSignal ("changed", this->OptionChange);
     1464  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
     1465  this->connectSignal("changed", this->OptionChange);
    14641466#endif /* HAVE_GTK2 */
    14651467}
     
    14781480void Menu::init(void)
    14791481{
    1480   isOption = 2;
     1482  this->isOption = 2;
    14811483
    14821484  static_cast<Option*>(this)->init();
    14831485
    14841486#ifdef HAVE_GTK2
    1485   widget = gtk_option_menu_new ();
    1486   menu = gtk_menu_new ();
     1487  this->widget = gtk_option_menu_new();
     1488  this->menu = gtk_menu_new();
    14871489#endif /* HAVE_GTK2 */
    14881490
     
    15191521   \brief appends a new Item to the Menu-List.
    15201522   \param itemName the itemName to be appendet.
    1521 */
    1522 void Menu::addItem (char* itemName)
    1523 {
    1524 #ifdef HAVE_GTK2
    1525   item = gtk_menu_item_new_with_label (itemName);
    1526   gtk_menu_shell_append(GTK_MENU_SHELL (menu), item);
     1523
     1524   \todo make the item-list readable without GTK
     1525*/
     1526void Menu::addItem(char* itemName)
     1527{
     1528#ifdef HAVE_GTK2
     1529  this->item = gtk_menu_item_new_with_label(itemName);
     1530  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item);
    15271531#endif /* HAVE_GTK2 */
    15281532}
     
    15301534/**
    15311535   \brief Redraws the widget
    1532    Example: see void CheckButton::redraw ()
    1533 */
    1534 void Menu::redraw ()
    1535 {
    1536 #ifdef HAVE_GTK2
    1537  gtk_option_menu_set_history (GTK_OPTION_MENU (widget), value);
     1536   Example: see void CheckButton::redraw(void)
     1537*/
     1538void Menu::redraw(void)
     1539{
     1540#ifdef HAVE_GTK2
     1541 gtk_option_menu_set_history(GTK_OPTION_MENU(this->widget), this->value);
    15381542#endif /* HAVE_GTK2 */
    15391543}
     
    15421546   \brief Changed the Option, call this Function
    15431547*/
    1544 void Menu::changeOption()
    1545 {
    1546 #ifdef HAVE_GTK2
    1547   this->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (this->widget));
     1548void Menu::changeOption(void)
     1549{
     1550#ifdef HAVE_GTK2
     1551  this->value =(int)gtk_option_menu_get_history(GTK_OPTION_MENU(this->widget));
    15481552#else /* HAVE_GTK2 */
    15491553  char tmpChar[20];
    1550   cout << "\nPlease give me a new value for " << this->title << " (defualt:" << this->defaultValue << "): ";
     1554  cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): ";
    15511555  cin >> tmpChar;
    15521556  this->value = atoi(tmpChar);
     
    15611565   \brief Creates a new OptionLabel with a LabelName and a Value.
    15621566   \param label The name of the OptionLabel.
    1563    \param value The Value of the OptionLabel (what will be displayed).
     1567   \param value The Value of the OptionLabel(what will be displayed).
    15641568*/
    15651569OptionLabel::OptionLabel(char* label, char* value)
    15661570{
    1567   init();
    1568   setTitle(label);
    1569   setValue(value);
     1571  this->init();
     1572  this->setTitle(label);
     1573  this->setValue(value);
    15701574}
    15711575
     
    15831587void OptionLabel::init(void)
    15841588{
     1589  this->isOption = 5;
    15851590  static_cast<Option*>(this)->init();
    1586   isOption = 5;
     1591
    15871592  cValue = NULL;
    15881593
    15891594#ifdef HAVE_GTK2
    1590   widget = gtk_label_new ("");
     1595  this->widget = gtk_label_new("");
    15911596#endif /* HAVE_GTK2 */
    15921597}
     
    16011606  else
    16021607    PRINTF(3)("deleting the OptionLabel.\n");
    1603   if (cValue)
    1604     delete []cValue;
     1608  if (this->cValue)
     1609    delete []this->cValue;
    16051610
    16061611  static_cast<Option*>(this)->destroy();
     
    16141619void OptionLabel::setValue(char* newValue)
    16151620{
    1616   if (cValue)
    1617     delete cValue;
    1618   cValue = new char [strlen(newValue)+1];
    1619   strcpy(cValue, newValue);
    1620 #ifdef HAVE_GTK2
    1621   gtk_label_set_text (GTK_LABEL (widget), cValue);
     1621  if (this->cValue)
     1622    delete []this->cValue;
     1623  this->cValue = new char [strlen(newValue)+1];
     1624  strcpy(this->cValue, newValue);
     1625#ifdef HAVE_GTK2
     1626  gtk_label_set_text(GTK_LABEL(this->widget), this->cValue);
    16221627#endif /* HAVE_GTK2 */
    16231628}
     
    16331638  this->title = new char [strlen(title)+1];
    16341639  strcpy(this->title, title);
    1635 #ifdef HAVE_GTK2
    1636   gtk_label_set_text (GTK_LABEL(widget), title);
    1637 #endif /* HAVE_GTK2 */
    1638 }
    1639 
    1640 /**
    1641    \brief Redraws an OptionLabel (not implemented yet, but it works).
     1640  this->redraw();
     1641}
     1642
     1643/**
     1644   \brief Redraws an OptionLabel(not implemented yet, but it works).
    16421645*/
    16431646void OptionLabel::redraw(void)
    16441647{
    1645  
     1648#ifdef HAVE_GTK2
     1649  gtk_label_set_text(GTK_LABEL(widget), title);
     1650#endif /* HAVE_GTK2 */
    16461651}
    16471652
     
    16491654   \brief Changed the Option, call this Function
    16501655*/
    1651 void OptionLabel::changeOption()
    1652 {
    1653 #ifdef HAVE_GTK2
    1654   this->cValue = (char*)gtk_label_get_text (GTK_LABEL(this->widget));
     1656void OptionLabel::changeOption(void)
     1657{
     1658#ifdef HAVE_GTK2
     1659  this->cValue =(char*)gtk_label_get_text(GTK_LABEL(this->widget));
    16551660#else /* HAVE_GTK2 */
    16561661  cout << "\nPlease give me a new input for " << this->title << ": ";
     
    16651670   You migth consider adding Label::setTitle with this.
    16661671*/
    1667 Label::Label ()
     1672Label::Label(void)
    16681673{
    16691674  this->init();
     
    16741679   \param text The text to be displayed.
    16751680*/
    1676 Label:: Label (char* text)
     1681Label:: Label(char* text)
    16771682{
    16781683  this->init();
     
    16931698void Label::init(void)
    16941699{
    1695   isOption = 0;
     1700  this->isOption = 0;
    16961701
    16971702  static_cast<Widget*>(this)->init();
    16981703
    16991704#ifdef HAVE_GTK2
    1700   widget = gtk_label_new ("");
    1701   gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);
     1705  this->widget = gtk_label_new("");
     1706  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    17021707#endif /* HAVE_GTK2 */
    17031708}
     
    17271732  strcpy(this->title, text);
    17281733#ifdef HAVE_GTK2
    1729   gtk_label_set_text (GTK_LABEL (this->widget), text);
     1734  gtk_label_set_text(GTK_LABEL(this->widget), this->title);
    17301735#endif /* HAVE_GTK2 */
    17311736}
     
    17591764 
    17601765#ifdef HAVE_GTK2
    1761   gtk_label_set_text (GTK_LABEL (this->widget), title);
     1766  gtk_label_set_text(GTK_LABEL(this->widget), title);
    17621767#endif /* HAVE_GTK2 */
    17631768}
     
    17711776void Label::appendInt(int intToAppend)
    17721777{
    1773   char append [20];
     1778  char append [32];
    17741779  sprintf(append, "%d", intToAppend);
    17751780  this->appendText(append);
     
    17811786   \return The Text the Label holds.
    17821787*/
    1783 char* Label::getText ()
     1788char* Label::getText(void)
    17841789{
    17851790  return this->title;
     
    17891794   \brief Creates a new ProgressBar.
    17901795*/
    1791 ProgressBar::ProgressBar (void)
    1792 {
    1793   this->init ();
     1796ProgressBar::ProgressBar(void)
     1797{
     1798  this->init();
    17941799}
    17951800
     
    17981803   \param label The name you want to get the ProgressBar.
    17991804*/
    1800 ProgressBar::ProgressBar (char* label)
     1805ProgressBar::ProgressBar(char* label)
    18011806{
    18021807  this->init();
    1803   this->setTitle (label);
     1808  this->setTitle(label);
    18041809}
    18051810
     
    18071812   \brief destructs a ProgressBar
    18081813*/
    1809 ProgressBar::~ProgressBar ()
     1814ProgressBar::~ProgressBar(void)
    18101815{
    18111816  this->destroy();
     
    18151820   \brief Initializes a ProgressBar
    18161821*/
    1817 void ProgressBar::init (void)
    1818 {
    1819   isOption = 0;
    1820   progress = 0.0;
    1821   totalSize = 0.0;
     1822void ProgressBar::init(void)
     1823{
     1824  this->isOption = 0;
     1825  this->progress = 0.0;
     1826  this->totalSize = 0.0;
    18221827
    18231828  static_cast<Widget*>(this)->init();
    18241829#ifdef HAVE_GTK2
    1825   adjustment = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
    1826   widget = gtk_progress_bar_new_with_adjustment(adjustment);
     1830  this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
     1831  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    18271832#endif /* HAVE_GTK2 */
    18281833}
     
    18541859
    18551860/**
    1856    \brief Sets the Total size of the Bar. (ex. The maximum one can download)
    1857 */
    1858 void ProgressBar::setTotalSize (double totalSize)
     1861   \brief Sets the Total size of the Bar.(ex. The maximum one can download)
     1862*/
     1863void ProgressBar::setTotalSize(double totalSize)
    18591864{
    18601865  this->totalSize = totalSize;
     
    18641869   \brief Sets the progress maximum is this->totalSize
    18651870*/
    1866 void ProgressBar::setProgress (double progress)
     1871void ProgressBar::setProgress(double progress)
    18671872{
    18681873  this->progress = progress;
     
    18741879  gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize);
    18751880#endif /* HAVE_GTK2 */
    1876   PRINTF(3)("Progress: %f\n", progress*100.0/totalSize);
     1881  PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize);
    18771882}
    18781883
     
    18801885    \brief returns the Progress Status
    18811886*/
    1882 double ProgressBar::getProgress (void)
     1887double ProgressBar::getProgress(void)
    18831888{
    18841889  return this->progress;
     
    18911896   \param imagename the location of the Image on the Hard Disc
    18921897*/
    1893 Image::Image (char* imagename)
     1898Image::Image(char* imagename)
    18941899{
    18951900  this->init();
     
    19001905
    19011906#ifdef HAVE_GTK2
    1902   widget = gtk_image_new_from_file (imagename);
     1907  widget = gtk_image_new_from_file(imagename);
    19031908#endif /* HAVE_GTK2 */
    19041909}
     
    19151920    \brief Initializes a new Image
    19161921*/
    1917 void Image::init()
     1922void Image::init(void)
    19181923{
    19191924  isOption = 0;
Note: See TracChangeset for help on using the changeset viewer.