GLICT/container.h

Go to the documentation of this file.
00001 /*
00002     GLICT - Graphics Library Interface Creation Toolkit
00003     Copyright (C) 2006-2007 OBJECT Networks
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00028 #ifndef _GLICT_CONTAINER_H
00029 #define _GLICT_CONTAINER_H
00030 #include <vector>
00031 #include <list>
00032 #include <string>
00033 #include <GLICT/types.h>
00034 
00035 using namespace std;
00036 
00037 
00047 class glictContainer  {
00048         public:
00049                 glictContainer(); 
00050                 glictContainer(long guid); 
00051                 virtual ~glictContainer(); 
00052 
00053                 // the following elements are replaced, not necessarily inherited in child  classes
00054                 virtual void Paint(); 
00055                 virtual bool CastEvent(glictEvents evt, void* wparam, long lparam, void* returnvalue); 
00056 
00057                 // the following elements are always inherited from container. some MAY be overriden, in special circumstances, but it is not recommended.
00058                 virtual void AddObject(glictContainer* object); 
00059                 virtual void RemoveObject(glictContainer* object); 
00060                 void CPaint(); 
00061                 void DelayedRemove(); 
00062                 virtual void SetHeight(float h); 
00063                 virtual void SetWidth(float w); 
00064                 void SetPos(float x, float y); 
00065                 void SetPos(glictPos pos); 
00066                 void GetPos(float* x, float* y); 
00067                 void GetPos(glictPos* pos); 
00068                 void GetSize(glictSize* size); 
00069                 void SetScissor(); 
00070                 void SetVisible(bool visibility); 
00071                 bool GetVisible(); 
00072                 void SetEnabled(bool enabled); 
00073                 bool GetEnabled(); 
00074                 void RememberTransformations(); 
00075                 void ResetTransformations(); 
00076                 void TransformScreenCoords(glictPos *pos); 
00077                 float GetHeight(); 
00078                 float GetWidth(); 
00079                 float GetX() {return x;}  
00080                 float GetY() {return y;}  
00081 
00082                 virtual void SetVirtualSize(float w, float h);
00083                 virtual void VirtualScrollBottom();
00084 
00085                 void SetPrevious(glictContainer*);
00086                 void SetNext(glictContainer*);
00087 
00088                 bool CastEvent(glictEvents evt, void* wparam, long lparam); 
00089                 bool DefaultCastEvent(glictEvents evt, void* wparam, long lparam, void* returnvalue); 
00090 
00091                 void SetOnClick(void(*OnClickFunction)(glictPos* relmousepos, glictContainer* callerclass)); 
00092                 void SetOnPaint(void(*OnPaintFunction)(glictRect* real, glictRect* clipped, glictContainer* callerclass)); 
00093                 void SetOnMouseDown(void(*FunctionPtr)(glictPos* relmousepos, glictContainer* callerclass)); 
00094                 void SetOnMouseUp(void(*FunctionPtr)(glictPos* relmousepos, glictContainer* callerclass)); 
00095                 void SetCaption(const std::string caption); 
00096                 std::string GetCaption(); 
00097 
00098                 const char *EvtTypeDescriptor(glictEvents evt); 
00099                 void Focus(glictContainer* callerchild); 
00100 
00101                 glictContainer* GetParent();
00102 
00103                 void ReportDebug(); 
00104 
00105                 virtual void RecursiveBoundaryFix(); 
00106                 virtual void FixContainerOffsets(); 
00107 
00108                 virtual void SetCustomData(void *param); 
00109                 virtual void*GetCustomData(); 
00110 
00111                 virtual void SetFocusable(bool b) {focusable = b;} 
00112                 virtual bool GetFocusable() {return focusable;} 
00113 
00114                 void SetFont(std::string name, unsigned int size=10); 
00115 
00116                 float height, width; 
00117                 float x, y; 
00118                 float left, right, top, bottom; 
00119                 float clipleft, clipright, cliptop, clipbottom; 
00120                 float containeroffsetx, containeroffsety; 
00121                 char objtype[50]; 
00122 
00123                 virtual glictPos *GetVirtualPos() {return &virtualpos;}
00124         private:
00125                 // these should be called only internally
00126                 void SetRect(float left, float top, float right, float bottom); 
00127                 void SetClip(float left, float top, float right, float bottom); 
00128 
00129                 bool visible;
00130                 bool enabled;
00131 
00132         protected:
00133 
00134                 std::vector <glictContainer*> objects; 
00135                 /*int height, width;
00136                 int x, y;
00137                 int left, right, top, bottom;
00138                 int clipleft, clipright, cliptop, clipbottom;*/
00139 
00140                 glictContainer* parent; 
00141                 unsigned int guid; 
00142                 float ModelviewMatrix[16]; 
00143 
00144                 void(*OnClick)(glictPos* relmousepos, glictContainer* callerclass); 
00145                 void(*OnMouseDown)(glictPos* relmousepos, glictContainer* callerclass); 
00146                 void(*OnMouseUp)(glictPos* relmousepos, glictContainer* callerclass); 
00147         void(*OnPaint)(glictRect* real, glictRect* clipped, glictContainer* callerclass); 
00148 
00149                 std::string caption; 
00150 
00151                 bool focusable;
00152                 std::vector <glictContainer*> delayedremove;
00153 
00154                 glictSize virtualsize;
00155                 glictPos virtualpos;
00156 
00157                 glictContainer* next;
00158                 glictContainer* previous;
00159 
00160 
00161                 std::string fontname;
00162                 unsigned int fontsize;
00163 
00164                 void* customdata;
00165 
00166 
00167 
00169 
00170     friend void _glictMessageBox_Closer(glictPos* relmousepos, glictContainer* caller);
00171 
00172 };
00173 
00174 #endif

SourceForge.net Logo
generated with doxygen 1.5.3 on Mon Oct 29 18:09:26 2007