Statistics
| Revision:

svn-gvsig-desktop / trunk / install / launcher / izpack-launcher-1.3_linux / src / wx / include / wx / module.h @ 6834

History | View | Annotate | Download (1.65 KB)

1
/////////////////////////////////////////////////////////////////////////////
2
// Name:        module.h
3
// Purpose:     Modules handling
4
// Author:      Wolfram Gloger/adapted by Guilhem Lavaux
5
// Modified by:
6
// Created:     04/11/98
7
// RCS-ID:      $Id: module.h 6834 2006-08-24 08:23:24Z jmvivo $
8
// Copyright:   (c) Wolfram Gloger and Guilhem Lavaux
9
// Licence:     wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
11

    
12
#ifndef _WX_MODULEH__
13
#define _WX_MODULEH__
14

    
15
#include "wx/object.h"
16
#include "wx/list.h"
17

    
18
// declare a linked list of modules
19
class wxModule;
20
WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList);
21

    
22
// declaring a class derived from wxModule will automatically create an
23
// instance of this class on program startup, call its OnInit() method and call
24
// OnExit() on program termination (but only if OnInit() succeeded)
25
class WXDLLEXPORT wxModule : public wxObject
26
{
27
public:
28
    wxModule() {}
29
    virtual ~wxModule() {}
30

    
31
            // if module init routine returns FALSE application
32
        // will fail to startup
33

    
34
    bool Init() { return OnInit(); }
35
    void Exit() { OnExit(); }
36

    
37
        // Override both of these
38
        // called on program startup
39

    
40
    virtual bool OnInit() = 0;
41

    
42
            // called just before program termination, but only if OnInit()
43
        // succeeded
44
    
45
    virtual void OnExit() = 0;
46

    
47
    static void RegisterModule(wxModule* module);
48
    static void RegisterModules();
49
    static bool InitializeModules();
50
    static void CleanUpModules();
51

    
52
            // used by wxObjectLoader when unloading shared libs's
53

    
54
    static void UnregisterModule(wxModule* module);
55

    
56
protected:
57
    static wxModuleList m_modules;
58

    
59
    DECLARE_CLASS(wxModule)
60
};
61

    
62
#endif // _WX_MODULEH__
63