00001 00002 00003 #ifndef TEXTBOX_H 00004 #define TEXTBOX_H 00005 00006 00007 #include "Component.h" 00008 #include "Vector3f.h" 00009 00010 #include <string> 00011 #include <vector> 00012 00013 00014 namespace pge { 00015 namespace gui { 00016 00017 00018 class TextBox : public Component { 00019 00020 00021 public: 00022 //************************************************************************ 00023 // 00024 // Constructor 00025 // 00026 //************************************************************************ 00028 TextBox(int x, int y, int width, int height); 00029 00030 00031 //************************************************************************ 00032 // 00033 // Destructor 00034 // 00035 //************************************************************************ 00037 virtual ~TextBox(void); 00038 00039 00040 //************************************************************************ 00041 // 00042 // Functions 00043 // 00044 //************************************************************************ 00045 bool init(void); 00046 void render(void); 00047 void timer(unsigned int delay); 00048 00049 void addLine(const std::string &line) { 00050 m_lines.push_back(line); 00051 } 00052 00053 std::vector<std::string> getLines(void) { 00054 return m_lines; 00055 } 00056 00057 int getTextSize(void) { 00058 return m_textSize; 00059 } 00060 00061 void setTextSize(int size) { 00062 m_textSize = size; 00063 } 00064 00065 Vector3f getTextColor(void) { 00066 return m_textColor; 00067 } 00068 00069 void setTextColor(const Vector3f &color) { 00070 m_textColor = color; 00071 } 00072 00073 void setBackgroundEnabled(bool background) { 00074 m_backgroundEnabled = background; 00075 } 00076 00077 00078 private: 00079 //************************************************************************ 00080 // 00081 // Variables 00082 // 00083 //************************************************************************ 00084 std::vector<std::string> m_lines; 00085 Vector3f m_textColor; 00086 int m_textSize; 00087 bool m_backgroundEnabled; 00088 }; 00089 }; 00090 }; 00091 00092 #endif