Commits

thecoshman committed a29ba63

Created a panel class, this will be used as a generic way to group elements
A special instance of panel shall represent the window, this may require a new class
Tweaked the formatting of the header files -
include gaurds
<line break>
include standard/external libries
<line break>
include project headers

  • Participants
  • Parent commits 98e6e38

Comments (0)

Files changed (7)

File include/Button.h

 */
 #ifndef BUTTON_H
 #define BUTTON_H
+
 #include "Element.h"
 
 namespace HaM{

File include/Element.h

 */
 #ifndef ELEMENT_H
 #define ELEMENT_H
+
 #include <map>
 #include <functional>
+
 #include "../include/IntPair.h"
 #include "../include/MouseData.h"
 

File include/Panel.h

+/*
+Boost Software License - Version 1.0 - August 17, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+#ifndef PANEL_H
+#define PANEL_H
+
+#include <memory>
+#include <vector>
+
+#include "Element.h"
+
+namespace HaM{
+    class Panel : public Element
+    {
+        public:
+            int getNumChildren();
+            void attachElement(Element*&& newElement);
+            std::unique_ptr<Element> takeChild(int ChildID);
+        protected:
+            std::vector<std::unique_ptr<Element> > children;
+        private:
+    };
+}
+
+#endif // PANEL_H

File include/ParentElementRole.h

-/*
-Boost Software License - Version 1.0 - August 17, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-#ifndef PARENTELEMENTROLE_H
-#define PARENTELEMENTROLE_H
-#include <memory>
-#include <vector>
-#include "Element.h"
-
-namespace HaM{
-    class ParentElementRole
-    {
-        protected:
-            std::vector<std::unique_ptr<Element> > children;
-        public:
-            int getNumChildren();
-            void attachElement(Element*&& newElement);
-            std::unique_ptr<Element> takeChild(int ChildID);
-    };
-}
-
-#endif // PARENTELEMENTROLE_H

File include/Window.h

 */
 #ifndef WINDOW_H
 #define WINDOW_H
+
 #include <vector>
+
 #include "Element.h"
 #include "ParentElementRole.h"
 

File src/Panel.cpp

+/*
+Boost Software License - Version 1.0 - August 17, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+#include "../include/Panel.h"
+
+namespace HaM {
+    int Panel::getNumChildren(){
+        return children.size();
+    }
+    void Panel::attachElement(Element*&& newElement)
+    {
+        children.push_back(std::unique_ptr<Element>(newElement));
+    }
+    std::unique_ptr<Element> Panel::takeChild(int childID)
+    {
+        auto temp = std::move(children.at(childID));
+        children.erase(children.begin() + childID);
+        return temp;
+    }
+}

File src/ParentElementRole.cpp

-/*
-Boost Software License - Version 1.0 - August 17, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-*/
-#include "../include/ParentElementRole.h"
-
-namespace HaM {
-    int ParentElementRole::getNumChildren(){
-        return children.size();
-    }
-    void ParentElementRole::attachElement(Element*&& newElement)
-    {
-        children.push_back(std::unique_ptr<Element>(newElement));
-    }
-    std::unique_ptr<Element> ParentElementRole::takeChild(int childID)
-    {
-        auto temp = std::move(children.at(childID));
-        children.erase(children.begin() + childID);
-        return temp;
-    }
-}