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

FXDaemon.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  Base object for all daemon processes                         *
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 WIN32
00023 #ifndef FXDAEMON_H
00024 #define FXDAEMON_H
00025 
00026 #ifndef FXOBJECT_H
00027 #include <fox/FXobject.h>
00028 using namespace FX;
00029 #endif
00030 namespace FXEX {
00031 class FXDaemonApp;
00032 
00033 /**
00034  * This class implements the base class for all Daemon processes.
00035  * It works in a similar way to the FXMainWindow class is the base class
00036  * for all main window applications
00037  */
00038 class FXAPI FXDaemon : public FXObject {
00039   FXDECLARE_ABSTRACT (FXDaemon)
00040   
00041 private:
00042   FXDaemonApp*  app;                    // this application
00043   FXObject*     target;                 // Target object
00044   FXSelector    message;                // Message ID
00045 
00046 protected:
00047   /// serialisation
00048   FXDaemon() : FXObject(){}
00049 
00050   /// Your main daemon application derives from this
00051   FXDaemon(FXDaemonApp* a,FXObject* tgt=NULL,FXSelector sel=0);
00052 
00053 public:
00054   enum {
00055     ID_QUIT=0,
00056     ID_CONFIGURE,
00057     ID_LAST
00058     };
00059 
00060 public:
00061   /// Get application
00062   FXDaemonApp* getApp() const { return app; }
00063 
00064    /// Set the message target object for this window
00065   void setTarget(FXObject *t) { target=t; }
00066 
00067   /// Get the message target object for this window, if any
00068   FXObject* getTarget() const { return target; }
00069 
00070   /// Set the message identifier for this window
00071   void setSelector(FXSelector sel) { message=sel; }
00072 
00073   /// Get the message identifier for this window
00074   FXSelector getSelector() const { return message; }
00075 
00076   /// Create resource
00077   virtual void create(){}
00078 
00079   /// Detach resource
00080   virtual void detach(){}
00081 
00082   /// Destroy resource
00083   virtual void destroy(){}
00084 
00085   /// Save object to stream
00086   virtual void save(FXStream& store) const;
00087 
00088   /// Load object from stream
00089   virtual void load(FXStream& store);
00090 
00091   /// Destructor
00092   virtual ~FXDaemon();
00093   };
00094 
00095 } // namespace FXEX
00096 #endif // FXDAEMON_H
00097 #endif