Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2588 in orxonox.OLD for orxonox/trunk/gui/orxonox_gui.cc


Ignore:
Timestamp:
Oct 17, 2004, 5:18:58 PM (21 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: doxygen orxodox created for all h-files, classes and functions.

File:
1 edited

Legend:

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

    r2587 r2588  
    4848/* ORXONOXGUI */
    4949
     50/**
     51 * Initializes the Gui
     52*/
    5053OrxonoxGui::OrxonoxGui (int argc, char *argv[])
    5154{
    52   /**
    53    * Initializes the Gui
    54    */
    5555  gtk_init (&argc, &argv);
    5656  gtk_rc_parse( "rc" );
     
    9999
    100100/* WIDGET */
    101 
     101/**
     102 * Initializes a widget.
     103 * Nothing to do here.
     104 */
    102105void Widget::init()
    103106{
     
    105108}
    106109
     110/**
     111 * Connect any signal to any given Sub-widget
     112 */
    107113void Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    108114{
    109   /**
    110    * Connect any signal to any given Sub-widget
    111    */
    112115  g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL);
    113116}
    114117
     118/**
     119 * Connect a signal with additionally passing the whole Object
     120 */
    115121void Widget::connectSignal (char* event, gint (*signal)( GtkWidget*, Widget *))
    116122{
    117   /**
    118    * Connect a signal with additionally passing the whole Object
    119    */
    120123g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), this);
    121124}
    122125
     126/**
     127 * Connect a signal with additionally passing a whole external Object
     128 */
    123129void Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    124130{
    125   /**
    126    * Connect a signal with additionally passing a whole external Object
    127    */
    128131  g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
    129132}
     133
     134
     135/**
     136 * Function to Shows a specific widget.
     137 */
    130138void Widget::show()
    131139{
    132   /**
    133    * Function to Show any Widget
    134    */
    135   gtk_widget_show (widget);
    136 }
    137 
     140  gtk_widget_show (this->widget);
     141}
     142
     143/**
     144 * Moves through all the Widgets downwards from this and executes the function on them.
     145 \param function must be of type void and takes a Widget* as an Input.
     146
     147 */
    138148void Widget::walkThrough (void (*function)(Widget*))
    139149{
    140   /**
    141    * Moves Through all the Widgets downwards from this and executes the function on them.
    142    * function must be of type void and takes a Widget* as an Input.
    143    */
    144150  function(this);
    145151  switch (this->is_option)
     
    158164
    159165
     166/**
     167 * This is for listing the option of "widget"
     168 \param widget specifies the widget that should be listed
     169*/
    160170void Widget::listOptions (Widget* widget)
    161171{
    162   /**
    163    * This is for listing the option of "widget"
    164    */
    165172  if (widget->is_option >= 1)
    166173    cout << static_cast<Option*>(widget)->option_name <<" is : " << static_cast<Option*>(widget)->value <<endl;
    167174}
    168175
     176/**
     177 * This is for setting the option of "widget"
     178 \param widget specifies the widget that should be set.
     179*/
    169180void Widget::setOptions (Widget* widget)
    170181{
    171   /**
    172    * This is for setting the option of "widget"
    173    */
    174182  if (widget->is_option >= 1)
    175183    static_cast<Option*>(widget)->redraw();// <<" is : " << static_cast<Option*>(this)->value <<endl;
     
    177185
    178186/* CONTAINERS*/
     187
     188/**
     189 * Initializes a Container.
     190 * nothing to do here
     191 */
    179192void Container::init (void)
    180193{
    181194  return;
    182195}
     196
     197/**
     198 * Fills a Container with lowerWidget.
     199 * It does this by filling up the down pointer only if down points to NULL.
     200 \param lowerWidget the Widget that should be filled into the Container.
     201*/
    183202void Container::fill (Widget *lowerWidget)
    184203{
    185   /**
    186    * fills any given Container with a lowerwidet
    187    */
    188204  if (this->down == NULL)
    189205    {
     
    199215/* WINDOW */
    200216
     217  /**
     218   * Creating a new Window without a Name
     219   */
    201220Window::Window (void)
    202221{
    203   /**
    204    * Creating a Window
    205    */
    206   this->init();
    207 }
    208 
     222  this->init();
     223}
     224
     225/**
     226 * Creating a Window with a name
     227 \param windowName the name the window should get.
     228 */
    209229Window::Window (char* windowName)
    210230{
    211   /**
    212    * Creating a Window with passing a name
    213    */
    214231  this->init();
    215232  this->setTitle (windowName);
    216233}
    217234
     235/**
     236 * Destoying a Window (very BAD implemented).
     237 * For now it just hides the window.
     238 */
    218239Window::~Window ()
    219240{
    220   /**
    221    * Destoying a Window (very BAD implemented)
    222    */
    223241  gtk_widget_hide (widget);
    224  
    225 }
    226 
     242}
     243
     244/**
     245 *initializes a new Window
     246 */
    227247void Window::init()
    228248{
    229   /**
    230   *initializes a new Window
    231   */
    232249  is_option = -1;
    233250  next = NULL;
     
    241258}
    242259
     260/**
     261 * Shows all Widgets that are included within this->widget.
     262 */
    243263void Window::showall ()
    244264{
    245   /**
    246    * Shows all Widgets that are included within this Widget
    247    */
    248265  gtk_widget_show_all  (widget);
    249266}
    250267
     268/**
     269 * Set The Window-title to title
     270 \param title title the Window should get.
     271*/
    251272void Window::setTitle (char* title)
    252273{
    253   /**
    254    * Set The Window title to title
    255    */
    256274  gtk_window_set_title (GTK_WINDOW (widget), title);
    257275}
    258276
    259 
     277/**
     278 * Quits the orxonox_GUI.
     279 * This can be called as a Signal and is therefor static
     280 \param widget The widget that called this function
     281 \param event the event that happened to execute this function
     282 \param data some data passed with the Signal
     283 */
    260284gint Window::orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data)
    261285{
    262   /**
    263    * Quits the orxonox_GUI
    264    */
    265286  if (exec->shouldsave())
    266287    exec->writeToFile (orxonoxGUI);
     
    273294/* FRAME */
    274295
     296/**
     297 * Creates a new Frame without a name
     298 */
    275299Frame::Frame (void)
    276300{
    277   /**
    278    * Creates a new Frame without a name
    279    */
    280   this->init();
    281 }
     301  this->init();
     302}
     303
     304/**
     305 * Creates a new Frame with name title
     306 */
    282307Frame::Frame (char* title)
    283308{
    284   /**
    285    * Creates a new Frame with name title
    286    */
    287309  this->init();
    288310  this->setTitle(title);
    289311}
     312
     313/**
     314 * Destroys given Frame (not implemented yet)
     315 */
    290316Frame::~Frame ()
    291317{
    292   /**
    293    * Destroys given Frame (not implemented yet)
    294    */
    295 }
    296 
     318}
     319
     320/**
     321 * Initializes a new Frame with default settings
     322 */
    297323void Frame::init()
    298324{
     
    304330}
    305331
     332/**
     333 * Sets the Frames name to title
     334 \param title The title the Frame should get.
     335 */
    306336void Frame::setTitle (char* title)
    307337{
    308   /**
    309    * Sets the Frames name to title
    310    */
    311338  gtk_frame_set_label (GTK_FRAME (widget), title);
    312339}
    313340
    314341// EVENTBOX //
     342
     343/**
     344 * Creates a new EventBox with default settings.
     345 */
    315346EventBox::EventBox ()
    316347{
    317348  this->init();
    318349}
    319 
     350/**
     351 * Creates a new EventBox with name title
     352 \param title title the Eventbox should get (only data-structure-internal)
     353*/
    320354EventBox::EventBox (char* title)
    321355{
    322   /**
    323    * Creates a new EventBox with name title
    324    */
    325356  this->init();
    326357  this->setTitle(title);
    327358
    328359}
     360
     361/**
     362 * Initializes a new EventBox
     363 */
    329364void EventBox::init(void)
    330365{
     
    337372}
    338373
    339 
     374/**
     375 * Sets the Title of the EventBox (not implemented)
     376 \param title Name the EventBox should get (only datastructure-internal).
     377*/
    340378void EventBox::setTitle (char* title)
    341379{
    342   /**
    343    * Sets the EventBoxes name to title
    344    */
    345   //  gtk_frame_set_label (GTK_FRAME (widget), title);
    346 }
     380
     381}
     382
     383/**
     384 * Destructs an EventBox (not Implemented)
     385 */
    347386EventBox::~EventBox ()
    348387{
     
    352391/* BOX */
    353392
     393/**
     394 * Creates a new horizontal Box
     395 */
    354396Box::Box (void)
    355397{
    356   /**
    357    * Creates a new horizontal Box
    358    */
    359398  this->init('h');
    360399}
     400
     401/**
     402 * Creates a new Box of type boxtype
     403 \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally
     404 */
    361405Box::Box (char boxtype)
    362406{
    363   /**
    364    * Creates a new Box if boxtype is 'v' it will be vertically, if 'h' it will be horizontally
    365    */
    366407  this->init(boxtype);
    367408}
     409
     410/**
     411 * Destroys given Box (not implemented yet)
     412 */
    368413Box::~Box ()
    369414{
    370   /**
    371    * Destroys given Frame (not implemented yet)
    372    */
    373 }
    374 
     415}
     416
     417/**
     418 * Initializes a new Box with type boxtype
     419 \param boxtype see Box(char boxtype)
     420*/
    375421void Box::init(char boxtype)
    376422{
     
    388434}
    389435
    390 
     436/**
     437 * Fills a box with a given Widget.
     438 * It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next
     439 \param lowerWidget the next Widget that should be appendet to this Box
     440 */
    391441void Box::fill (Widget *lowerWidget)
    392442{
     
    411461/* IMAGE */
    412462
     463/**
     464 * Creates a new Image
     465 \param imagename the location of the Image on the Hard Disc
     466*/
    413467Image::Image (char* imagename)
    414468{
     469  this->init();
     470  widget = gtk_image_new_from_file (imagename);
     471}
     472
     473/**
     474 * Initializes a new Image
     475 */
     476void Image::init()
     477{
    415478  is_option = 0;
    416479  next = NULL;
    417   widget = gtk_image_new_from_file (imagename);
    418 }
    419 void Image::init()
    420 {
    421  
    422480}
    423481
    424482
    425483/* OPTION */
     484
     485/**
     486 * Initializes a new Option: nothing to do here
     487 */
    426488void Option::init()
    427489{
    428490  return;
    429491}
     492
     493/**
     494 * This sets The FlagName of an Option and defines its default Values
     495 !! Options will be saved if flagname is different from "" !!
     496\param flagname the Name that will be displayed in the output
     497\param defaultvalue the default Value for this Option (see definition of defaultvalue
     498*/
    430499void Option::setFlagName (char* flagname, int defaultvalue)
    431500{
     
    435504}
    436505
     506/**
     507 * see Option::setFlagName (char* flagname, int defaultvalue)
     508 \param flagname the Name that will be displayed in the output
     509 \param defaultvalue the default Value for this Option (see definition of defaultvalue
     510 \param flagnameshort a short flagname to be displayed in the output
     511*/
    437512void Option::setFlagName (char* flagname, char* flagnameshort,  int defaultvalue)
    438513{
    439   /**
    440    * \brief Sets the Flagname of an Option. If it is set different then "" this Option will be saved to the Configurationfile
    441    */
    442514  flag_name = flagname;
    443515  flag_name_short = flagnameshort;
     
    448520
    449521/* BUTTON */
     522
     523/**
     524 * Creates a new Button with a buttonname
     525 \param buttonname sets the Name of the Button
     526*/
    450527Button::Button(char* buttonname)
    451528{
    452   /**
    453    * Creates a new Button with name buttonname
    454    */
    455529  this->init();
    456530  this->setTitle(buttonname);
    457531}
    458532
     533/**
     534 * Initializes a new Button
     535 */
    459536void Button::init(void)
    460537{
     
    469546}
    470547
     548/**
     549 * Sets a new name to the Button
     550\param title The name the Button should get
     551*/
    471552void Button::setTitle (char *title)
    472553{
     
    475556}
    476557
     558/**
     559 * redraws the Button
     560 * not implemented yet
     561 */
    477562void Button::redraw ()
    478563{
     
    480565
    481566/* CHECKBUTTON */
     567
     568/**
     569 * Creates a new CheckButton with an ame
     570 \param buttonname The name the CheckButton should display.
     571 */
    482572CheckButton::CheckButton (char* buttonname)
    483573{
    484   /**
    485    * Creates a new CheckButton with name buttonname
    486    */
    487574  this->init();
    488575  this->setTitle(buttonname);
     
    490577  this->connectSignal ("clicked", this->OptionChange);
    491578}
     579
     580/**
     581 * Destructs a CheckButton (not Implemented yet).
     582 */
    492583CheckButton::~CheckButton()
    493584{
    494585}
    495586
     587/**
     588 * Initiali a new CheckButton with default settings
     589 */
    496590void CheckButton::init(void)
    497591{
     
    505599  widget = gtk_check_button_new_with_label ("");
    506600}
     601
     602/**
     603 * Sets a new Title to a CheckButton
     604 \param title The new Name the CheckButton should display.
     605*/
    507606void CheckButton::setTitle(char* title)
    508607{
     
    511610}
    512611
     612
     613/**
     614 * Signal OptionChange writes the Value from the CheckButton to its Object-Database.
     615 \param widget The widget(CheckButton) that has a changed Value
     616 \param checkbutton the CheckButton-Object that should receive the change.
     617 */
    513618gint CheckButton::OptionChange (GtkWidget *widget, Widget* checkbutton)
    514619{
    515   /**
    516    * Writes value, if changed on the checkbutton, to the object.
    517    */
    518620  static_cast<CheckButton*>(checkbutton)->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((CheckButton*)checkbutton->widget));
    519621  flags->setTextFromFlags(orxonoxGUI);
     
    521623}
    522624
     625/**
     626 * Redraws the CheckButton (if option has changed).
     627 * Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change
     628 */
    523629void CheckButton::redraw ()
    524630{
     
    527633
    528634/* SLIDER */
     635
     636/**
     637 * Creates a new Slider
     638 \param slidername The data-structure-name of the slider.
     639 \param start The minimal Value of the slider.
     640 \param end The maximal Value of the slider.
     641*/
    529642Slider::Slider (char* slidername, int start, int end)
    530643{
    531   /**
    532    * Creates a new Slider with name slidername a beginning value of start and an end value of end.
    533    */
    534644  this->init(start, end);
    535645  this->setValue(start);
     
    538648}
    539649
     650/**
     651 * Destructs a Slider (not implemented yet)
     652 */
    540653Slider::~Slider()
    541654{
    542655}
    543656
     657/**
     658 * Initializes a Slider with start and end Values
     659 * params: see Slider::Slider (char* slidername, int start, int end)
     660 */
    544661void Slider::init(int start, int end)
    545662{
     
    553670  widget = gtk_hscale_new_with_range (start, end, 5);
    554671}
     672
     673/**
     674 * Sets a new Title to the Slider
     675 \param title The new Name of the slider
     676*/
    555677void Slider::setTitle(char* title)
    556678{
    557679  option_name = title;
    558680}
     681
     682/**
     683 * Setting a new value to the Slider.
     684 * Maybe you also require a Slider::redraw() for this to display
     685 */
    559686void Slider::setValue(int value)
    560687{
     
    562689}
    563690
     691/**
     692 * Signal OptionChange writes the Value from the Slider to its Object-Database.
     693 \param widget The widget(Slider) that has a changed Value
     694 \param slider the Slider-Object that should receive the change.
     695 */
    564696gint Slider::OptionChange (GtkWidget *widget, Widget* slider)
    565697{
    566   /**
    567    * Writes value, if changed on the slider, to the object.
    568    */
    569698  static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE ((Slider*)slider->widget));
    570699  flags->setTextFromFlags(orxonoxGUI);
     
    572701}
    573702
     703/**
     704 * Redraws the widget
     705 * Example: see void CheckButton::redraw ()
     706 */
    574707void Slider::redraw ()
    575708{
     
    577710}
    578711
     712/* MENU */
     713
     714/**
     715 * Creates a Menu-Item-list out of multiple input.
     716 * !! Consider, that the last input argument has to be "lastItem" for this to work!!
     717 \param menuname The Database-Name of this Menu
     718 \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!!
     719 */
    579720Menu::Menu (char* menuname, ...)
    580721{
    581   /**
    582    * Creates an Menu-Item-list out of multiple input. Consider, that the last input argument has to be "lastItem" for this to work.
    583    */
    584722  this->init();
    585723  this->setTitle(menuname);
     
    598736}
    599737
     738/**
     739 * Initializes a new Menu with no items
     740 */
    600741void Menu::init(void)
    601742{
     
    611752}
    612753
     754/**
     755 * Sets the Database-Name of this Menu
     756 \param title Database-Name to be set.
     757*/
    613758void Menu::setTitle(char* title)
    614759{
     
    616761}
    617762
     763/**
     764 * appends a new Item to the Menu-List.
     765 \param itemName the itemName to be appendet.
     766*/
    618767void Menu::addItem (char* itemName)
    619768{
     
    622771}
    623772
    624 gint Menu::OptionChange (GtkWidget *widget, Widget* menu)
    625 {
    626   /**
    627    * Writes value, if changed on the Menu, to the object.
    628    */
     773/**
     774 * Signal OptionChange writes the Value from the Menu to its Object-Database.
     775 \param widget The widget(Menu) that has a changed Value
     776 \param menu the Menu-Object that should receive the change.
     777 */gint Menu::OptionChange (GtkWidget *widget, Widget* menu)
     778{
    629779  static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (menu->widget));
    630780  flags->setTextFromFlags(orxonoxGUI);
     
    632782}
    633783
     784/**
     785 * Redraws the widget
     786 * Example: see void CheckButton::redraw ()
     787 */
    634788void Menu::redraw ()
    635789{
     
    637791}
    638792
     793/**
     794 * Creates a new default Label with no Text.
     795 * You migth consider adding Label::setTitle with this.
     796 */
    639797Label:: Label ()
    640798{
     
    642800}
    643801
     802/**
     803 * Creates a new Label with a Text.
     804 \param text The text to be displayed.
     805*/
    644806Label:: Label (char* text)
    645807{
     
    650812}
    651813
     814/**
     815 * Destructs a Label
     816 */
    652817Label::~Label ()
    653818{}
    654819
     820/**
     821 * initializes a new Label
     822 */
    655823void Label::init(void)
    656824{
     
    661829  gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);
    662830}
    663  
     831
     832/**
     833 * Sets a new Text to a Label.
     834 \param text The text to be inserted into the Label.
     835 */
    664836void Label::setText (char * text)
    665837{
     
    667839}
    668840
     841/**
     842 * get the Text of a Label
     843 \return The Text the Label holds.
     844*/
    669845char* Label::getText ()
    670846{
Note: See TracChangeset for help on using the changeset viewer.