]>
Commit | Line | Data |
---|---|---|
b46b1d59 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/unix/app.h | |
3 | // Purpose: wxAppConsole implementation for Unix | |
4 | // Author: Lukasz Michalski | |
5 | // Created: 28/01/2005 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) Lukasz Michalski | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
eca47740 SN |
11 | //Ensure that sigset_t is being defined |
12 | #include <signal.h> | |
13 | ||
b46b1d59 | 14 | // wxApp subclass implementing event processing for console applications |
e0954e72 | 15 | class WXDLLIMPEXP_BASE wxAppConsole : public wxAppConsoleBase |
b46b1d59 VZ |
16 | { |
17 | public: | |
18 | // override base class initialization | |
19 | virtual bool Initialize(int& argc, wxChar** argv); | |
20 | ||
21 | ||
22 | // Unix-specific: Unix signal handling | |
23 | // ----------------------------------- | |
24 | ||
25 | // type of the function which can be registered as signal handler: notice | |
26 | // that it isn't really a signal handler, i.e. it's not subject to the | |
27 | // usual signal handlers constraints, because it is called later from | |
28 | // CheckSignal() and not when the signal really occurs | |
29 | typedef void (*SignalHandler)(int); | |
30 | ||
31 | // Set signal handler for the given signal, SIG_DFL or SIG_IGN can be used | |
32 | // instead of a function pointer | |
33 | // | |
34 | // Return true if handler was installed, false on error | |
35 | bool SetSignalHandler(int signal, SignalHandler handler); | |
36 | ||
37 | // Check if any Unix signals arrived since the last call and execute | |
38 | // handlers for them | |
39 | void CheckSignal(); | |
40 | ||
41 | private: | |
42 | // signal handler set up by SetSignalHandler() for all signals we handle, | |
43 | // it just adds the signal to m_signalsCaught -- the real processing is | |
44 | // done later, when CheckSignal() is called | |
45 | static void HandleSignal(int signal); | |
46 | ||
47 | ||
48 | // signals for which HandleSignal() had been called (reset from | |
49 | // CheckSignal()) | |
50 | sigset_t m_signalsCaught; | |
51 | ||
52 | // the signal handlers | |
53 | WX_DECLARE_HASH_MAP(int, SignalHandler, wxIntegerHash, wxIntegerEqual, SignalHandlerHash); | |
54 | SignalHandlerHash m_signalHandlerHash; | |
b46b1d59 | 55 | }; |