]>
Commit | Line | Data |
---|---|---|
e2478fde VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/apptbase.h | |
3 | // Purpose: declaration of wxAppTraits for MSW | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 22.06.2003 | |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 9 | // Licence: wxWindows licence |
e2478fde VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_MSW_APPTBASE_H_ | |
13 | #define _WX_MSW_APPTBASE_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // wxAppTraits: the MSW version adds extra hooks needed by MSW-only code | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
bb24c68f | 19 | class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase |
e2478fde VZ |
20 | { |
21 | public: | |
22 | // wxExecute() support methods | |
23 | // --------------------------- | |
24 | ||
25 | // called before starting to wait for the child termination, may return | |
26 | // some opaque data which will be passed later to AfterChildWaitLoop() | |
27 | virtual void *BeforeChildWaitLoop() = 0; | |
28 | ||
29 | // process pending Windows messages, even in console app | |
30 | virtual void AlwaysYield() = 0; | |
31 | ||
32 | // called after starting to wait for the child termination, the parameter | |
33 | // is the return value of BeforeChildWaitLoop() | |
34 | virtual void AfterChildWaitLoop(void *data) = 0; | |
35 | ||
36 | ||
37 | // wxThread helpers | |
38 | // ---------------- | |
39 | ||
40 | // process a message while waiting for a(nother) thread, should return | |
41 | // false if and only if we have to exit the application | |
42 | virtual bool DoMessageFromThreadWait() = 0; | |
e570a44b | 43 | |
535920ff VZ |
44 | // wait for the handle to be signaled, return WAIT_OBJECT_0 if it is or, in |
45 | // the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived | |
e570a44b | 46 | virtual WXDWORD WaitForThread(WXHANDLE hThread) = 0; |
535920ff | 47 | |
2804f77d VZ |
48 | |
49 | // wxSocket support | |
50 | // ---------------- | |
51 | ||
52 | #if wxUSE_SOCKETS | |
53 | // this function is used by wxNet library to set the default socket manager | |
54 | // to use: doing it like this allows us to keep all socket-related code in | |
55 | // wxNet instead of having to pull it in wxBase itself as we'd have to do | |
56 | // if we really implemented GSocketManager here | |
57 | // | |
58 | // we don't take ownership of this pointer, it should have a lifetime | |
59 | // greater than that of any socket (e.g. be a pointer to a static object) | |
60 | static void SetDefaultSocketManager(GSocketManager *manager) | |
61 | { | |
62 | ms_manager = manager; | |
63 | } | |
64 | ||
65 | virtual GSocketManager *GetSocketManager() { return ms_manager; } | |
66 | #endif // wxUSE_SOCKETS | |
67 | ||
784ee7d5 VZ |
68 | |
69 | #ifndef __WXWINCE__ | |
70 | // console helpers | |
71 | // --------------- | |
72 | ||
73 | // this method can be overridden by a derived class to always return true | |
74 | // or false to force [not] using the console for output to stderr | |
75 | // | |
76 | // by default console applications always return true from here while the | |
77 | // GUI ones only return true if they're being run from console and there is | |
78 | // no other activity happening in this console | |
79 | virtual bool CanUseStderr() = 0; | |
80 | ||
81 | // write text to the console, return true if ok or false on error | |
82 | virtual bool WriteToStderr(const wxString& text) = 0; | |
83 | #endif // !__WXWINCE__ | |
84 | ||
535920ff VZ |
85 | protected: |
86 | // implementation of WaitForThread() for the console applications which is | |
87 | // also used by the GUI code if it doesn't [yet|already} dispatch events | |
88 | WXDWORD DoSimpleWaitForThread(WXHANDLE hThread); | |
2804f77d VZ |
89 | |
90 | static GSocketManager *ms_manager; | |
e2478fde VZ |
91 | }; |
92 | ||
93 | #endif // _WX_MSW_APPTBASE_H_ | |
94 |