Changeset 3623 in orxonox.OLD for orxonox/trunk/src/lib/gui
- Timestamp:
- Mar 21, 2005, 8:15:38 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/gui/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui/orxonox_gui_gtk.cc
r3423 r3623 133 133 134 134 /* WIDGET */ 135 136 /** 137 \brief deletes any given Widget 138 This is still pretty crappy. 139 */ 140 Widget::~Widget(void) 141 { 142 this->destroy(); 143 } 144 145 /** 146 \brief Initializes a widget. 147 Initializes the next Pointer and the other Widget-specific Defaults. 148 */ 149 void Widget::init(void) 135 /** 136 \brief constructs a Widget 137 */ 138 Widget::Widget(void) 150 139 { 151 140 next = NULL; … … 155 144 156 145 /** 157 \brief Destroys a Widget 158 */ 159 void Widget::destroy(void) 160 { 161 if (this->title) 146 \brief deletes any given Widget 147 This is still pretty crappy. 148 */ 149 Widget::~Widget(void) 150 { 151 if (this->title) 162 152 { 163 153 delete []this->title; … … 172 162 delete this->next; 173 163 this->next = NULL; 174 175 164 //! \todo not hiding widget, deleting. 176 165 // this->hide(); … … 513 502 514 503 /* PACKERS */ 515 516 /** 517 \brief Initializes a Packer. 518 519 Sets the down-pinter to NULL and other PackerSpecific-values to their defaults. 520 */ 521 void Packer::init(void) 504 /** 505 \brief Constructs a Packer 506 */ 507 Packer::Packer(void) 522 508 { 523 509 this->down = NULL; 524 510 this->groupName = NULL; 525 526 527 static_cast<Widget*>(this)->init();528 return;529 511 } 530 512 … … 532 514 \brief Destroys a Packer. 533 515 */ 534 void Packer::destroy(void)516 Packer::~Packer(void) 535 517 { 536 518 PRINTF(4)("deleting the Packer part.\n"); … … 543 525 delete this->down; 544 526 this->down = NULL; 545 546 static_cast<Widget*>(this)->destroy();547 527 } 548 528 … … 575 555 sets the Container-Specific defaults. 576 556 */ 577 void Container::init(void)557 Container::Container(void) 578 558 { 579 559 this->isOption = -1; 580 581 static_cast<Packer*>(this)->init();582 583 return;584 560 } 585 561 … … 587 563 \brief Destroys a Container. 588 564 */ 589 void Container::destroy(void)565 Container::~Container(void) 590 566 { 591 567 PRINTF(4)("deleting the Container part.\n"); 592 593 static_cast<Packer*>(this)->destroy();594 568 } 595 569 … … 665 639 Window::~Window(void) 666 640 { 667 this->destroy(); 641 if (this->title) 642 PRINTF(3)("deleting the Window: %s\n", this->title); 643 else 644 PRINTF(3)("deleting the Window.\n"); 645 // this->hide(); 668 646 } 669 647 … … 677 655 678 656 isOpen = false; 679 680 static_cast<Container*>(this)->init();681 657 682 658 #ifdef HAVE_GTK2 … … 691 667 692 668 /** 693 \brief Destroys a Window.694 */695 void Window::destroy(void)696 {697 if (this->title)698 PRINTF(3)("deleting the Window: %s\n", this->title);699 else700 PRINTF(3)("deleting the Window.\n");701 // this->hide();702 static_cast<Container*>(this)->destroy();703 704 }705 706 /**707 669 \brief Shows all Widgets that are included within this->widget. 708 670 */ … … 823 785 Frame::~Frame(void) 824 786 { 825 this->destroy();826 }827 828 /**829 \brief Initializes a new Frame with default settings830 */831 void Frame::init(void)832 {833 static_cast<Container*>(this)->init();834 835 #ifdef HAVE_GTK2836 this->widget = gtk_frame_new("");837 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);838 #endif /* HAVE_GTK2 */839 }840 841 /**842 \brief Destroys a Frame.843 */844 void Frame::destroy(void)845 {846 787 if (this->title) 847 788 PRINTF(3)("deleting the Frame: %s\n", this->title); 848 789 else 849 790 PRINTF(3)("deleting the Frame.\n"); 850 851 static_cast<Container*>(this)->destroy(); 791 } 792 793 /** 794 \brief Initializes a new Frame with default settings 795 */ 796 void Frame::init(void) 797 { 798 #ifdef HAVE_GTK2 799 this->widget = gtk_frame_new(""); 800 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 801 #endif /* HAVE_GTK2 */ 852 802 } 853 803 … … 892 842 EventBox::~EventBox(void) 893 843 { 894 this->destroy();895 896 }897 898 /**899 \brief Initializes a new EventBox900 */901 void EventBox::init(void)902 {903 this->isOption = -1;904 905 static_cast<Container*>(this)->init();906 907 #ifdef HAVE_GTK2908 this->widget = gtk_event_box_new();909 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);910 #endif /* HAVE_GTK2 */911 }912 913 /**914 \brief Destroys an EventBox.915 */916 void EventBox::destroy(void)917 {918 844 if (this->title) 919 845 PRINTF(3)("deleting the EventBox: %s\n", this->title); 920 846 else 921 847 PRINTF(3)("deleting the EventBox.\n"); 922 923 static_cast<Container*>(this)->destroy(); 848 } 849 850 /** 851 \brief Initializes a new EventBox 852 */ 853 void EventBox::init(void) 854 { 855 this->isOption = -1; 856 857 #ifdef HAVE_GTK2 858 this->widget = gtk_event_box_new(); 859 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 860 #endif /* HAVE_GTK2 */ 924 861 } 925 862 … … 960 897 Box::~Box(void) 961 898 { 962 this->destroy();963 }964 965 /**966 \brief Initializes a new Box with type boxtype967 \param boxtype see Box(char boxtype)968 */969 void Box::init(char boxtype)970 {971 this->isOption = -2;972 973 static_cast<Packer*>(this)->init();974 #ifdef HAVE_GTK2975 if (boxtype == 'v')976 {977 this->widget = gtk_vbox_new(FALSE, 0);978 }979 else980 {981 this->widget = gtk_hbox_new(FALSE, 0);982 }983 #endif /* HAVE_GTK2 */984 }985 986 /**987 \brief Destroys a Box.988 */989 void Box::destroy(void)990 {991 899 if (this->title) 992 900 PRINTF(3)("deleting the Box: %s\n", this->title); … … 994 902 PRINTF(3)("deleting the Box.\n"); 995 903 996 static_cast<Packer*>(this)->destroy(); 904 } 905 906 /** 907 \brief Initializes a new Box with type boxtype 908 \param boxtype see Box(char boxtype) 909 */ 910 void Box::init(char boxtype) 911 { 912 this->isOption = -2; 913 914 #ifdef HAVE_GTK2 915 if (boxtype == 'v') 916 { 917 this->widget = gtk_vbox_new(FALSE, 0); 918 } 919 else 920 { 921 this->widget = gtk_hbox_new(FALSE, 0); 922 } 923 #endif /* HAVE_GTK2 */ 997 924 } 998 925 … … 1040 967 sets all Option-Specific-Values to their defaults. 1041 968 */ 1042 void Option::init(void)969 Option::Option(void) 1043 970 { 1044 971 this->value = 0; … … 1047 974 this->saveable = false; 1048 975 this->defaultValue = 0; 1049 1050 static_cast<Widget*>(this)->init();1051 1052 return;1053 976 } 1054 977 … … 1056 979 \brief Destroys an Option. 1057 980 */ 1058 void Option::destroy(void)981 Option::~Option(void) 1059 982 { 1060 983 PRINTF(4)("deleting the Option Part.\n"); … … 1063 986 if (this->flagNameShort) 1064 987 delete []this->flagNameShort; 1065 1066 static_cast<Widget*>(this)->destroy();1067 988 } 1068 989 … … 1161 1082 Button::~Button(void) 1162 1083 { 1163 this->destroy();1164 }1165 1166 /**1167 \brief Initializes a new Button1168 */1169 void Button::init(void)1170 {1171 isOption = 0;1172 1173 static_cast<Option*>(this)->init();1174 1175 #ifdef HAVE_GTK21176 widget = gtk_button_new_with_label("");1177 #endif /* HAVE_GTK2 */1178 }1179 1180 /**1181 \brief Destroys a Button.1182 */1183 void Button::destroy(void)1184 {1185 1084 if (this->title) 1186 1085 PRINTF(3)("deleting the Label: %s\n", this->title); … … 1188 1087 PRINTF(3)("deleting the Label.\n"); 1189 1088 1190 static_cast<Option*>(this)->destroy(); 1089 } 1090 1091 /** 1092 \brief Initializes a new Button 1093 */ 1094 void Button::init(void) 1095 { 1096 isOption = 0; 1097 1098 #ifdef HAVE_GTK2 1099 widget = gtk_button_new_with_label(""); 1100 #endif /* HAVE_GTK2 */ 1191 1101 } 1192 1102 … … 1245 1155 CheckButton::~CheckButton(void) 1246 1156 { 1247 this->destroy();1248 }1249 1250 /**1251 \brief Initialize a new CheckButton with default settings1252 */1253 void CheckButton::init(void)1254 {1255 this->isOption = 1;1256 1257 static_cast<Option*>(this)->init();1258 1259 #ifdef HAVE_GTK21260 this->widget = gtk_check_button_new_with_label("");1261 #endif /* HAVE_GTK2 */1262 }1263 1264 /**1265 \brief Destroys a CheckButton.1266 */1267 void CheckButton::destroy(void)1268 {1269 1157 if (this->title) 1270 1158 PRINTF(3)("deleting the CheckButton: %s\n", this->title); 1271 1159 else 1272 1160 PRINTF(3)("deleting the CheckButton.\n"); 1273 1274 static_cast<Option*>(this)->destroy(); 1161 } 1162 1163 /** 1164 \brief Initialize a new CheckButton with default settings 1165 */ 1166 void CheckButton::init(void) 1167 { 1168 this->isOption = 1; 1169 1170 #ifdef HAVE_GTK2 1171 this->widget = gtk_check_button_new_with_label(""); 1172 #endif /* HAVE_GTK2 */ 1275 1173 } 1276 1174 … … 1350 1248 Slider::~Slider(void) 1351 1249 { 1352 this->destroy();1353 }1354 1355 /**1356 \brief Initializes a Slider with start and end Values1357 params: see Slider::Slider(char* slidername, int start, int end)1358 */1359 void Slider::init(int start, int end)1360 {1361 this->isOption = 2;1362 1363 static_cast<Option*>(this)->init();1364 1365 this->start = start;1366 this->end = end;1367 #ifdef HAVE_GTK21368 widget = gtk_hscale_new_with_range(this->start, this->end, 5);1369 #endif /* HAVE_GTK2 */1370 }1371 1372 /**1373 \brief Destroys a Slider.1374 */1375 void Slider::destroy(void)1376 {1377 1250 if (this->title) 1378 1251 PRINTF(3)("deleting the Slider: %s\n", this->title); 1379 1252 else 1380 1253 PRINTF(3)("deleting the Slider.\n"); 1381 1382 static_cast<Option*>(this)->destroy(); 1383 1254 } 1255 1256 /** 1257 \brief Initializes a Slider with start and end Values 1258 params: see Slider::Slider(char* slidername, int start, int end) 1259 */ 1260 void Slider::init(int start, int end) 1261 { 1262 this->isOption = 2; 1263 1264 this->start = start; 1265 this->end = end; 1266 #ifdef HAVE_GTK2 1267 widget = gtk_hscale_new_with_range(this->start, this->end, 5); 1268 #endif /* HAVE_GTK2 */ 1384 1269 } 1385 1270 … … 1471 1356 Menu::~Menu(void) 1472 1357 { 1473 this->destroy();1474 }1475 1476 /**1477 \brief Initializes a new Menu with no items1478 */1479 void Menu::init(void)1480 {1481 this->isOption = 2;1482 1483 static_cast<Option*>(this)->init();1484 1485 #ifdef HAVE_GTK21486 this->widget = gtk_option_menu_new();1487 this->menu = gtk_menu_new();1488 #endif /* HAVE_GTK2 */1489 1490 }1491 1492 /**1493 \brief Destroys a Menu.1494 */1495 void Menu::destroy(void)1496 {1497 1358 if (this->title) 1498 1359 PRINTF(3)("deleting the Menu: %s\n", this->title); … … 1500 1361 PRINTF(3)("deleting the Menu.\n"); 1501 1362 //! \todo destroy menu 1502 1503 static_cast<Option*>(this)->destroy(); 1504 } 1505 1363 1364 } 1365 1366 /** 1367 \brief Initializes a new Menu with no items 1368 */ 1369 void Menu::init(void) 1370 { 1371 this->isOption = 2; 1372 1373 #ifdef HAVE_GTK2 1374 this->widget = gtk_option_menu_new(); 1375 this->menu = gtk_menu_new(); 1376 #endif /* HAVE_GTK2 */ 1377 1378 } 1506 1379 1507 1380 /** … … 1578 1451 OptionLabel::~OptionLabel(void) 1579 1452 { 1580 this->destroy();1581 }1582 1583 /**1584 \brief Initializes an OptionLabel1585 */1586 void OptionLabel::init(void)1587 {1588 this->isOption = 5;1589 static_cast<Option*>(this)->init();1590 1591 cValue = NULL;1592 1593 #ifdef HAVE_GTK21594 this->widget = gtk_label_new("");1595 #endif /* HAVE_GTK2 */1596 }1597 1598 /**1599 \brief Destroys a OptionLabel.1600 */1601 void OptionLabel::destroy(void)1602 {1603 1453 if (this->title) 1604 1454 PRINTF(3)("deleting the OptionLabel: %s\n", this->title); … … 1607 1457 if (this->cValue) 1608 1458 delete []this->cValue; 1609 1610 static_cast<Option*>(this)->destroy(); 1611 } 1612 1459 } 1460 1461 /** 1462 \brief Initializes an OptionLabel 1463 */ 1464 void OptionLabel::init(void) 1465 { 1466 this->isOption = 5; 1467 cValue = NULL; 1468 1469 #ifdef HAVE_GTK2 1470 this->widget = gtk_label_new(""); 1471 #endif /* HAVE_GTK2 */ 1472 } 1613 1473 1614 1474 /** … … 1689 1549 Label::~Label(void) 1690 1550 { 1691 this->destroy();1692 }1693 1694 /**1695 \brief initializes a new Label1696 */1697 void Label::init(void)1698 {1699 this->isOption = 0;1700 1701 static_cast<Widget*>(this)->init();1702 1703 #ifdef HAVE_GTK21704 this->widget = gtk_label_new("");1705 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);1706 #endif /* HAVE_GTK2 */1707 }1708 1709 /**1710 \brief Destroys a Label.1711 */1712 void Label::destroy(void)1713 {1714 1551 if (this->title) 1715 1552 PRINTF(3)("deleting the Label: %s\n", this->title); 1716 1553 else 1717 1554 PRINTF(3)("deleting the Label.\n"); 1718 1719 static_cast<Widget*>(this)->destroy(); 1555 } 1556 1557 /** 1558 \brief initializes a new Label 1559 */ 1560 void Label::init(void) 1561 { 1562 this->isOption = 0; 1563 1564 #ifdef HAVE_GTK2 1565 this->widget = gtk_label_new(""); 1566 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1567 #endif /* HAVE_GTK2 */ 1720 1568 } 1721 1569 … … 1813 1661 ProgressBar::~ProgressBar(void) 1814 1662 { 1815 this->destroy(); 1663 if (this->title) 1664 PRINTF(3)("deleting the ProgressBar: %s\n", this->title); 1665 else 1666 PRINTF(3)("deleting the ProgressBar.\n"); 1816 1667 } 1817 1668 … … 1825 1676 this->totalSize = 0.0; 1826 1677 1827 static_cast<Widget*>(this)->init();1828 1678 #ifdef HAVE_GTK2 1829 1679 this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); 1830 1680 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1831 1681 #endif /* HAVE_GTK2 */ 1832 }1833 1834 /**1835 \brief Destroys a ProgressBar.1836 */1837 void ProgressBar::destroy(void)1838 {1839 if (this->title)1840 PRINTF(3)("deleting the ProgressBar: %s\n", this->title);1841 else1842 PRINTF(3)("deleting the ProgressBar.\n");1843 1844 static_cast<Widget*>(this)->destroy();1845 1682 } 1846 1683 … … 1913 1750 Image::~Image(void) 1914 1751 { 1915 this->destroy();1916 }1917 1918 /**1919 \brief Initializes a new Image1920 */1921 void Image::init(void)1922 {1923 isOption = 0;1924 1925 static_cast<Widget*>(this)->init();1926 }1927 1928 /**1929 \brief Destroys a Image.1930 */1931 void Image::destroy(void)1932 {1933 1752 if (this->title) 1934 1753 PRINTF(3)("deleting the Image: %s\n", this->title); 1935 1754 else 1936 1755 PRINTF(3)("deleting the Image.\n"); 1937 1938 static_cast<Widget*>(this)->destroy(); 1756 } 1757 1758 /** 1759 \brief Initializes a new Image 1760 */ 1761 void Image::init(void) 1762 { 1763 isOption = 0; 1939 1764 } 1940 1765 -
orxonox/trunk/src/lib/gui/gui/orxonox_gui_gtk.h
r3590 r3623 39 39 40 40 public: 41 Widget(void); 41 42 virtual ~Widget(void); 42 void init(void);43 void destroy(void);44 43 45 44 void show(void); … … 90 89 { 91 90 public: 91 Packer(void); 92 virtual ~Packer(void); 93 92 94 Widget* down; //!< this points to the Widget below this. 93 95 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 94 95 void init(void);96 void destroy(void);97 96 98 97 void setGroupName(char* name); … … 115 114 116 115 public: 117 void init(void); 118 void destroy(void); 119 116 Container(void); 117 virtual ~Container(void); 120 118 // void setBorderWidth(int borderwidth); 121 119 // virtual void setTitle(char* title) = 0; … … 138 136 Window(void); 139 137 Window(char* windowName); 140 ~Window(void); 141 void init(void); 142 void destroy(void); 138 virtual ~Window(void); 139 void init(void); 143 140 144 141 void setTitle(char* title); … … 164 161 Frame(void); 165 162 Frame(char* frameName); 166 ~Frame(void); 167 void init(void); 168 void destroy(void); 163 virtual ~Frame(void); 164 void init(void); 169 165 170 166 void setTitle(char* title); … … 180 176 EventBox(void); 181 177 EventBox(char* eventBoxName); 182 ~EventBox(void); 183 void init(void); 184 void destroy(void); 178 virtual ~EventBox(void); 179 void init(void); 185 180 186 181 void setTitle(char* title); … … 198 193 Box(void); 199 194 Box(char boxtype); 200 ~Box(void);195 virtual ~Box(void); 201 196 void init(char boxtype); 202 void destroy(void);203 197 204 198 void fill(Widget* lowerWidget); … … 217 211 218 212 public: 219 void init(void); 220 void destroy(void); 213 Option(void); 214 virtual ~Option(void); 215 void init(void); 221 216 222 217 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume … … 246 241 public: 247 242 Button(char* buttonname); 248 ~Button(void); 249 void init(void); 250 void destroy(void); 243 virtual ~Button(void); 244 void init(void); 251 245 252 246 void setTitle(char* title); … … 262 256 public: 263 257 CheckButton(char* buttonname); 264 ~CheckButton(void); 265 void init(void); 266 void destroy(void); 258 virtual ~CheckButton(void); 259 void init(void); 267 260 268 261 void setTitle(char* title); … … 283 276 public: 284 277 Slider(char* slidername, int start, int end); 285 ~Slider(void);278 virtual ~Slider(void); 286 279 void init(int start, int end); 287 void destroy(void);288 280 289 281 void setTitle(char* title); … … 305 297 public: 306 298 Menu(char* menuname, ...); 307 ~Menu(void); 308 void init(void); 309 void destroy(void); 299 virtual ~Menu(void); 300 void init(void); 310 301 311 302 void setTitle(char* title); … … 322 313 public: 323 314 OptionLabel(char* label, char* value); 324 ~OptionLabel(void); 325 void init(void); 326 void destroy(void); 327 315 virtual ~OptionLabel(void); 316 void init(void); 328 317 329 318 void setValue(char* newValue); … … 342 331 Label(void); 343 332 Label(char* text); 344 ~Label(void); 345 void init(void); 346 void destroy(void); 333 virtual ~Label(void); 334 void init(void); 347 335 348 336 void setTitle(char* text); … … 359 347 ProgressBar(void); 360 348 ProgressBar(char* label); 361 ~ProgressBar(void); 362 void init(void); 363 void destroy(void); 349 virtual ~ProgressBar(void); 350 void init(void); 364 351 365 352 void setTitle(char* title); … … 385 372 public: 386 373 Image(char* imgaename); 387 ~Image(void); 388 void init(void); 389 void destroy(void); 374 virtual ~Image(void); 375 void init(void); 390 376 391 377 void setTitle(char* title);
Note: See TracChangeset
for help on using the changeset viewer.