| 1 | /* | 
|---|
| 2 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
| 3 |  | 
|---|
| 4 |    Copyright (C) 2004 orx | 
|---|
| 5 |  | 
|---|
| 6 |    This program is free software; you can redistribute it and/or modify | 
|---|
| 7 |    it under the terms of the GNU General Public License as published by | 
|---|
| 8 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 9 |    any later version. | 
|---|
| 10 |  | 
|---|
| 11 |    ### File Specific: | 
|---|
| 12 |    main-programmer: ... | 
|---|
| 13 |    co-programmer: ... | 
|---|
| 14 | */ | 
|---|
| 15 |  | 
|---|
| 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ | 
|---|
| 17 |  | 
|---|
| 18 | #include "gui.h" | 
|---|
| 19 | #include "gui_saveable.h" | 
|---|
| 20 | #include "preferences.h" | 
|---|
| 21 |  | 
|---|
| 22 | namespace OrxGui | 
|---|
| 23 | { | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 |   /** | 
|---|
| 27 |    * standard constructor | 
|---|
| 28 |   */ | 
|---|
| 29 |   Gui::Gui () | 
|---|
| 30 |   { | 
|---|
| 31 |     //this->setClassID(CL_PROTO_ID, "Gui"); | 
|---|
| 32 |     this->state = Gui::Null; | 
|---|
| 33 |   } | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 |   /** | 
|---|
| 37 |    * standard deconstructor | 
|---|
| 38 |   */ | 
|---|
| 39 |   Gui::~Gui () | 
|---|
| 40 |   { | 
|---|
| 41 |     // delete what has to be deleted here | 
|---|
| 42 |   } | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 |   void Gui::loadAll() | 
|---|
| 46 |   { | 
|---|
| 47 |     std::vector<SaveableGroup*>::iterator loadElem; | 
|---|
| 48 |     for (loadElem = this->groups.begin(); loadElem != this->groups.end(); ++loadElem) | 
|---|
| 49 |     { | 
|---|
| 50 |       (*loadElem)->load(); | 
|---|
| 51 |     } | 
|---|
| 52 |  | 
|---|
| 53 |   } | 
|---|
| 54 |  | 
|---|
| 55 |   void Gui::saveAll() | 
|---|
| 56 |   { | 
|---|
| 57 |     std::vector<SaveableGroup*>::iterator saveElem; | 
|---|
| 58 |     for (saveElem = this->groups.begin(); saveElem != this->groups.end(); ++saveElem) | 
|---|
| 59 |     { | 
|---|
| 60 |       (*saveElem)->save(); | 
|---|
| 61 |     } | 
|---|
| 62 |  | 
|---|
| 63 |     Preferences::getInstance()->save(); | 
|---|
| 64 |   } | 
|---|
| 65 |  | 
|---|
| 66 |   /** | 
|---|
| 67 |    * @brief adds a SaveableGroup | 
|---|
| 68 |    * @param saveableGroup the SaveableGroup to add to the SaveList. | 
|---|
| 69 |    */ | 
|---|
| 70 |   void Gui::addSaveableGroup(SaveableGroup* saveableGroup) | 
|---|
| 71 |   { | 
|---|
| 72 |     if (std::find (this->groups.begin(), this->groups.end(), saveableGroup) == this->groups.end()) | 
|---|
| 73 |       this->groups.push_back(saveableGroup); | 
|---|
| 74 |   } | 
|---|
| 75 |  | 
|---|
| 76 |   /** | 
|---|
| 77 |    * @brief removes a SaveableGroup | 
|---|
| 78 |    * @param saveableGroup the SaveableGroup to remove from the SaveList. | 
|---|
| 79 |    */ | 
|---|
| 80 |   void Gui::removeSaveableGroup(SaveableGroup* saveableGroup) | 
|---|
| 81 |   { | 
|---|
| 82 |     std::vector<SaveableGroup*>::iterator delElem = std::find (this->groups.begin(), this->groups.end(), saveableGroup); | 
|---|
| 83 |     if (delElem != this->groups.end()) | 
|---|
| 84 |       this->groups.erase(delElem); | 
|---|
| 85 |   } | 
|---|
| 86 |  | 
|---|
| 87 |   void Gui::quitEvent() | 
|---|
| 88 |   { | 
|---|
| 89 |     this->state |= Gui::Quitting; | 
|---|
| 90 |   } | 
|---|
| 91 |  | 
|---|
| 92 |   void Gui::startEvent() | 
|---|
| 93 |   { | 
|---|
| 94 |     this->state |= Gui::Starting; | 
|---|
| 95 |   } | 
|---|
| 96 | } | 
|---|