Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXLayout.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  Layout container object                                      *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   All Rights Reserved.                *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************/
00022 #ifndef FXLAYOUT_H
00023 #define FXLAYOUT_H
00024 
00025 #ifndef FXPACKER_H
00026 #include <fox/FXPacker.h>
00027 using namespace FX;
00028 #endif
00029 namespace FXEX {
00030 
00031 /**
00032  * TODO - this is meant to be a generalised layout engine
00033  *        ie is meant to be a constraint resolver to figure out how to layout it child widgets.
00034  */
00035 class FXAPI FXLayout : public FXPacker {
00036   FXDECLARE(FXLayout)
00037 
00038 private:
00039   FXStream        *stream;
00040   FXObjectList    *objectList;
00041   FXVerticalFrame *mainframe;
00042   FXbool           docOpen;
00043   FXString         buffer;
00044   FXint            justification;
00045 
00046 protected:
00047   /// for serialization
00048   FXLayout() : FXPacker() {}
00049 
00050 public:
00051   enum {
00052     ID_LAYOUT=FXPacker::ID_LAST,
00053     ID_LAST
00054     };
00055 
00056 public:
00057   long onLayout(FXObject*,FXSelector,void*);
00058   long onDocumentBegin(FXObject*,FXSelector,void*);
00059   long onDocumentEnd(FXObject*,FXSelector,void*);
00060   long onText(FXObject*,FXSelector,void*);
00061   long onImg(FXObject*,FXSelector,void*);
00062   long onCenterBegin(FXObject*,FXSelector,void*);
00063   long onCenterEnd(FXObject*,FXSelector,void*);
00064   long onHrefBegin(FXObject*,FXSelector,void*);
00065   long onHrefEnd(FXObject*,FXSelector,void*);
00066 
00067 public:
00068   /// create a reader for the incoming stream
00069   FXLayout(FXComposite* p,FXStream* s=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXint opts=LAYOUT_FILL_X|LAYOUT_FILL_Y);
00070 
00071   /// create resources
00072   virtual void create();
00073 
00074   /// parse the stream (which generates callbacks which we handle)
00075   void parse();
00076 
00077   /// clears the existing window
00078   void clear();
00079 
00080   /// redisplay using a new stream
00081   void setStream(FXStream *s);
00082 
00083   /// get the stream
00084   FXStream* getStream() { return stream; }
00085 
00086   /// cleanup
00087   virtual ~FXLayout();
00088   };
00089 
00090 } // namespace FXEX
00091 #endif // FXLAYOUT_H