diff options
Diffstat (limited to '')
-rw-r--r-- | gui/input.cpp | 1 | ||||
-rw-r--r-- | gui/keyboard.cpp | 3 | ||||
-rw-r--r-- | gui/pages.cpp | 27 | ||||
-rw-r--r-- | gui/pages.hpp | 7 |
4 files changed, 31 insertions, 7 deletions
diff --git a/gui/input.cpp b/gui/input.cpp index e4020745c..b0065609e 100644 --- a/gui/input.cpp +++ b/gui/input.cpp @@ -216,7 +216,6 @@ GUIInput::~GUIInput() if (mInputText) delete mInputText; if (mBackground) delete mBackground; if (mCursor) delete mCursor; - if (mFont) delete mFont; if (mAction) delete mAction; } diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index f08d71488..78e27a164 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -304,10 +304,7 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node) GUIKeyboard::~GUIKeyboard() { - int layoutindex; - for (layoutindex=0; layoutindex<MAX_KEYBOARD_LAYOUTS; layoutindex++) - if (keyboardImg[layoutindex]) delete keyboardImg[layoutindex]; } int GUIKeyboard::Render(void) diff --git a/gui/pages.cpp b/gui/pages.cpp index dc9edc798..73aab0352 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -193,6 +193,12 @@ Page::Page(xml_node<>* page, xml_node<>* templates /* = NULL */) return; } +Page::~Page() +{ + for (std::vector<GUIObject*>::iterator itr = mObjects.begin(); itr != mObjects.end(); ++itr) + delete *itr; +} + bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int depth /* = 0 */) { if (depth == 10) @@ -225,86 +231,101 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int if (type == "text") { GUIText* element = new GUIText(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "image") { GUIImage* element = new GUIImage(child); + mObjects.push_back(element); mRenders.push_back(element); } else if (type == "fill") { GUIFill* element = new GUIFill(child); + mObjects.push_back(element); mRenders.push_back(element); } else if (type == "action") { GUIAction* element = new GUIAction(child); + mObjects.push_back(element); mActions.push_back(element); } else if (type == "console") { GUIConsole* element = new GUIConsole(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "button") { GUIButton* element = new GUIButton(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "checkbox") { GUICheckbox* element = new GUICheckbox(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "fileselector") { GUIFileSelector* element = new GUIFileSelector(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "animation") { GUIAnimation* element = new GUIAnimation(child); + mObjects.push_back(element); mRenders.push_back(element); } else if (type == "progressbar") { GUIProgressBar* element = new GUIProgressBar(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "slider") { GUISlider* element = new GUISlider(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "slidervalue") { GUISliderValue *element = new GUISliderValue(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "listbox") { GUIListBox* element = new GUIListBox(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "keyboard") { GUIKeyboard* element = new GUIKeyboard(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } else if (type == "input") { GUIInput* element = new GUIInput(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); mInputs.push_back(element); @@ -312,6 +333,7 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int else if (type == "partitionlist") { GUIPartitionList* element = new GUIPartitionList(child); + mObjects.push_back(element); mRenders.push_back(element); mActions.push_back(element); } @@ -526,6 +548,9 @@ PageSet::PageSet(char* xmlFile) PageSet::~PageSet() { + for (std::vector<Page*>::iterator itr = mPages.begin(); itr != mPages.end(); ++itr) + delete *itr; + delete mResources; free(mXmlFile); } @@ -869,6 +894,8 @@ int PageManager::ReloadPackage(std::string name, std::string package) } if (mCurrentSet == set) SelectPackage(name); + if (mBaseSet == set) + mBaseSet = mCurrentSet; delete set; return 0; } diff --git a/gui/pages.hpp b/gui/pages.hpp index 2a2ef2c32..23ceee9c8 100644 --- a/gui/pages.hpp +++ b/gui/pages.hpp @@ -29,14 +29,14 @@ class RenderObject; class ActionObject; class InputObject; class MouseCursor; +class GUIObject; class Page { public: - virtual ~Page() {} - -public: Page(xml_node<>* page, xml_node<>* templates = NULL); + virtual ~Page(); + std::string GetName(void) { return mName; } public: @@ -51,6 +51,7 @@ public: protected: std::string mName; + std::vector<GUIObject*> mObjects; std::vector<RenderObject*> mRenders; std::vector<ActionObject*> mActions; std::vector<InputObject*> mInputs; |