/* ================================================================ GuiElement ---------------- This file describes the GuiElement class. This is the base class for further GUI Elements such as buttons, text input, or otherwise. ================================================================ */ #ifndef GUIELEMENT_HPP #define GUIELEMENT_HPP #include #include #include "RenderObject.hpp" #include "RenderView.hpp" #include "RenderCamera.hpp" class GuiElement { friend class Gui; public: enum Type { DEFAULT = 0, BUTTON, TEXT, TEXTINPUT, TEXTAREA, CHECKBOX, LIST }; enum Position { VCENTER = (1 << 1), HCENTER = (1 << 2), LEFT = (1 << 3), RIGHT = (1 << 4), TOP = (1 << 5), BOTTOM = (1 << 6) }; enum Flags { HIDDEN = (1 <<1) }; GuiElement(); GuiElement(const char *string); GuiElement(const char *string, GuiElement *parent_); GuiElement(const char *string, int group_id, int this_id); virtual ~GuiElement(); // int setGeometry(float x, float y, float w, float h); // int setText(const char *string); GuiElement *getHit(float xhit, float yhit); int addChild(GuiElement *child); int setParent(GuiElement *parent); int setPFlags(int pflags); RenderView *getView(); virtual int doUpdate(int c_width, int c_height); int doRender(); float getWidth(); float getHeight(); void setSize(float width, float height); void setPosition(float newx, float newy); void setOffset(float offx, float offy); int getFlags(); void hide(); void show(); protected: std::vector children; // children of this element RenderView *view; // Ugh, we use FBOs for GUI elements cuz otherwise it's too annoying. GuiElement *parent; // parent of this element std::string text; // text of this element int type; // flag for this type int pflags; // positioning flags int flags; // flags int gid; // group id for this element int id; // id for this element RenderObject *object;// render object, as set by manager class, Gui // float x, y, w, h; // position and dimensions for this element float offset_x, offset_y; // offset x and y }; #endif