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

# mfc_dlog_app_base.h

Go to the documentation of this file.

    00001 // mfc_dlog_app_base.h : main header file for base class of appliation that uses
    00002 //                       a dialog-based style
    00003 //
    00004
    00005 #if !defined(AFX_MFC_DLOG_APP_BASE_H__3022A762_36E0_42B6_A746_40C4AA5B66BA__INCLUDED_)
    00006 #define      AFX_MFC_DLOG_APP_BASE_H__3022A762_36E0_42B6_A746_40C4AA5B66BA__INCLUDED_
    00007
    00008 #if _MSC_VER > 1000
    00009 #pragma once
    00010 #endif // _MSC_VER > 1000
    00011
    00012 #include <afxwin.h>         // MFC core and standard components
    00013 #include <afxext.h>         // MFC extensions
    00014
    00015 #include <configurable.h>
    00016 #include <worm_statuscode.h>
    00017 #include <worm_exceptions.h>
    00018 #include <logger.h>
    00019 #include <globalutils.h>
    00020
    00021 /*
    00022 ** Declare function used by spawned threads to reenter derivative classes
    00023 */
    00024 UINT AFX_CDECL StartMFCWorkerThread(LPVOID p_object);
    00025
    00026
    00028 // CMFCDialogAppBase:
    00029 // See mfc_dlog_app_base.cpp for the implementation of this class
    00030 //
    00031
    00032 class CMFCDialogAppBase : public CWinApp, public TConfigurable
    00033 {
    00034 protected:
    00035
    00036    // ------------------------  FOR  TConfigurable  ---------------------
    00037    //
    00038    /*
    00039    **  HandleConfigLine()
    00040    **
    00041    **  PARMS:
    00042    **          p_parser -- the parser being used, command string already
    00043    **                      in the current token for comparison with Its()
    00044    **
    00045    ** RETURN:
    00046    **          HANDLE_INVALID --  line invalid
    00047    **          HANDLE_UNUSED  --  line not used
    00048    **          HANDLE_USED    --  line used okay
    00049    **
    00050    **  OVERRIDE for child classes to handle command (.d) lines
    00051    **          always call <super_class>::HandleConfigLine() when overridden
    00052    **          (except when super class is CMFCDialogAppBase).
    00053    **
    00054    */
    00055    // virtual HANDLE_STATUS HandleConfigLine( ConfigSource * p_parser );
    00056
    00057    /* CheckConfig() -- allows derivative classes to report the status of their
    00058    **                  the lookup values.
    00059    **
    00060    ** From within any deriving class, or further derivation, ALWAYS contain a call to
    00061    ** <super_class>::CheckConfig() in their own CheckConfig() method...
    00062    ** this ensures that all classes in the heirarchy get their chance to report status.
    00063    **
    00064    ** All implementations should set ConfigStatus value to WORM_STAT_BADSTATE if there
    00065    ** is a configuration problem, otherwise leave it alone.
    00066    */
    00067    //virtual void CheckConfig();
    00068
    00069
    00070    // ------------------------  FOR  CMFCDialogAppBase  ---------------------
    00071    //
    00072
    00073    bool Running;
    00074
    00075    int  LoggingLevel;
    00076
    00077    /*
    00078    ** PrepApp -- actions to be taken to prepare a specific application
    00079    **            for parsing the command file.
    00080    **
    00081    ** OVERRIDE in deriving classes as needed,
    00082    **          always call <super_class>::PrepApp() when overridden
    00083    **          (Except when parent is CMFCDialogAppBase, because that always
    00084    **          returns true, below).
    00085    */
    00086    virtual bool PrepApp(const char * p_configfilename) { return true; }
    00087
    00088
    00089    bool ParseCommandFile( LPTSTR p_filename );
    00090
    00091    /*
    00092    ** InitApp -- actions to be taken to initialize a specific application
    00093    **            including the creation of the main form
    00094    **
    00095    ** OVERRIDE in deriving classes as needed,
    00096    **          always call <super_class>::InitApp() when overridden
    00097    **          (Except when parent is CMFCDialogAppBase, because that always
    00098    **          returns true, below).
    00099    */
    00100    virtual bool InitApp() { return true; }
    00101
    00102    /*
    00103    ** GetMainWindow -- after initialization, this is used to return a pointer
    00104    **                  to the main form, which is tied into the event system
    00105    **                  to handle shutdowns on dialog closure.
    00106    */
    00107    virtual CWnd * GetMainWindow() = 0;
    00108
    00109
    00110    /*
    00111    ** OpenMainDialog -- after initialization, this is used by the
    00112    **                   deriving class to
    00113    */
    00114    virtual void OpenMainDialog() = 0;
    00115
    00116    virtual char * GetApplicationName() = 0;
    00117
    00118 public:
    00119         CMFCDialogAppBase();
    00120
    00121 // Overrides
    00122         // ClassWizard generated virtual function overrides
    00123         //{{AFX_VIRTUAL(CMFCDialogAppBase)
    00124         public:
    00125         virtual BOOL InitInstance();
    00126         //}}AFX_VIRTUAL
    00127
    00128 // Implementation
    00129
    00130         //{{AFX_MSG(CMFCDialogAppBase)
    00131                 // NOTE - the ClassWizard will add and remove member functions here.
    00132                 //    DO NOT EDIT what you see in these blocks of generated code !
    00133         //}}AFX_MSG
    00134         DECLARE_MESSAGE_MAP()
    00135
    00136 public:
    00137
    00138
    00139    // ------------------------  FOR  CMFCDialogAppBase  ---------------------
    00140    //
    00141    /*
    00142    ** StartWorkerThread -- The point at which worker threads reenter
    00143    **                      derived classes.
    00144    **                      The derived class should have class/instance
    00145    **                      variable(s) which are set (to indicate work
    00146    **                      to be done) prior to calling AfxBeginThread()
    00147    **                      and a sleep should imposed between such a
    00148    **                      call and any subsequent changes to the variables
    00149    **                      (to give the spawned thread a chance to read them).
    00150    **
    00151    **
    00152    ** OVERRIDE This method in derived classes as needed.
    00153    */
    00154    virtual UINT StartWorkerThread() { return 0; }
    00155
    00156
    00157 };
    00158
    00159
    00160
    00162
    00163 //{{AFX_INSERT_LOCATION}}
    00164 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
    00165
    00166 #endif // !defined(AFX_MFC_DLOG_APP_BASE_H__3022A762_36E0_42B6_A746_40C4AA5B66BA__INCLUDED_)