Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 4, 2005, 11:50:34 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/guiMerge: heavy clean-up of the gui

File:
1 edited

Legend:

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

    r4039 r4046  
    3232using namespace std;
    3333
    34 // temporarily.
    3534#include "orxonox_gui_flags.h"
    36 extern Window* orxonoxGUI;
    3735extern OrxonoxGuiFlags* flags;
     36
    3837char* guiExecutable;
    3938char* progExecutable;
     
    145144//////////////////////////////
    146145
     146////////////
    147147/* WIDGET */
     148////////////
    148149/**
    149150   \brief constructs a Widget
     
    153154  next = NULL;
    154155  this->title = NULL;
    155   return;
    156156}
    157157
     
    162162Widget::~Widget(void)
    163163{
    164     if (this->title)
     164  if (this->title)
    165165    {
    166166      delete []this->title;
    167167    }
    168    
    169     PRINTF(5)("deleting the Widget part.\n");
    170    
    171   PRINTF(5)("deleting recursively\n");
     168 
     169  PRINTF(5)("deleting the Widget part.\n");
    172170
    173171  // deleting next item if existent
     
    178176  //!  \todo not hiding widget, deleting.
    179177  //  this->hide();
    180   //  delete this->widget;
     178  // gtk_destroy_widget(this->widget);
    181179}
    182180
     
    317315      int* count =(int*)data;
    318316      *count = *count +1;
    319       PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
     317      PRINT(0)(" %d:%s is %s\n", *count,
     318               static_cast<Option*>(widget)->title,
     319               static_cast<Option*>(widget)->save());
    320320    }
    321321}
     
    421421      bool found = false;
    422422      // check if long flag matches
    423       if ((option->flagName && strlen(name)>2 &&
     423      if ((option->flagName && strlen(name) > 2 &&
    424424           !strncmp(name+2, option->flagName, strlen(option->flagName)) &&
    425425           (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
     
    518518#endif /* HAVE_GTK2 */
    519519
    520 //void deleteWidget(Widget* lastWidget)
    521 
    522 
     520/////////////
    523521/* PACKERS */
     522/////////////
    524523/**
    525524   \brief Constructs a Packer
     
    537536{
    538537  PRINTF(5)("deleting the Packer part.\n");
    539  
    540538  if (this->groupName)
    541539    delete []this->groupName;
    542 
     540 
    543541  //deleting recursively.
    544542  if (this->down)
    545543    delete this->down;
    546   this->down = NULL;
    547544}
    548545
     
    551548   \param name The name of the group.
    552549*/
    553 void Packer::setGroupName(char* name)
     550void Packer::setGroupName(const char* name)
    554551{
    555552  if (this->groupName)
     
    559556}
    560557
    561 /**
    562    \brief Retrieves the group name under which all the lower widgets of this will be saved.
    563    \returns name The name of the group.
    564 */
    565 char* Packer::getGroupName(void)
    566 {
    567   return this->groupName;
    568 }
    569 
     558////////////////
    570559/* CONTAINERS */
    571 
     560////////////////
    572561/**
    573562   \brief Initializes a Container.
     
    594583   It does this by filling up the down pointer only if down points to NULL.
    595584*/
    596 void Container::fill(Widget *lowerWidget)
     585void Container::fill(Widget* lowerWidget)
    597586{
    598587  if (this->down == NULL)
     
    601590      gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget);
    602591#endif /* HAVE_GTK2 */
     592
    603593      this->down = lowerWidget;
    604594    }
    605595  else
    606     PRINTF(1)("!!error!! You try to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n");
    607 }
    608 
    609 // gtk_container_set_border_width(GTK_CONTAINER(widget), 5);
    610 
     596    PRINTF(1)("You tried to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n");
     597}
     598
     599/**
     600   \param borderwidth sets the Width of the border
     601*/
     602void Container::setBorderWidth(int borderwidth)
     603{
     604  this->borderwidth = borderwidth;
     605
     606#ifdef HAVE_GTK2
     607  gtk_container_set_border_width(GTK_CONTAINER(widget), borderwidth);
     608#endif /* HAVE_GTK2 */
     609}
     610
     611////////////
    611612/* WINDOW */
    612 
    613 Window* Window::mainWindow = NULL;
    614 
    615 /**
    616    \brief Adds a new Window Windows to the List of Windows.
    617    \param windowToAdd The Windows that should be added to the List
    618    \todo this instead of windowToAdd(possibly)
    619 */
    620 void Window::addWindow(Window* windowToAdd)
    621 {
    622   if (!mainWindow)
    623     {
    624       mainWindow = windowToAdd;
    625       return;
    626     }
    627 
    628   Widget* tmpWindow = mainWindow;
    629   while(tmpWindow->next)
    630     tmpWindow = tmpWindow->next;
    631   tmpWindow->next = windowToAdd;
    632  
    633   return;
    634 }
    635      
    636 
    637 /**
    638    \brief Creating a new Window without a Name
    639 */
    640 Window::Window(void)
    641 {
    642   this->init();
    643 }
     613////////////
     614
     615/**
     616   \brief The main Window of Th Gui
     617*/
     618Window* Window::mainWindow = NULL;     
    644619
    645620/**
     
    647622   \param windowName the name the window should get.
    648623*/
    649 
    650 Window::Window(char* windowName)
    651 {
    652   this->init();
    653   this->setTitle(windowName);
    654 }
    655 
    656 /**
    657    \brief Destructs a Window.
    658 */
    659 Window::~Window(void)
    660 {
    661   if (this->title)
    662     PRINTF(5)("deleting the Window: %s\n", this->title);
    663   else
    664     PRINTF(5)("deleting the Window.\n");
    665   //  this->hide();
    666 }
    667 
    668 /**
    669    \brief initializes a new Window
    670 */
    671 void Window::init(void)
     624Window::Window(const char* windowName)
    672625{
    673626  if (!mainWindow)
    674     mainWindow = this;
    675  
     627    {
     628      mainWindow = this;
     629      this->isOpen = true;
     630    }
    676631  isOpen = false;
    677632
     
    684639  gtk_container_set_border_width(GTK_CONTAINER(widget), 3);
    685640#endif /* HAVE_GTK2 */
     641
     642  if (windowName)
     643    this->setTitle(windowName);
     644}
     645
     646/**
     647   \brief Destructs a Window.
     648*/
     649Window::~Window(void)
     650{
     651  PRINTF(5)("deleting the Window: %s\n", this->title);
     652}
     653
     654/**
     655   \brief Adds a new Window Windows to the List of Windows.
     656   \param windowToAdd The Windows that should be added to the List
     657   \todo this instead of windowToAdd(possibly)
     658*/
     659void Window::addWindow(Window* windowToAdd)
     660{
     661  if (!mainWindow)
     662    {
     663      mainWindow = windowToAdd;
     664      windowToAdd->isOpen = true;
     665    }
     666  else
     667    {
     668      Widget* tmpWindow = mainWindow;
     669      while(tmpWindow->next)
     670        tmpWindow = tmpWindow->next;
     671      tmpWindow->next = windowToAdd;
     672      windowToAdd->isOpen = false;
     673    }
     674  return;
    686675}
    687676
     
    691680void Window::showall(void)
    692681{
     682#ifdef HAVE_GTK2
    693683  if (!this->isOpen)
    694     {
    695       //      printf("showall\n");
    696 #ifdef HAVE_GTK2
    697       gtk_widget_show_all(this->widget);
    698 #endif /* HAVE_GTK2 */
    699      this->isOpen = true;
    700     }
     684    gtk_widget_show_all(this->widget);
    701685  else
    702     {
    703       //      printf("showone\n");
    704 #ifdef HAVE_GTK2
    705       gtk_widget_show(this->widget);
    706 #endif /* HAVE_GTK2 */
    707     }
     686    gtk_widget_show(this->widget);
     687#endif /* HAVE_GTK2 */
    708688}
    709689
     
    753733}
    754734
    755 #ifdef HAVE_GTK2
    756735/**
    757736   \brief opens up a window(not topmost Window).
     
    761740   \param window the Window that should be opened
    762741*/
    763 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window)
     742#ifdef HAVE_GTK2
     743gint Window::windowOpen(GtkWidget* widget, GdkEvent* event, void* window)
    764744{
    765745  static_cast<Window*>(window)->open();
    766746}
     747#else /* HAVE_GTK2 */
     748int Window::windowOpen(void* widget, void* event, void* window){}
     749#endif /* HAVE_GTK2 */
    767750
    768751/**
     
    773756   \param window the Window that should be closed
    774757*/
    775 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window)
     758#ifdef HAVE_GTK2
     759gint Window::windowClose(GtkWidget* widget, GdkEvent* event, void* window)
    776760{
    777761  static_cast<Window*>(window)->close();
    778762}
    779 
    780 #endif /* HAVE_GTK2 */
    781 
    782 
     763#else /* HAVE_GTK2 */
     764int Window::windowClose(void* widget, void* event, void* window){}
     765#endif /* HAVE_GTK2 */
     766
     767///////////
    783768/* FRAME */
    784 
    785 /**
    786     \brief Creates a new Frame without a name
    787 */
    788 Frame::Frame(void)
    789 {
    790   this->init();
    791 }
    792 
     769///////////
    793770/**
    794771   \brief Creates a new Frame with name title
    795772*/
    796 Frame::Frame(char* title)
    797 {
    798   this->init();
    799   this->setTitle(title);
    800 }
    801 
    802 /**
    803    \brief destrcucts a Frame
    804 */
    805 Frame::~Frame(void)
    806 {
    807   PRINTF(5)("deleting the Frame: %s\n", this->title);
    808 }
    809 
    810 /**
    811     \brief Initializes a new Frame with default settings
    812 */
    813 void Frame::init(void)
     773Frame::Frame(char* frameName)
    814774{
    815775#ifdef HAVE_GTK2
     
    817777  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    818778#endif /* HAVE_GTK2 */
     779  if (title)
     780    this->setTitle(frameName);
     781}
     782
     783/**
     784   \brief destrcucts a Frame
     785*/
     786Frame::~Frame(void)
     787{
     788  PRINTF(5)("deleting the Frame: %s\n", this->title);
    819789}
    820790
     
    834804}
    835805
    836 // EVENTBOX //
    837 
    838 /**
    839    \brief Creates a new EventBox with default settings.
    840 */
    841 EventBox::EventBox(void)
    842 {
    843   this->init();
    844 }
    845 
     806//////////////
     807/* EVENTBOX */
     808//////////////
    846809/**
    847810   \brief Creates a new EventBox with name title
    848    \param title title the Eventbox should get(only data-structure-internal)
    849 */
    850 EventBox::EventBox(char* title)
    851 {
    852   this->init();
    853   this->setTitle(title);
    854 }
    855 
    856 /**
    857    \brief destructs an EventBox.
    858 */
    859 EventBox::~EventBox(void)
    860 {
    861   PRINTF(5)("deleting the EventBox: %s\n", this->title);
    862 }
    863 
    864 /**
    865    \brief Initializes a new EventBox
    866 */
    867 void EventBox::init(void)
     811   \param eventBoxName title the Eventbox should get(only data-structure-internal)
     812*/
     813EventBox::EventBox(const char* eventBoxName)
    868814{
    869815  this->isOption = -1;
     
    873819  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    874820#endif /* HAVE_GTK2 */
    875 }
    876 
     821
     822  if (eventBoxName)
     823    this->setTitle(eventBoxName);
     824}
     825
     826/**
     827   \brief destructs an EventBox.
     828*/
     829EventBox::~EventBox(void)
     830{
     831  PRINTF(5)("deleting the EventBox: %s\n", this->title);
     832}
     833
     834/////////
    877835/* BOX */
    878 
    879 /**
    880    \brief Creates a new horizontal Box
    881 */
    882 Box::Box(void)
    883 {
    884   this->init('h');
    885 }
    886 
     836/////////
    887837/**
    888838   \brief Creates a new Box of type boxtype
     
    890840*/
    891841Box::Box(char boxtype)
    892 {
    893   this->init(boxtype);
    894 }
    895 
    896 /**
    897    \brief destructs a Box.
    898 */
    899 Box::~Box(void)
    900 {
    901   PRINTF(5)("deleting the Box: %s\n", this->title);
    902 }
    903 
    904 /**
    905    \brief Initializes a new Box with type boxtype
    906    \param boxtype see Box(char boxtype)
    907 */
    908 void Box::init(char boxtype)
    909842{
    910843  this->isOption = -2;
     
    918851}
    919852
     853/**
     854   \brief destructs a Box.
     855*/
     856Box::~Box(void)
     857{
     858  PRINTF(5)("deleting the Box: %s\n", this->title);
     859}
     860
    920861/**
    921862    \brief Fills a box with a given Widget.
     
    936877      tmp = this->down;
    937878      while(tmp->next != NULL)
    938         {
    939           tmp = tmp->next;
    940         }
     879        tmp = tmp->next;
    941880      tmp->next = lowerWidget;
    942881    }
    943882}
    944883
     884////////////
    945885/* OPTION */
    946 
     886////////////
    947887/**
    948888   \brief Initializes a new Option.
     
    954894  this->flagName = NULL;
    955895  this->flagNameShort = NULL;
     896 
     897  this->shortDescription = NULL;
     898  this->longDescription = NULL;
     899
    956900  this->saveable = false;
    957901  this->defaultValue = 0;
     
    968912  if (this->flagNameShort)
    969913    delete []this->flagNameShort;
     914  if (this->shortDescription)
     915    delete []this->shortDescription;
     916  if (this->longDescription)
     917    delete []this->longDescription;
    970918}
    971919
     
    976924   \param defaultvalue the default Value for this Option(see definition of defaultvalue
    977925*/
    978 void Option::setFlagName(char* flagname, int defaultvalue)
     926void Option::setFlagName(const char* flagname, int defaultvalue)
    979927{
    980928  if (this->flagName)
     
    982930  this->flagName = new char [strlen(flagname)+1];
    983931  strcpy(this->flagName, flagname);
     932
    984933  this->defaultValue = defaultvalue;
     934
     935  if (this->flagNameShort)
     936    {
     937      delete this->flagNameShort;
     938      this->flagNameShort = NULL;
     939    }
    985940
    986941  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
     
    993948    \param flagnameshort a short flagname to be displayed in the output
    994949*/
    995 void Option::setFlagName(char* flagname, char* flagnameshort,  int defaultvalue)
     950void Option::setFlagName(const char* flagname, const char* flagnameshort,  int defaultvalue)
    996951{
    997952  if (this->flagName)
     
    1008963}
    1009964
    1010 /**
    1011    \brief Sets the saveable-state of the option to true.
    1012 */
    1013 void Option::saveability(void)
    1014 {
    1015   this->saveable = true;
     965void Option::setDescription(const char* shortDescription, const char* longDescription)
     966{
     967  // setting up the short description
     968  if (this->shortDescription)
     969    delete []this->shortDescription;
     970  this->shortDescription = new char [strlen(shortDescription)+1];
     971  strcpy(this->shortDescription, shortDescription);
     972
     973  //setting up the long description
     974  if (this->longDescription)
     975    delete []this->longDescription;
     976  if (longDescription)
     977    {
     978      this->longDescription = new char [strlen(longDescription)+1];
     979      strcpy(this->longDescription, longDescription);
     980    }
     981  else
     982    this->longDescription = NULL;
    1016983}
    1017984
     
    1027994/**
    1028995   \brief saves an Option
    1029    \returns the String that should be saved.
     996   \returns the String that should be saved. (this string __should__ be deleted)
    1030997
    1031998   this is a default Option save
     
    10331000char* Option::save(void)
    10341001{
    1035   char* value = new char [10];
     1002  char* value = new char [30];
    10361003  sprintf (value, "%d", this->value);
    10371004  return value;
     
    10701037#endif /* HAVE_GTK2 */
    10711038
    1072 
     1039////////////
    10731040/* BUTTON */
    1074 
     1041////////////
    10751042/**
    10761043   \brief Creates a new Button with a buttonname
    1077    \param buttonname sets the Name of the Button
    1078 */
    1079 Button::Button(char* buttonname)
    1080 {
    1081   this->init();
    1082   this->setTitle(buttonname);
     1044   \param buttonName sets the Name of the Button
     1045*/
     1046Button::Button(char* buttonName)
     1047{
     1048  isOption = 0;
     1049
     1050#ifdef HAVE_GTK2
     1051  widget = gtk_button_new_with_label("");
     1052#endif /* HAVE_GTK2 */
     1053
     1054  if (buttonName)
     1055    this->setTitle(buttonName);
    10831056}
    10841057
     
    10891062{
    10901063  PRINTF(5)("deleting the Label: %s\n", this->title);
    1091 }
    1092 
    1093 /**
    1094    \brief Initializes a new Button
    1095 */
    1096 void Button::init(void)
    1097 {
    1098   isOption = 0;
    1099 
    1100 #ifdef HAVE_GTK2
    1101   widget = gtk_button_new_with_label("");
    1102 #endif /* HAVE_GTK2 */
    11031064}
    11041065
     
    11201081/**
    11211082   \brief redraws the Button
    1122    not implemented yet
     1083   \todo not implemented yet
    11231084*/
    11241085void Button::redraw(void)
     
    11361097}
    11371098
     1099/////////////////
    11381100/* CHECKBUTTON */
    1139 
     1101/////////////////
    11401102/**
    11411103   \brief Creates a new CheckButton with an ame
    1142    \param buttonname The name the CheckButton should display.
    1143 */
    1144 CheckButton::CheckButton(char* buttonname)
    1145 {
    1146   this->init();
    1147   this->setTitle(buttonname);
     1104   \param buttonName The name the CheckButton should display.
     1105*/
     1106CheckButton::CheckButton(const char* buttonName)
     1107{
     1108  this->isOption = 1;
     1109
     1110#ifdef HAVE_GTK2
     1111  this->widget = gtk_check_button_new_with_label("");
     1112#endif /* HAVE_GTK2 */
     1113
     1114  if (buttonName)
     1115    this->setTitle(buttonName);
    11481116
    11491117#ifdef HAVE_GTK2
     
    11641132
    11651133/**
    1166    \brief Initialize a new CheckButton with default settings
    1167 */
    1168 void CheckButton::init(void)
    1169 {
    1170   this->isOption = 1;
    1171 
    1172 #ifdef HAVE_GTK2
    1173   this->widget = gtk_check_button_new_with_label("");
    1174 #endif /* HAVE_GTK2 */
    1175 }
    1176 
    1177 /**
    11781134   \brief Sets a new Title to a CheckButton
    11791135   \param title The new Name the CheckButton should display.
     
    11901146}
    11911147
     1148/**
     1149   \returns the Active state of the checkButton
     1150*/
    11921151bool CheckButton::isActive(void)
    11931152{
     
    12151174}
    12161175
    1217 
    12181176/**
    12191177   \brief Redraws the CheckButton(if option has changed).
     
    12271185}
    12281186
     1187////////////
    12291188/* SLIDER */
    1230 
     1189////////////
    12311190/**
    12321191   \brief Creates a new Slider
     
    12351194   \param end The maximal Value of the slider.
    12361195*/
    1237 Slider::Slider(char* slidername, int start, int end)
    1238 {
    1239   this->init(start, end);
     1196Slider::Slider(const char* slidername, int start, int end)
     1197{
     1198  this->isOption = 2;
     1199
     1200  this->start = start;
     1201  this->end = end;
     1202#ifdef HAVE_GTK2
     1203 widget = gtk_hscale_new_with_range(this->start, this->end, 5);
     1204#endif /* HAVE_GTK2 */
     1205
    12401206  this->setValue(start);
    12411207  this->setTitle(slidername);
     
    12541220
    12551221/**
    1256    \brief Initializes a Slider with start and end Values
    1257    params: see Slider::Slider(char* slidername, int start, int end)
    1258 */
    1259 void Slider::init(int start, int end)
    1260 {
    1261   this->isOption = 2;
    1262 
    1263   this->start = start;
    1264   this->end = end;
    1265 #ifdef HAVE_GTK2
    1266  widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    1267 #endif /* HAVE_GTK2 */
    1268 }
    1269 
    1270 /**
    12711222   \brief Setting a new value to the Slider.
    12721223   Maybe you also require a Slider::redraw() for this to display
     
    12841235{
    12851236#ifdef HAVE_GTK2
    1286   gtk_range_set_value(GTK_RANGE(this->widget), value);
     1237  gtk_range_set_value(GTK_RANGE(this->widget), this->value);
    12871238#endif /* HAVE_GTK2 */
    12881239}
     
    13081259}
    13091260
     1261//////////
    13101262/* MENU */
    1311 
     1263//////////
    13121264/**
    13131265   \brief constructs a new Menu, without adding any items to it.
     
    13551307      /*
    13561308        #ifdef HAVE_GTK2
    1357         free(this->currItem->item);
     1309        gtk_widget_destroy(this->currItem->item);
    13581310        #endif /* HAVE_GTK2 */
    13591311      MenuItem* tmpItem = this->currItem;
     
    14801432   \param value The Value of the OptionLabel(what will be displayed).
    14811433*/
    1482 OptionLabel::OptionLabel(char* label, char* value)
    1483 {
    1484   this->init();
     1434OptionLabel::OptionLabel(const char* label, const char* value)
     1435{
     1436  this->isOption = 5;
     1437  cValue = NULL;
     1438
     1439#ifdef HAVE_GTK2
     1440  this->widget = gtk_label_new("");
     1441#endif /* HAVE_GTK2 */
     1442
    14851443  this->setTitle(label);
    14861444  this->setValue(value);
     
    14981456
    14991457/**
    1500    \brief Initializes an OptionLabel
    1501 */
    1502 void OptionLabel::init(void)
    1503 {
    1504   this->isOption = 5;
    1505   cValue = NULL;
    1506 
    1507 #ifdef HAVE_GTK2
    1508   this->widget = gtk_label_new("");
    1509 #endif /* HAVE_GTK2 */
    1510 }
    1511 
    1512 /**
    15131458   \brief Updates the value of an OptionLabel
    15141459   \param newValue The new Name that should be displayed.
    15151460*/
    1516 void OptionLabel::setValue(char* newValue)
     1461void OptionLabel::setValue(const char* newValue)
    15171462{
    15181463  if (this->cValue)
     
    15671512void OptionLabel::load(char* loadString)
    15681513{
    1569   PRINTF(4)( "Loading %s: setting to %s\n", this->title, loadString);
     1514  PRINTF(4)("Loading %s: setting to %s\n", this->title, loadString);
    15701515  this->setValue(loadString);
    15711516}
    15721517
    1573 /**
    1574    \brief Creates a new default Label with no Text.
    1575    You migth consider adding Label::setTitle with this.
    1576 */
    1577 Label::Label(void)
    1578 {
    1579   this->init();
    1580 }
    1581 
     1518///////////
     1519/* LABEL */
     1520///////////
    15821521/**
    15831522   \brief Creates a new Label with a Text.
    15841523   \param text The text to be displayed.
    15851524*/
    1586 Label:: Label(char* text)
    1587 {
    1588   this->init();
    1589   this->setTitle(text);
    1590 }
    1591 
    1592 /**
    1593    \brief destructs a Label.
    1594 */
    1595 Label::~Label(void)
    1596 {
    1597   PRINTF(5)("deleting the Label: %s\n", this->title);
    1598 }
    1599 
    1600 /**
    1601    \brief initializes a new Label
    1602 */
    1603 void Label::init(void)
     1525Label:: Label(const char* text)
    16041526{
    16051527  this->isOption = 0;
    1606 
     1528 
    16071529#ifdef HAVE_GTK2
    16081530  this->widget = gtk_label_new("");
    16091531  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    16101532#endif /* HAVE_GTK2 */
     1533 
     1534  if (text)
     1535    this->setTitle(text);
     1536}
     1537
     1538/**
     1539   \brief destructs a Label.
     1540*/
     1541Label::~Label(void)
     1542{
     1543  PRINTF(5)("deleting the Label: %s\n", this->title);
    16111544}
    16121545
     
    16151548   \param text The text to be inserted into the Label.
    16161549*/
    1617 void Label::setTitle(char* text)
     1550void Label::setTitle(const char* text)
    16181551{
    16191552  if (this->title)
     
    16741607   \return The Text the Label holds.
    16751608*/
    1676 char* Label::getText(void)
     1609const char* Label::getText(void)
    16771610{
    16781611  return this->title;
    16791612}
    16801613
    1681 /**
    1682    \brief Creates a new ProgressBar.
    1683 */
    1684 ProgressBar::ProgressBar(void)
    1685 {
    1686   this->init();
    1687 }
    1688 
     1614//////////////////
     1615/* PROGRESS-BAR */
     1616//////////////////
    16891617/**
    16901618   \brief Creates a new ProgressBar.
    16911619   \param label The name you want to get the ProgressBar.
    16921620*/
    1693 ProgressBar::ProgressBar(char* label)
    1694 {
    1695   this->init();
    1696   this->setTitle(label);
    1697 }
    1698 
    1699 /**
    1700    \brief destructs a ProgressBar
    1701 */
    1702 ProgressBar::~ProgressBar(void)
    1703 {
    1704   PRINTF(5)("deleting the ProgressBar: %s\n", this->title);
    1705 }
    1706 
    1707 /**
    1708    \brief Initializes a ProgressBar
    1709 */
    1710 void ProgressBar::init(void)
     1621ProgressBar::ProgressBar(const char* label)
    17111622{
    17121623  this->isOption = 0;
     
    17181629  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    17191630#endif /* HAVE_GTK2 */
     1631
     1632  if (label)
     1633    this->setTitle(label);
     1634}
     1635
     1636/**
     1637   \brief destructs a ProgressBar
     1638*/
     1639ProgressBar::~ProgressBar(void)
     1640{
     1641  PRINTF(5)("deleting the ProgressBar: %s\n", this->title);
    17201642}
    17211643
     
    17401662#ifdef HAVE_GTK2
    17411663  gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize);
    1742 #endif /* HAVE_GTK2 */
    1743   PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize);
     1664  PRINTF(4)("Progress: %f%%\n", this->progress*100.0/this->totalSize);
     1665#else /* HVE_GTK2 */
     1666  PRINT(0)("Progress: %f%%\n", this->progress*100.0/this->totalSize);
     1667#endif /* HAVE_GTK2 */
    17441668}
    17451669
     
    17521676}
    17531677
     1678///////////
    17541679/* IMAGE */
    1755 
     1680///////////
    17561681/**
    17571682   \brief Creates a new Image
     
    18011726  this->title = new char[strlen(name)+1];
    18021727  strcpy(this->title, name);
    1803 
    1804 }
     1728}
Note: See TracChangeset for help on using the changeset viewer.