]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/logg.h
don't draw borders for bitmap buttons with wxBORDER_NONE style
[wxWidgets.git] / include / wx / generic / logg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/logg.h
3 // Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 29/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LOGG_H_
13 #define _WX_LOGG_H_
14
15 #if wxUSE_GUI
16
17 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
18 class WXDLLIMPEXP_FWD_CORE wxLogFrame;
19 class WXDLLIMPEXP_FWD_CORE wxWindow;
20
21 // ----------------------------------------------------------------------------
22 // the following log targets are only compiled in if the we're compiling the
23 // GUI part (andnot just the base one) of the library, they're implemented in
24 // src/generic/logg.cpp *and not src/common/log.cpp unlike all the rest)
25 // ----------------------------------------------------------------------------
26
27 #if wxUSE_TEXTCTRL
28
29 // log everything to a text window (GUI only of course)
30 class WXDLLIMPEXP_CORE wxLogTextCtrl : public wxLog
31 {
32 public:
33 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
34
35 protected:
36 // implement sink function
37 virtual void DoLogString(const wxString& szString, time_t t);
38
39 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
40
41 private:
42 // the control we use
43 wxTextCtrl *m_pTextCtrl;
44
45 wxDECLARE_NO_COPY_CLASS(wxLogTextCtrl);
46 };
47
48 #endif // wxUSE_TEXTCTRL
49
50 // ----------------------------------------------------------------------------
51 // GUI log target, the default one for wxWidgets programs
52 // ----------------------------------------------------------------------------
53
54 #if wxUSE_LOGGUI
55
56 class WXDLLIMPEXP_CORE wxLogGui : public wxLog
57 {
58 public:
59 // ctor
60 wxLogGui();
61
62 // show all messages that were logged since the last Flush()
63 virtual void Flush();
64
65 protected:
66 virtual void DoLog(wxLogLevel level, const wxString& szString, time_t t);
67
68 wxSUPPRESS_DOLOG_HIDE_WARNING()
69
70 // return the title to be used for the log dialog, depending on m_bErrors
71 // and m_bWarnings values
72 wxString GetTitle() const;
73
74 // return the icon (one of wxICON_XXX constants) to be used for the dialog
75 // depending on m_bErrors/m_bWarnings
76 int GetSeverityIcon() const;
77
78 // empty everything
79 void Clear();
80
81
82 wxArrayString m_aMessages; // the log message texts
83 wxArrayInt m_aSeverity; // one of wxLOG_XXX values
84 wxArrayLong m_aTimes; // the time of each message
85 bool m_bErrors, // do we have any errors?
86 m_bWarnings, // any warnings?
87 m_bHasMessages; // any messages at all?
88
89 private:
90 // this method is called to show a single log message, it uses
91 // wxMessageBox() by default
92 virtual void DoShowSingleLogMessage(const wxString& message,
93 const wxString& title,
94 int style);
95
96 // this method is called to show multiple log messages, it uses wxLogDialog
97 virtual void DoShowMultipleLogMessages(const wxArrayString& messages,
98 const wxArrayInt& severities,
99 const wxArrayLong& times,
100 const wxString& title,
101 int style);
102 };
103
104 #endif // wxUSE_LOGGUI
105
106 // ----------------------------------------------------------------------------
107 // (background) log window: this class forwards all log messages to the log
108 // target which was active when it was instantiated, but also collects them
109 // to the log window. This window has it's own menu which allows the user to
110 // close it, clear the log contents or save it to the file.
111 // ----------------------------------------------------------------------------
112
113 #if wxUSE_LOGWINDOW
114
115 class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough
116 {
117 public:
118 wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL)
119 const wxString& szTitle, // the title of the frame
120 bool bShow = true, // show window immediately?
121 bool bPassToOld = true); // pass messages to the old target?
122
123 virtual ~wxLogWindow();
124
125 // window operations
126 // show/hide the log window
127 void Show(bool bShow = true);
128 // retrieve the pointer to the frame
129 wxFrame *GetFrame() const;
130
131 // overridables
132 // called immediately after the log frame creation allowing for
133 // any extra initializations
134 virtual void OnFrameCreate(wxFrame *frame);
135 // called if the user closes the window interactively, will not be
136 // called if it is destroyed for another reason (such as when program
137 // exits) - return true from here to allow the frame to close, false
138 // to prevent this from happening
139 virtual bool OnFrameClose(wxFrame *frame);
140 // called right before the log frame is going to be deleted: will
141 // always be called unlike OnFrameClose()
142 virtual void OnFrameDelete(wxFrame *frame);
143
144 protected:
145 virtual void DoLog(wxLogLevel level, const wxString& szString, time_t t);
146 virtual void DoLogString(const wxString& szString, time_t t);
147
148 wxSUPPRESS_DOLOG_HIDE_WARNING()
149 wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
150
151 private:
152 wxLogFrame *m_pLogFrame; // the log frame
153
154 wxDECLARE_NO_COPY_CLASS(wxLogWindow);
155 };
156
157 #endif // wxUSE_LOGWINDOW
158
159 #endif // wxUSE_GUI
160
161 #endif // _WX_LOGG_H_
162