Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1973 in orxonox.OLD for orxonox/branches


Ignore:
Timestamp:
Jun 17, 2004, 6:29:33 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/gui/guicc: added notes in Doxygen-style to all function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/gui/guicc/orxonox_gui.cc

    r1965 r1973  
    44
    55int main( int argc, char *argv[] )
    6   {
    7     gtk_init (&argc, &argv);
    8     Window* orxonoxGUI = new Window("Graphical Orxonox Launcher");
    9     orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit);
    10     orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit);
    11 
    12     Frame* Frametest = new Frame ("Test");
    13     orxonoxGUI->fill((Frame*) Frametest);
    14     Box* box = new Box ('v');
    15     Frametest->fill(box);
    16 
    17     CheckButton* button = new CheckButton("test");
    18     button->connectSignal ("clicked", orxonoxGUI->orxonox_gui_quit);
    19     box->fill(button);
    20     Slider* slider = new Slider("testslider", 0, 100);
    21     slider->connectSignal ("value_changed", slider->OptionChange);
    22     box->fill(slider);
    23 
    24     orxonoxGUI->showall ();
    25 
    26     gtk_main();
    27     return 0;
    28   }
     6{
     7  gtk_init (&argc, &argv);
     8  Window* orxonoxGUI = new Window("Graphical Orxonox Launcher");
     9  orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit);
     10  orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit);
     11 
     12  Frame* Frametest = new Frame ("Test");
     13  orxonoxGUI->fill((Frame*) Frametest);
     14  Box* box = new Box ('v');
     15  Frametest->fill(box);
     16 
     17  CheckButton* button = new CheckButton("test");
     18  button->connectSignal ("clicked", orxonoxGUI->orxonox_gui_quit);
     19  box->fill(button);
     20  Slider* slider = new Slider("testslider", 0, 100);
     21  slider->connectSignal ("value_changed", slider->OptionChange);
     22  box->fill(slider);
     23 
     24  orxonoxGUI->showall ();
     25 
     26  gtk_main();
     27  return 0;
     28}
    2929
    3030
     
    3232void Widget::show()
    3333{
     34  /**
     35   * Function to Show any Widget
     36   */
    3437  gtk_widget_show (widget);
    3538}
     
    3740void Widget::connectSignal (char* event, gint ( *signal)( GtkWidget*, GdkEvent*, void *))
    3841{
     42  /**
     43   * Connect any signal to any given Sub-widget
     44   */
    3945  g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL);
    4046}
     
    4248void Widget::connectSignal (char* event, gint ( *signal)( GtkWidget*, Widget *))
    4349{
     50  /**
     51   * Connect a signal with additionally passing the whole Object
     52   */
    4453  g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), this);
    4554}
     
    4958void Container::fill (Widget *lowerWidget)
    5059{
     60  /**
     61   * fill any given Container with a lowerwidet
     62   */
    5163  gtk_container_add (GTK_CONTAINER(this->widget), lowerWidget->widget);
    5264  this->down = lowerWidget;
     
    5971Window::Window (void)
    6072{
     73  /**
     74   * Creating a Window
     75   */
    6176  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    6277  gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE);
     
    6580Window::Window (char* windowName)
    6681{
     82  /**
     83   * Creating a Window with passing a name
     84   */
    6785  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    6886  gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE);
     
    7189
    7290Window::~Window ()
    73 {}
     91{
     92  /**
     93   * Destoying a Window (not implemented)
     94   */
     95}
    7496
    7597void Window::showall ()
    7698{
     99  /**
     100   * Shows all Widgets that are included within this Widget
     101   */
    77102  gtk_widget_show_all  (widget);
    78103}
     
    80105void Window::setTitle (char* title)
    81106{
     107  /**
     108   * Set The Window title to title
     109   */
    82110  gtk_window_set_title (GTK_WINDOW (widget), title);
    83111}
     
    86114gint Window::orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data)
    87115{
     116  /**
     117   * Quits the orxonox_GUI
     118   */
    88119  gtk_main_quit();
    89120  return FALSE;
     
    95126Frame::Frame (void)
    96127{
     128  /**
     129   * Creates a new Frame without a name
     130   */
    97131  widget = gtk_frame_new ("");
    98132}
    99133Frame::Frame (char* title)
    100134{
     135  /**
     136   * Creates a new Frame with name title
     137   */
    101138  widget = gtk_frame_new (title);
    102139}
    103140Frame::~Frame ()
    104 {}
     141{
     142  /**
     143   * Destroys given Frame (not implemented yet)
     144   */
     145}
    105146
    106147void Frame::setTitle (char* title)
    107148{
     149  /**
     150   * Sets the Frames name to title
     151   */
    108152  gtk_frame_set_label (GTK_FRAME (widget), title);
    109153}
     
    115159Box::Box (void)
    116160{
     161  /**
     162   * Creates a new horizontal Box
     163   */
    117164  widget = gtk_hbox_new(FALSE, 0);
    118165}
    119166Box::Box (char boxtype)
    120167{
     168  /**
     169   * Creates a new Box if boxtype is 'v' it will be vertically, if 'h' it will be horizontally
     170   */
    121171  if (boxtype == 'v')
    122172    {
     
    130180
    131181Box::~Box ()
    132 {}
     182{
     183  /**
     184   * Destroys given Frame (not implemented yet)
     185   */
     186}
    133187
    134188void Box::fill (Widget *lowerWidget)
    135189{
     190  /**
     191   * Fill a Box with its lowerwidgets
     192   */
    136193  gtk_box_pack_start (GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0);
    137194}
     
    143200Button::Button(char* buttonname)
    144201{
     202  /**
     203   * Creates a new Button with name buttonname
     204   */
    145205  widget = gtk_button_new_with_label(buttonname);
     206  option_name = buttonname;
    146207}
    147208
     
    149210CheckButton::CheckButton(char* buttonname)
    150211{
     212  /**
     213   * Creates a new CheckButton with name buttonname
     214   */
    151215  widget = gtk_check_button_new_with_label(buttonname);
     216  option_name = buttonname;
    152217}
    153218
     
    155220Slider::Slider (char* slidername, int start, int end)
    156221{
     222  /**
     223   * Creates a new Slider with name slidername a beginning value of start and an end value of end.
     224   */
    157225  widget = gtk_hscale_new_with_range (start, end, 5);
    158226  value = start;
     
    162230gint Slider::OptionChange (GtkWidget *widget, Widget* slider)
    163231{
    164   //Slider * superslider = dynamic_cast<Slider*>(slider)
    165     //  dynamic_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE((Slider*)slider->widget));
    166   cout << (int)gtk_range_get_value (GTK_RANGE((Slider*)slider->widget)) << endl;
    167 }
     232  /**
     233   * Writes value, if changed on the slider, to the object.
     234   */
     235  static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE((Slider*)slider->widget));
     236  cout << static_cast<Slider*>(slider)->value << endl;
     237}
Note: See TracChangeset for help on using the changeset viewer.