Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 28, 2004, 9:46:54 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/updater: nicer optionChange-Function

File:
1 edited

Legend:

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

    r3300 r3304  
    955955}
    956956
     957#ifdef HAVE_GTK2
     958/**
     959    \brief Signal OptionChange writes the Value from the Slider to its Object-Database.
     960    \param widget The widget(Slider) that has a changed Value
     961    \param slider the Slider-Object that should receive the change.
     962*/
     963gint Option::OptionChange (GtkWidget *widget, Widget* option)
     964{
     965  static_cast<Option*>(option)->changeOption();
     966  flags->setTextFromFlags(orxonoxGUI);  //// must be different !!!
     967}
     968#endif /* HAVE_GTK2 */
     969
     970
    957971/* BUTTON */
    958972
     
    10211035   not implemented yet
    10221036*/
    1023 void Button::redraw ()
    1024 {
     1037void Button::redraw (void)
     1038{
     1039}
     1040
     1041/**
     1042   \brief Button can not be changed, optionChange is empty)
     1043*/
     1044void Button::changeOption(void)
     1045{
     1046 
    10251047}
    10261048
     
    10981120}
    10991121
    1100 #ifdef HAVE_GTK2
    1101 /**
    1102     \brief Signal OptionChange writes the Value from the CheckButton to its Object-Database.
    1103     \param widget The widget(CheckButton) that has a changed Value
    1104     \param checkbutton the CheckButton-Object that should receive the change.
    1105 */
    1106 gint CheckButton::OptionChange (GtkWidget *widget, Widget* checkbutton)
    1107 {
    1108   static_cast<CheckButton*>(checkbutton)->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((CheckButton*)checkbutton->widget));
    1109   flags->setTextFromFlags(orxonoxGUI);   ////// must be different!!!
    1110   cout << static_cast<CheckButton*>(checkbutton)->title << " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl;
    1111 }
    1112 #endif /* HAVE_GTK2 */
     1122/**
     1123   \brief Changed the Option, call this Function
     1124*/
     1125void CheckButton::changeOption()
     1126{
     1127#ifdef HAVE_GTK2
     1128  this->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this->widget));
     1129#endif /* HAVE_GTK2 */
     1130  cout << this->title << " set to: " << this->value << endl;
     1131}
     1132
    11131133
    11141134/**
     
    12101230}
    12111231
    1212 #ifdef HAVE_GTK2
    1213 /**
    1214     \brief Signal OptionChange writes the Value from the Slider to its Object-Database.
    1215     \param widget The widget(Slider) that has a changed Value
    1216     \param slider the Slider-Object that should receive the change.
    1217 */
    1218 gint Slider::OptionChange (GtkWidget *widget, Widget* slider)
    1219 {
    1220   static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE ((Slider*)slider->widget));
    1221   flags->setTextFromFlags(orxonoxGUI);  //// must be different !!!
    1222   cout << static_cast<Slider*>(slider)->title << " set to: "<< static_cast<Slider*>(slider)->value << endl;
    1223 }
    1224 #endif /* HAVE_GTK2 */
    1225 
     1232/**
     1233   \brief Changed the Option, call this Function
     1234*/
     1235void Slider::changeOption()
     1236{
     1237#ifdef HAVE_GTK2
     1238  this->value = (int)gtk_range_get_value(GTK_RANGE(this->widget));
     1239#endif /* HAVE_GTK2 */
     1240  cout << this->title << " set to: " << this->value << endl;
     1241}
    12261242
    12271243/* MENU */
     
    13291345}
    13301346
    1331 #ifdef HAVE_GTK2
    1332 /**
    1333     \brief Signal OptionChange writes the Value from the Menu to its Object-Database.
    1334     \param widget The widget(Menu) that has a changed Value
    1335     \param menu the Menu-Object that should receive the change.
    1336 */
    1337 gint Menu::OptionChange (GtkWidget *widget, Widget* menu)
    1338 {
    1339   static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (menu->widget));
    1340   flags->setTextFromFlags(orxonoxGUI); //// must be different !!!
    1341   cout << static_cast<Menu*>(menu)->title << " changed to : " << static_cast<Menu*>(menu)->value << endl;
    1342 }
    1343 #endif /* HAVE_GTK2 */
     1347/**
     1348   \brief Changed the Option, call this Function
     1349*/
     1350void Menu::changeOption()
     1351{
     1352#ifdef HAVE_GTK2
     1353  this->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (this->widget));
     1354#endif /* HAVE_GTK2 */
     1355  cout << this->title << " set to: " << this->value << endl;
     1356}
    13441357
    13451358/* OPTION LABEL */
     
    14211434  strcpy(this->title, title);
    14221435#ifdef HAVE_GTK2
    1423   gtk_label_set_text (GTK_LABEL (widget), title);
     1436  gtk_label_set_text (GTK_LABEL(widget), title);
    14241437#endif /* HAVE_GTK2 */
    14251438}
     
    14321445 
    14331446}
     1447
     1448/**
     1449   \brief Changed the Option, call this Function
     1450*/
     1451void OptionLabel::changeOption()
     1452{
     1453#ifdef HAVE_GTK2
     1454  this->cValue = (char*)gtk_label_get_text (GTK_LABEL(this->widget));
     1455#endif /* HAVE_GTK2 */
     1456  cout << this->title << " set to: " << this->cValue << endl;
     1457}
     1458
    14341459
    14351460/**
Note: See TracChangeset for help on using the changeset viewer.