uappliImpl.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  uappliImpl.hpp
00004 *  Ubit Project
00005 *  Author: Eric Lecolinet
00006 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00007 *  (C) 1999-2006 / Eric Lecolinet / ENST Paris / http://www.enst.fr/~elc/ubit
00008 *
00009 * ***********************************************************************
00010 * COPYRIGHT NOTICE :
00011 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
00012 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00013 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
00014 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
00015 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00016 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00017 * ***********************************************************************
00018 * ==================================================== [(c)Elc] ======= *
00019 * ==================================================== ======== ======= */
00020 
00021 #ifndef _uappliImpl_hpp_
00022 #define _uappliImpl_hpp_
00023 //pragma ident  "@(#)uappliImpl.hpp     ubit:05.05.00"
00024 #include <vector>
00025 #include <ubit/ugroup.hpp>
00026 #include <ubit/uclassImpl.hpp>
00027 #include <ubit/update.hpp>
00028 #include <ubit/ustyle.hpp>
00029 #include <ubit/umessage.hpp>
00030 namespace ubit {
00031 
00032 /* ==================================================== ===== ======= */
00033 
00034 struct UpdateRequest {
00035   UGroup* obj;
00036   UUpdate upd;
00037   UpdateRequest(UGroup* _obj, const UUpdate& _upd) : obj(_obj), upd(_upd) {}
00038 };
00039 
00040 /* ==================================================== ===== ======= */
00041 
00042 class UAppliImpl {
00043 public:
00044   UAppliImpl();
00045 
00046   bool isTerminated() const {return is_terminated;}
00047 
00048   bool hasPendingRequest() {return request_mask != 0;}  
00050   
00051   void processPendingRequests();
00053 
00054   void beginPaint(UHardWinImpl*);
00055   void endPaint(UHardWinImpl*);
00056   void processPaintRequests();
00057 
00058   void addDeleteRequest(UBrick*);
00059   void addDeleteRequest(UView*);
00060   void processDeleteRequests();
00061   
00062   void addUpdateRequest(UGroup*, const UUpdate&);
00063   UpdateRequest* findUpdateRequest(UBrick*, unsigned int& k);
00064   void processUpdateRequests();
00065   void processUpdateRequest(UpdateRequest&);
00066 
00067   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00068 
00069 private:
00070   friend class UAppli;
00071   friend class UDisp;
00072   friend class UView;
00073   friend class UEventFlow;
00074   friend class UNatAppli;
00075   friend class UNatDisp;
00076   friend class UTimer;
00077   friend class UInput;
00078   friend class UMService;  // messmap
00079 
00080   UAppli* appli;          
00081   bool is_terminated;     
00082   UFrame* main_frame;     
00083   UNatAppli* natappli;    
00084 
00085   // Note: the display list must be static to avoid seg faults if the UAppli
00086   // is distroyed before the widgets by the client program 
00087   UDispList displist;
00088   UFlowList flowlist;      // list of event flows
00089 
00090   UStyleSheet stylesheet;
00091   UStr imapath;
00092   UGroup *inputs, *timers;      
00093   UMessagePortMap *messmap;     
00094   UChildren modalwin_list; // modal windows that are currently activated
00095   UWin* modalwin;
00096   UHardWinImpl* paint_wini;
00097   int main_status;         // status of the event loop of the UAppli
00098   int modal_status;        // status of the inner loop the current modal dialog
00099   UTime app_motion_lag, nat_motion_lag;
00100 
00101   enum {DELETE_REQUEST = 1<<0, UPDATE_REQUEST = 1<<1, PAINT_REQUEST = 1<<2};
00102   int request_mask;
00103   bool syncing_update_requests;
00104   bool update_data;   // TMP!!!
00105   std::vector<UpdateRequest> update_list; // objects that will be updated
00106   std::vector<UBrick*> delete_b_list;     // objects that will be deleted
00107   std::vector<UView*>  delete_v_list;     // views that will be deleted
00108 };
00109 
00110 }
00111 #endif
00112 /* ==================================================== [TheEnd] ======= */
00113 /* ==================================================== [(c)Elc] ======= */
00114 

Generated on Mon Jan 29 00:20:36 2007 for Ubit by  doxygen 1.4.7