Main Page   Class Hierarchy   Compound List   File List   Compound Members  

aws.h

00001  #ifndef __AWS_H__
00002  #define __AWS_H__
00003 /**************************************************************************
00004     Copyright (C) 2000-2001 by Christopher Nelson 
00005     
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010   
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015   
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *****************************************************************************/
00020 #include "aws/iaws.h"
00021 #include "iutil/eventh.h"
00022 #include "iutil/comp.h"
00023 #include "csgeom/csrect.h"
00024 #include "csgeom/csrectrg.h"
00025 #include "cstool/proctex.h"
00026 #include "ivideo/graph2d.h"
00027 #include "ivideo/graph3d.h"
00028 #include "igraphic/imageio.h"
00029 #include "aws/awscomp.h"
00030 #include "aws/awswin.h"
00031 
00032 const int awsNumRectBuckets = 32;
00033 
00040 class awsManager : public iAws
00041 {
00043    iAwsPrefManager *prefmgr;
00044 
00046    iAwsSinkManager *sinkmgr;
00047 
00052    csRectRegion dirty;
00053 
00059    csRectRegion updatestore;
00060 
00062    bool updatestore_dirty;
00063    
00067    csRect frame;
00068 
00070    iAwsWindow    *top;
00071 
00073    iAwsComponent *mouse_in;
00074 
00076    bool          mouse_captured;
00077 
00079    iGraphics2D *ptG2D;
00080 
00082    iGraphics3D *ptG3D;
00083    
00085    iObjectRegistry *object_reg;
00086   
00088    class awsCanvas : public csProcTexture
00089    {
00090      public:
00091   
00093         awsCanvas ();
00094   
00096         virtual ~awsCanvas () {}
00097 
00099         virtual void Animate (csTicks current_time);
00100 
00102         iGraphics2D *G2D() 
00103         { return ptG2D; }
00104 
00106         iGraphics3D *G3D() 
00107         { return ptG3D; }
00108         
00110         void SetSize(int w, int h);
00111 
00112    };
00113 
00115    awsCanvas canvas;
00116 
00120    struct awsComponentFactoryMap
00121    {
00122      ~awsComponentFactoryMap ();
00123      awsComponentFactory *factory;
00124      unsigned long        id;
00125    };
00126 
00128    csDLinkList component_factories;
00129    
00131    bool UsingDefaultContext;
00132    
00140    bool DefaultContextInitialized;
00141    
00142 public:
00143     SCF_DECLARE_IBASE;
00144 
00145     awsManager(iBase *p);
00146     virtual ~awsManager();
00147     
00148     bool Initialize(iObjectRegistry *sys);
00149    
00151     virtual iAwsPrefManager *GetPrefMgr();
00152 
00154     virtual iAwsSinkManager *GetSinkMgr();
00155     
00157     virtual void       SetPrefMgr(iAwsPrefManager *pmgr);
00158 
00160     virtual void       RegisterComponentFactory(awsComponentFactory *factory, char *name);
00161     
00163     virtual awsComponentFactory *FindComponentFactory(char *name);
00164 
00166     virtual iAwsWindow *GetTopWindow();
00167 
00169     virtual void       SetTopWindow(iAwsWindow *_top);
00170 
00172     virtual bool       WindowIsDirty(iAwsWindow *win);
00173     
00175     virtual void       Print(iGraphics3D *g3d);
00176   
00178     virtual void       Redraw();
00179 
00181     virtual void       Mark(csRect &rect);
00182 
00184     virtual void       Unmark(csRect &rect);
00185 
00187     virtual void       InvalidateUpdateStore();
00188 
00190     virtual void       CaptureMouse();
00191 
00193     virtual void       ReleaseMouse();
00194 
00195 protected:
00197     void RedrawWindow(iAwsWindow *win, csRect &dirtyarea);
00198                 
00200     void RecursiveDrawChildren(iAwsComponent *cmp, csRect &dirtyarea);
00201 
00203     bool RecursiveBroadcastToChildren(iAwsComponent *cmp, iEvent &event);
00204     
00206     void CreateChildrenFromDef(iAws *wmgr, iAwsComponent *parent, awsComponentNode *settings);
00207 
00209     void UpdateStore();
00210 
00212     void RegisterCommonComponents();
00213     
00214 public:
00216     virtual iAwsWindow *CreateWindowFrom(char *defname);
00217 
00218 public:
00220     virtual void SetContext(iGraphics2D *g2d, iGraphics3D *g3d);
00221 
00223     virtual void SetDefaultContext(iEngine* engine, iTextureManager* txtmgr);
00224 
00226     virtual iGraphics2D *G2D(); 
00227  
00229     virtual iGraphics3D *G3D(); 
00230  
00232     virtual bool HandleEvent(iEvent&);
00233     
00234  
00236 
00237   // Implement iComponent interface.
00238   struct eiComponent : public iComponent
00239   {
00240     SCF_DECLARE_EMBEDDED_IBASE(awsManager);
00241     virtual bool Initialize(iObjectRegistry* p)
00242     { return scfParent->Initialize(p); }
00243   } scfiComponent;
00244   struct eiEventHandler : public iEventHandler
00245   {
00246     SCF_DECLARE_EMBEDDED_IBASE(awsManager);
00247     virtual bool HandleEvent(iEvent&)   { return false; }
00248   } scfiEventHandler;
00249 };
00250  
00251 #endif
00252 

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000