Changeset 4046 in orxonox.OLD for orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.cc
- Timestamp:
- May 4, 2005, 11:50:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/guiMerge/src/lib/gui/gui/orxonox_gui_gtk.cc
r4039 r4046 32 32 using namespace std; 33 33 34 // temporarily.35 34 #include "orxonox_gui_flags.h" 36 extern Window* orxonoxGUI;37 35 extern OrxonoxGuiFlags* flags; 36 38 37 char* guiExecutable; 39 38 char* progExecutable; … … 145 144 ////////////////////////////// 146 145 146 //////////// 147 147 /* WIDGET */ 148 //////////// 148 149 /** 149 150 \brief constructs a Widget … … 153 154 next = NULL; 154 155 this->title = NULL; 155 return;156 156 } 157 157 … … 162 162 Widget::~Widget(void) 163 163 { 164 164 if (this->title) 165 165 { 166 166 delete []this->title; 167 167 } 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"); 172 170 173 171 // deleting next item if existent … … 178 176 //! \todo not hiding widget, deleting. 179 177 // this->hide(); 180 // delete this->widget;178 // gtk_destroy_widget(this->widget); 181 179 } 182 180 … … 317 315 int* count =(int*)data; 318 316 *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()); 320 320 } 321 321 } … … 421 421 bool found = false; 422 422 // check if long flag matches 423 if ((option->flagName && strlen(name) >2 &&423 if ((option->flagName && strlen(name) > 2 && 424 424 !strncmp(name+2, option->flagName, strlen(option->flagName)) && 425 425 (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') )) … … 518 518 #endif /* HAVE_GTK2 */ 519 519 520 //void deleteWidget(Widget* lastWidget) 521 522 520 ///////////// 523 521 /* PACKERS */ 522 ///////////// 524 523 /** 525 524 \brief Constructs a Packer … … 537 536 { 538 537 PRINTF(5)("deleting the Packer part.\n"); 539 540 538 if (this->groupName) 541 539 delete []this->groupName; 542 540 543 541 //deleting recursively. 544 542 if (this->down) 545 543 delete this->down; 546 this->down = NULL;547 544 } 548 545 … … 551 548 \param name The name of the group. 552 549 */ 553 void Packer::setGroupName(c har* name)550 void Packer::setGroupName(const char* name) 554 551 { 555 552 if (this->groupName) … … 559 556 } 560 557 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 //////////////// 570 559 /* CONTAINERS */ 571 560 //////////////// 572 561 /** 573 562 \brief Initializes a Container. … … 594 583 It does this by filling up the down pointer only if down points to NULL. 595 584 */ 596 void Container::fill(Widget *lowerWidget)585 void Container::fill(Widget* lowerWidget) 597 586 { 598 587 if (this->down == NULL) … … 601 590 gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget); 602 591 #endif /* HAVE_GTK2 */ 592 603 593 this->down = lowerWidget; 604 594 } 605 595 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 */ 602 void 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 //////////// 611 612 /* 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 */ 618 Window* Window::mainWindow = NULL; 644 619 645 620 /** … … 647 622 \param windowName the name the window should get. 648 623 */ 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) 624 Window::Window(const char* windowName) 672 625 { 673 626 if (!mainWindow) 674 mainWindow = this; 675 627 { 628 mainWindow = this; 629 this->isOpen = true; 630 } 676 631 isOpen = false; 677 632 … … 684 639 gtk_container_set_border_width(GTK_CONTAINER(widget), 3); 685 640 #endif /* HAVE_GTK2 */ 641 642 if (windowName) 643 this->setTitle(windowName); 644 } 645 646 /** 647 \brief Destructs a Window. 648 */ 649 Window::~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 */ 659 void 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; 686 675 } 687 676 … … 691 680 void Window::showall(void) 692 681 { 682 #ifdef HAVE_GTK2 693 683 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); 701 685 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 */ 708 688 } 709 689 … … 753 733 } 754 734 755 #ifdef HAVE_GTK2756 735 /** 757 736 \brief opens up a window(not topmost Window). … … 761 740 \param window the Window that should be opened 762 741 */ 763 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window) 742 #ifdef HAVE_GTK2 743 gint Window::windowOpen(GtkWidget* widget, GdkEvent* event, void* window) 764 744 { 765 745 static_cast<Window*>(window)->open(); 766 746 } 747 #else /* HAVE_GTK2 */ 748 int Window::windowOpen(void* widget, void* event, void* window){} 749 #endif /* HAVE_GTK2 */ 767 750 768 751 /** … … 773 756 \param window the Window that should be closed 774 757 */ 775 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window) 758 #ifdef HAVE_GTK2 759 gint Window::windowClose(GtkWidget* widget, GdkEvent* event, void* window) 776 760 { 777 761 static_cast<Window*>(window)->close(); 778 762 } 779 780 #endif /* HAVE_GTK2 */ 781 782 763 #else /* HAVE_GTK2 */ 764 int Window::windowClose(void* widget, void* event, void* window){} 765 #endif /* HAVE_GTK2 */ 766 767 /////////// 783 768 /* FRAME */ 784 785 /** 786 \brief Creates a new Frame without a name 787 */ 788 Frame::Frame(void) 789 { 790 this->init(); 791 } 792 769 /////////// 793 770 /** 794 771 \brief Creates a new Frame with name title 795 772 */ 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) 773 Frame::Frame(char* frameName) 814 774 { 815 775 #ifdef HAVE_GTK2 … … 817 777 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 818 778 #endif /* HAVE_GTK2 */ 779 if (title) 780 this->setTitle(frameName); 781 } 782 783 /** 784 \brief destrcucts a Frame 785 */ 786 Frame::~Frame(void) 787 { 788 PRINTF(5)("deleting the Frame: %s\n", this->title); 819 789 } 820 790 … … 834 804 } 835 805 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 ////////////// 846 809 /** 847 810 \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 */ 813 EventBox::EventBox(const char* eventBoxName) 868 814 { 869 815 this->isOption = -1; … … 873 819 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 874 820 #endif /* HAVE_GTK2 */ 875 } 876 821 822 if (eventBoxName) 823 this->setTitle(eventBoxName); 824 } 825 826 /** 827 \brief destructs an EventBox. 828 */ 829 EventBox::~EventBox(void) 830 { 831 PRINTF(5)("deleting the EventBox: %s\n", this->title); 832 } 833 834 ///////// 877 835 /* BOX */ 878 879 /** 880 \brief Creates a new horizontal Box 881 */ 882 Box::Box(void) 883 { 884 this->init('h'); 885 } 886 836 ///////// 887 837 /** 888 838 \brief Creates a new Box of type boxtype … … 890 840 */ 891 841 Box::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 boxtype906 \param boxtype see Box(char boxtype)907 */908 void Box::init(char boxtype)909 842 { 910 843 this->isOption = -2; … … 918 851 } 919 852 853 /** 854 \brief destructs a Box. 855 */ 856 Box::~Box(void) 857 { 858 PRINTF(5)("deleting the Box: %s\n", this->title); 859 } 860 920 861 /** 921 862 \brief Fills a box with a given Widget. … … 936 877 tmp = this->down; 937 878 while(tmp->next != NULL) 938 { 939 tmp = tmp->next; 940 } 879 tmp = tmp->next; 941 880 tmp->next = lowerWidget; 942 881 } 943 882 } 944 883 884 //////////// 945 885 /* OPTION */ 946 886 //////////// 947 887 /** 948 888 \brief Initializes a new Option. … … 954 894 this->flagName = NULL; 955 895 this->flagNameShort = NULL; 896 897 this->shortDescription = NULL; 898 this->longDescription = NULL; 899 956 900 this->saveable = false; 957 901 this->defaultValue = 0; … … 968 912 if (this->flagNameShort) 969 913 delete []this->flagNameShort; 914 if (this->shortDescription) 915 delete []this->shortDescription; 916 if (this->longDescription) 917 delete []this->longDescription; 970 918 } 971 919 … … 976 924 \param defaultvalue the default Value for this Option(see definition of defaultvalue 977 925 */ 978 void Option::setFlagName(c har* flagname, int defaultvalue)926 void Option::setFlagName(const char* flagname, int defaultvalue) 979 927 { 980 928 if (this->flagName) … … 982 930 this->flagName = new char [strlen(flagname)+1]; 983 931 strcpy(this->flagName, flagname); 932 984 933 this->defaultValue = defaultvalue; 934 935 if (this->flagNameShort) 936 { 937 delete this->flagNameShort; 938 this->flagNameShort = NULL; 939 } 985 940 986 941 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; … … 993 948 \param flagnameshort a short flagname to be displayed in the output 994 949 */ 995 void Option::setFlagName(c har* flagname,char* flagnameshort, int defaultvalue)950 void Option::setFlagName(const char* flagname, const char* flagnameshort, int defaultvalue) 996 951 { 997 952 if (this->flagName) … … 1008 963 } 1009 964 1010 /** 1011 \brief Sets the saveable-state of the option to true. 1012 */ 1013 void Option::saveability(void) 1014 { 1015 this->saveable = true; 965 void 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; 1016 983 } 1017 984 … … 1027 994 /** 1028 995 \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) 1030 997 1031 998 this is a default Option save … … 1033 1000 char* Option::save(void) 1034 1001 { 1035 char* value = new char [ 10];1002 char* value = new char [30]; 1036 1003 sprintf (value, "%d", this->value); 1037 1004 return value; … … 1070 1037 #endif /* HAVE_GTK2 */ 1071 1038 1072 1039 //////////// 1073 1040 /* BUTTON */ 1074 1041 //////////// 1075 1042 /** 1076 1043 \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 */ 1046 Button::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); 1083 1056 } 1084 1057 … … 1089 1062 { 1090 1063 PRINTF(5)("deleting the Label: %s\n", this->title); 1091 }1092 1093 /**1094 \brief Initializes a new Button1095 */1096 void Button::init(void)1097 {1098 isOption = 0;1099 1100 #ifdef HAVE_GTK21101 widget = gtk_button_new_with_label("");1102 #endif /* HAVE_GTK2 */1103 1064 } 1104 1065 … … 1120 1081 /** 1121 1082 \brief redraws the Button 1122 not implemented yet1083 \todo not implemented yet 1123 1084 */ 1124 1085 void Button::redraw(void) … … 1136 1097 } 1137 1098 1099 ///////////////// 1138 1100 /* CHECKBUTTON */ 1139 1101 ///////////////// 1140 1102 /** 1141 1103 \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 */ 1106 CheckButton::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); 1148 1116 1149 1117 #ifdef HAVE_GTK2 … … 1164 1132 1165 1133 /** 1166 \brief Initialize a new CheckButton with default settings1167 */1168 void CheckButton::init(void)1169 {1170 this->isOption = 1;1171 1172 #ifdef HAVE_GTK21173 this->widget = gtk_check_button_new_with_label("");1174 #endif /* HAVE_GTK2 */1175 }1176 1177 /**1178 1134 \brief Sets a new Title to a CheckButton 1179 1135 \param title The new Name the CheckButton should display. … … 1190 1146 } 1191 1147 1148 /** 1149 \returns the Active state of the checkButton 1150 */ 1192 1151 bool CheckButton::isActive(void) 1193 1152 { … … 1215 1174 } 1216 1175 1217 1218 1176 /** 1219 1177 \brief Redraws the CheckButton(if option has changed). … … 1227 1185 } 1228 1186 1187 //////////// 1229 1188 /* SLIDER */ 1230 1189 //////////// 1231 1190 /** 1232 1191 \brief Creates a new Slider … … 1235 1194 \param end The maximal Value of the slider. 1236 1195 */ 1237 Slider::Slider(char* slidername, int start, int end) 1238 { 1239 this->init(start, end); 1196 Slider::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 1240 1206 this->setValue(start); 1241 1207 this->setTitle(slidername); … … 1254 1220 1255 1221 /** 1256 \brief Initializes a Slider with start and end Values1257 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_GTK21266 widget = gtk_hscale_new_with_range(this->start, this->end, 5);1267 #endif /* HAVE_GTK2 */1268 }1269 1270 /**1271 1222 \brief Setting a new value to the Slider. 1272 1223 Maybe you also require a Slider::redraw() for this to display … … 1284 1235 { 1285 1236 #ifdef HAVE_GTK2 1286 gtk_range_set_value(GTK_RANGE(this->widget), value);1237 gtk_range_set_value(GTK_RANGE(this->widget), this->value); 1287 1238 #endif /* HAVE_GTK2 */ 1288 1239 } … … 1308 1259 } 1309 1260 1261 ////////// 1310 1262 /* MENU */ 1311 1263 ////////// 1312 1264 /** 1313 1265 \brief constructs a new Menu, without adding any items to it. … … 1355 1307 /* 1356 1308 #ifdef HAVE_GTK2 1357 free(this->currItem->item);1309 gtk_widget_destroy(this->currItem->item); 1358 1310 #endif /* HAVE_GTK2 */ 1359 1311 MenuItem* tmpItem = this->currItem; … … 1480 1432 \param value The Value of the OptionLabel(what will be displayed). 1481 1433 */ 1482 OptionLabel::OptionLabel(char* label, char* value) 1483 { 1484 this->init(); 1434 OptionLabel::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 1485 1443 this->setTitle(label); 1486 1444 this->setValue(value); … … 1498 1456 1499 1457 /** 1500 \brief Initializes an OptionLabel1501 */1502 void OptionLabel::init(void)1503 {1504 this->isOption = 5;1505 cValue = NULL;1506 1507 #ifdef HAVE_GTK21508 this->widget = gtk_label_new("");1509 #endif /* HAVE_GTK2 */1510 }1511 1512 /**1513 1458 \brief Updates the value of an OptionLabel 1514 1459 \param newValue The new Name that should be displayed. 1515 1460 */ 1516 void OptionLabel::setValue(c har* newValue)1461 void OptionLabel::setValue(const char* newValue) 1517 1462 { 1518 1463 if (this->cValue) … … 1567 1512 void OptionLabel::load(char* loadString) 1568 1513 { 1569 PRINTF(4)( 1514 PRINTF(4)("Loading %s: setting to %s\n", this->title, loadString); 1570 1515 this->setValue(loadString); 1571 1516 } 1572 1517 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 /////////// 1582 1521 /** 1583 1522 \brief Creates a new Label with a Text. 1584 1523 \param text The text to be displayed. 1585 1524 */ 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) 1525 Label:: Label(const char* text) 1604 1526 { 1605 1527 this->isOption = 0; 1606 1528 1607 1529 #ifdef HAVE_GTK2 1608 1530 this->widget = gtk_label_new(""); 1609 1531 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1610 1532 #endif /* HAVE_GTK2 */ 1533 1534 if (text) 1535 this->setTitle(text); 1536 } 1537 1538 /** 1539 \brief destructs a Label. 1540 */ 1541 Label::~Label(void) 1542 { 1543 PRINTF(5)("deleting the Label: %s\n", this->title); 1611 1544 } 1612 1545 … … 1615 1548 \param text The text to be inserted into the Label. 1616 1549 */ 1617 void Label::setTitle(c har* text)1550 void Label::setTitle(const char* text) 1618 1551 { 1619 1552 if (this->title) … … 1674 1607 \return The Text the Label holds. 1675 1608 */ 1676 c har* Label::getText(void)1609 const char* Label::getText(void) 1677 1610 { 1678 1611 return this->title; 1679 1612 } 1680 1613 1681 /** 1682 \brief Creates a new ProgressBar. 1683 */ 1684 ProgressBar::ProgressBar(void) 1685 { 1686 this->init(); 1687 } 1688 1614 ////////////////// 1615 /* PROGRESS-BAR */ 1616 ////////////////// 1689 1617 /** 1690 1618 \brief Creates a new ProgressBar. 1691 1619 \param label The name you want to get the ProgressBar. 1692 1620 */ 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) 1621 ProgressBar::ProgressBar(const char* label) 1711 1622 { 1712 1623 this->isOption = 0; … … 1718 1629 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1719 1630 #endif /* HAVE_GTK2 */ 1631 1632 if (label) 1633 this->setTitle(label); 1634 } 1635 1636 /** 1637 \brief destructs a ProgressBar 1638 */ 1639 ProgressBar::~ProgressBar(void) 1640 { 1641 PRINTF(5)("deleting the ProgressBar: %s\n", this->title); 1720 1642 } 1721 1643 … … 1740 1662 #ifdef HAVE_GTK2 1741 1663 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 */ 1744 1668 } 1745 1669 … … 1752 1676 } 1753 1677 1678 /////////// 1754 1679 /* IMAGE */ 1755 1680 /////////// 1756 1681 /** 1757 1682 \brief Creates a new Image … … 1801 1726 this->title = new char[strlen(name)+1]; 1802 1727 strcpy(this->title, name); 1803 1804 } 1728 }
Note: See TracChangeset
for help on using the changeset viewer.