[4744] | 1 | /* |
---|
[1853] | 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. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: ... |
---|
| 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[7476] | 18 | #include "gui.h" |
---|
[7598] | 19 | #include "gui_saveable.h" |
---|
[9869] | 20 | #include "parser/preferences/preferences.h" |
---|
[1853] | 21 | |
---|
[7476] | 22 | namespace OrxGui |
---|
[3365] | 23 | { |
---|
[4320] | 24 | |
---|
| 25 | |
---|
[7476] | 26 | /** |
---|
| 27 | * standard constructor |
---|
| 28 | */ |
---|
| 29 | Gui::Gui () |
---|
| 30 | { |
---|
| 31 | //this->setClassID(CL_PROTO_ID, "Gui"); |
---|
[7547] | 32 | this->state = Gui::Null; |
---|
[7476] | 33 | } |
---|
[1853] | 34 | |
---|
| 35 | |
---|
[7476] | 36 | /** |
---|
| 37 | * standard deconstructor |
---|
| 38 | */ |
---|
| 39 | Gui::~Gui () |
---|
| 40 | { |
---|
| 41 | // delete what has to be deleted here |
---|
| 42 | } |
---|
[7547] | 43 | |
---|
[7555] | 44 | |
---|
[7598] | 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 | { |
---|
[7600] | 57 | std::vector<SaveableGroup*>::iterator saveElem; |
---|
| 58 | for (saveElem = this->groups.begin(); saveElem != this->groups.end(); ++saveElem) |
---|
| 59 | { |
---|
| 60 | (*saveElem)->save(); |
---|
| 61 | } |
---|
[7604] | 62 | |
---|
| 63 | Preferences::getInstance()->save(); |
---|
[7598] | 64 | } |
---|
| 65 | |
---|
[7555] | 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 | |
---|
[7547] | 87 | void Gui::quitEvent() |
---|
| 88 | { |
---|
| 89 | this->state |= Gui::Quitting; |
---|
| 90 | } |
---|
[7548] | 91 | |
---|
| 92 | void Gui::startEvent() |
---|
| 93 | { |
---|
| 94 | this->state |= Gui::Starting; |
---|
| 95 | } |
---|
[3543] | 96 | } |
---|