Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3165 in orxonox.OLD for orxonox/trunk/gui/orxonox_gui_gtk.cc


Ignore:
Timestamp:
Dec 13, 2004, 2:17:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: compiling as not-GTK possibe, but it is not usable yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/gui/orxonox_gui_gtk.cc

    r3164 r3165  
    3939extern OrxonoxGuiExec* exec;
    4040
     41#ifdef HAVE_GTK2
    4142bool initGTK(int argc, char *argv[])
    4243{
     
    4849  gtk_main();
    4950}
     51#endif /* HAVE_GTK2 */
     52
    5053/* WIDGET */
    5154
     
    8790void Widget::show()
    8891{
     92#ifdef HAVE_GTK2
    8993  gtk_widget_show (this->widget);
     94#endif /* HAVE_GTK2 */
    9095}
    9196
     
    95100void Widget::hide()
    96101{
     102#ifdef HAVE_GTK2
    97103  gtk_widget_hide (this->widget);
     104#endif /* HAVE_GTK2 */
    98105}
    99106
     
    105112void Widget::setSize(int width, int height)
    106113{
     114#ifdef HAVE_GTK2
    107115  gtk_widget_set_usize (this->widget, width, height);
    108 }
    109 
     116#endif /* HAVE_GTK2 */
     117}
     118
     119#ifdef HAVE_GTK2
    110120/**
    111121    \brief Connect any signal to any given Sub-widget
     
    144154  g_signal_handler_disconnect (G_OBJECT (this->widget), signalID);
    145155}
     156#endif /* HAVE_GTK2 */
    146157
    147158/**
     
    181192}
    182193
     194#ifdef HAVE_GTK2
    183195gint Widget::doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing)
    184196{
    185197}
     198#endif /* HAVE_GTK2 */
    186199
    187200//void deleteWidget(Widget* lastWidget)
     
    249262  if (this->down == NULL)
    250263    {
     264#ifdef HAVE_GTK2
    251265      gtk_container_add (GTK_CONTAINER (this->widget), lowerWidget->widget);
     266#endif /* HAVE_GTK2 */
    252267      this->down = lowerWidget;
    253268    }
     
    310325  static_cast<Container*>(this)->init();
    311326
     327#ifdef HAVE_GTK2
    312328  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    313329  gtk_window_set_policy (GTK_WINDOW(widget), TRUE, TRUE, TRUE);
     
    316332#endif
    317333  gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
    318 
     334#endif /* HAVE_GTK2 */
    319335}
    320336
     
    327343    {
    328344      printf ("showall\n");
     345#ifdef HAVE_GTK2
    329346      gtk_widget_show_all  (widget);
    330       isOpen = true;
     347#endif /* HAVE_GTK2 */
     348     isOpen = true;
    331349    }
    332350  else
    333351    {
    334352      printf ("showone\n");
     353#ifdef HAVE_GTK2
    335354      gtk_widget_show (widget);
     355#endif /* HAVE_GTK2 */
    336356    }
    337357}
     
    347367  label = new char[strlen(title)+1];
    348368  strcpy(label, title);
     369#ifdef HAVE_GTK2
    349370  gtk_window_set_title (GTK_WINDOW (widget), title);
     371#endif /* HAVE_GTK2 */
    350372}
    351373
     
    358380    {
    359381      isOpen = true;
     382#ifdef HAVE_GTK2
    360383      gtk_widget_show_all(widget);
    361384      gtk_grab_add(widget);
     385#endif /* HAVE_GTK2 */
    362386    }
    363387}
     
    371395    {
    372396      isOpen = false;
     397#ifdef HAVE_GTK2
    373398      gtk_grab_remove(widget);
    374399      gtk_widget_hide (widget);
     400#endif /* HAVE_GTK2 */
    375401    }
    376402}
    377403
     404#ifdef HAVE_GTK2
    378405/**
    379406   \brief opens up a window (not topmost Window).
     
    415442  return FALSE;
    416443}
     444#endif /* HAVE_GTK2 */
    417445
    418446
     
    442470{
    443471  static_cast<Container*>(this)->init();
    444  
     472
     473#ifdef HAVE_GTK2
    445474  widget = gtk_frame_new ("");
    446475  gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     476#endif /* HAVE_GTK2 */
    447477}
    448478
     
    457487  label = new char[strlen(title)+1];
    458488  strcpy(label, title);
     489#ifdef HAVE_GTK2
    459490  gtk_frame_set_label (GTK_FRAME (widget), title);
     491#endif /* HAVE_GTK2 */
    460492}
    461493
     
    488520  static_cast<Container*>(this)->init();
    489521
     522#ifdef HAVE_GTK2
    490523  widget = gtk_event_box_new ();
    491524  gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
    492  
     525#endif /* HAVE_GTK2 */
    493526}
    494527
     
    533566
    534567  static_cast<Packer*>(this)->init();
     568#ifdef HAVE_GTK2
    535569  if (boxtype == 'v')
    536570    {
     
    541575      widget = gtk_hbox_new (FALSE, 0);
    542576    }
     577#endif /* HAVE_GTK2 */
     578
    543579}
    544580
     
    550586void Box::fill (Widget *lowerWidget)
    551587{
     588#ifdef HAVE_GTK2
    552589  gtk_box_pack_start (GTK_BOX (this->widget), lowerWidget->widget, TRUE, TRUE, 0);
     590#endif /* HAVE_GTK2 */
    553591  if (this->down == NULL)
    554592    this->down = lowerWidget;
     
    579617
    580618  this->init();
     619#ifdef HAVE_GTK2
    581620  widget = gtk_image_new_from_file (imagename);
     621#endif /* HAVE_GTK2 */
    582622}
    583623
     
    671711  static_cast<Option*>(this)->init();
    672712
     713#ifdef HAVE_GTK2
    673714  widget = gtk_button_new_with_label ("");
     715#endif /* HAVE_GTK2 */
    674716}
    675717
     
    684726  label = new char[strlen(title)+1];
    685727  strcpy(label, title);
     728#ifdef HAVE_GTK2
    686729  gtk_button_set_label (GTK_BUTTON(widget), title);
     730#endif /* HAVE_GTK2 */
    687731}
    688732
     
    706750  this->setTitle(buttonname);
    707751
     752#ifdef HAVE_GTK2
    708753  this->connectSignal ("clicked", this->OptionChange);
     754#endif /* HAVE_GTK2 */
    709755}
    710756
     
    718764  static_cast<Option*>(this)->init();
    719765
     766#ifdef HAVE_GTK2
    720767  widget = gtk_check_button_new_with_label ("");
     768#endif /* HAVE_GTK2 */
    721769}
    722770
     
    731779  label = new char[strlen(title)+1];
    732780  strcpy(label, title);
     781#ifdef HAVE_GTK2
    733782  gtk_button_set_label(GTK_BUTTON(widget), title);
     783#endif /* HAVE_GTK2 */
    734784}
    735785
    736786bool CheckButton::isActive()
    737787{
     788#ifdef HAVE_GTK2
    738789  return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
    739 }
    740 
     790#endif /* HAVE_GTK2 */
     791}
     792
     793#ifdef HAVE_GTK2
    741794/**
    742795    \brief Signal OptionChange writes the Value from the CheckButton to its Object-Database.
     
    750803  cout << static_cast<CheckButton*>(checkbutton)->label << " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl;
    751804}
     805#endif /* HAVE_GTK2 */
    752806
    753807/**
     
    757811void CheckButton::redraw ()
    758812{
     813#ifdef HAVE_GTK2
    759814  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
     815#endif /* HAVE_GTK2 */
    760816}
    761817
     
    773829  this->setValue(start);
    774830  this->setTitle(slidername);
     831#ifdef HAVE_GTK2
    775832  this->connectSignal ("value_changed", this->OptionChange);
     833#endif /* HAVE_GTK2 */
    776834}
    777835
     
    786844  static_cast<Option*>(this)->init();
    787845
    788   widget = gtk_hscale_new_with_range (start, end, 5);
     846#ifdef HAVE_GTK2
     847 widget = gtk_hscale_new_with_range (start, end, 5);
     848#endif /* HAVE_GTK2 */
    789849}
    790850
     
    810870}
    811871
     872#ifdef HAVE_GTK2
    812873/**
    813874    \brief Signal OptionChange writes the Value from the Slider to its Object-Database.
     
    821882  cout << static_cast<Slider*>(slider)->label << " set to: "<< static_cast<Slider*>(slider)->value << endl;
    822883}
     884#endif /* HAVE_GTK2 */
    823885
    824886/**
     
    828890void Slider::redraw ()
    829891{
     892#ifdef HAVE_GTK2
    830893  gtk_range_set_value (GTK_RANGE (widget), value);
     894#endif /* HAVE_GTK2 */
    831895}
    832896
     
    845909   
    846910  char *itemName;
    847  
     911
     912#ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
    848913  va_start (itemlist, menuname);
    849914  while (strcmp (itemName = va_arg (itemlist, char*), "lastItem"))
     
    852917    }
    853918  va_end(itemlist);
    854 
     919#endif /* HAVE_GTK2 */
     920
     921#ifdef HAVE_GTK2
    855922  gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);
    856923  this->connectSignal ("changed", this->OptionChange);
     924#endif /* HAVE_GTK2 */
    857925}
    858926
     
    866934  static_cast<Option*>(this)->init();
    867935
     936#ifdef HAVE_GTK2
    868937  widget = gtk_option_menu_new ();
    869938  menu = gtk_menu_new ();
     939#endif /* HAVE_GTK2 */
    870940
    871941}
     
    889959void Menu::addItem (char* itemName)
    890960{
     961#ifdef HAVE_GTK2
    891962  item = gtk_menu_item_new_with_label (itemName);
    892963  gtk_menu_shell_append(GTK_MENU_SHELL (menu), item);
    893 }
    894 
     964#endif /* HAVE_GTK2 */
     965}
     966
     967#ifdef HAVE_GTK2
    895968/**
    896969    \brief Signal OptionChange writes the Value from the Menu to its Object-Database.
     
    904977  cout << static_cast<Menu*>(menu)->label << " changed to : " << static_cast<Menu*>(menu)->value << endl;
    905978}
     979#endif /* HAVE_GTK2 */
    906980
    907981/**
     
    911985void Menu::redraw ()
    912986{
    913   gtk_option_menu_set_history (GTK_OPTION_MENU (widget), value);
     987#ifdef HAVE_GTK2
     988 gtk_option_menu_set_history (GTK_OPTION_MENU (widget), value);
     989#endif /* HAVE_GTK2 */
    914990}
    915991
     
    9271003  cValue = NULL;
    9281004
     1005#ifdef HAVE_GTK2
    9291006  widget = gtk_label_new ("");
    930 }
     1007#endif /* HAVE_GTK2 */
     1008}
     1009
    9311010void OptionLabel::setValue(char* newValue)
    9321011{
     
    9351014  cValue = new char [strlen(newValue)+1];
    9361015  strcpy(cValue, newValue);
     1016#ifdef HAVE_GTK2
    9371017  gtk_label_set_text (GTK_LABEL (widget), cValue);
     1018#endif /* HAVE_GTK2 */
    9381019}
    9391020
     
    9441025  label = new char [strlen(title)+1];
    9451026  strcpy(label, title);
     1027#ifdef HAVE_GTK2
    9461028  gtk_label_set_text (GTK_LABEL (widget), title);
     1029#endif /* HAVE_GTK2 */
    9471030}
    9481031
     
    9801063  static_cast<Widget*>(this)->init();
    9811064
     1065#ifdef HAVE_GTK2
    9821066  widget = gtk_label_new ("");
    9831067  gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);
     1068#endif /* HAVE_GTK2 */
    9841069}
    9851070
     
    9941079  label = new char[strlen(text)+1];
    9951080  strcpy(label, text);
     1081#ifdef HAVE_GTK2
    9961082  gtk_label_set_text (GTK_LABEL (this->widget), text);
     1083#endif /* HAVE_GTK2 */
    9971084}
    9981085
     
    10031090char* Label::getText ()
    10041091{
    1005   return ((char*)gtk_label_get_text (GTK_LABEL (this->widget)));
    1006 }
     1092  return label;
     1093}
Note: See TracChangeset for help on using the changeset viewer.