void OnDragMoveAllow(wxCommandEvent& event);
void OnNewFrame(wxCommandEvent& event);
void OnHelp (wxCommandEvent& event);
+#if wxUSE_LOG
void OnLogClear(wxCommandEvent& event);
+#endif // wxUSE_LOG
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
// GUI controls
wxListBox *m_ctrlFile,
*m_ctrlText;
+
+#if wxUSE_LOG
wxTextCtrl *m_ctrlLog;
wxLog *m_pLog,
*m_pLogPrev;
+#endif // wxUSE_LOG
// move the text by default (or copy)?
bool m_moveByDefault;
EVT_MENU(Menu_DragMoveAllow,DnDFrame::OnDragMoveAllow)
EVT_MENU(Menu_NewFrame, DnDFrame::OnNewFrame)
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
+#if wxUSE_LOG
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
+#endif // wxUSE_LOG
EVT_MENU(Menu_Copy, DnDFrame::OnCopy)
EVT_MENU(Menu_Paste, DnDFrame::OnPaste)
EVT_MENU(Menu_CopyBitmap, DnDFrame::OnCopyBitmap)
{
#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
// switch on trace messages
+#if wxUSE_LOG
#if defined(__WXGTK__)
wxLog::AddTraceMask(_T("clipboard"));
#elif defined(__WXMSW__)
wxLog::AddTraceMask(wxTRACE_OleCalls);
#endif
+#endif // wxUSE_LOG
#if wxUSE_LIBPNG
wxImage::AddHandler( new wxPNGHandler );
file_menu->AppendSeparator();
file_menu->Append(Menu_Quit, _T("E&xit\tCtrl-Q"));
+#if wxUSE_LOG
wxMenu *log_menu = new wxMenu;
log_menu->Append(Menu_Clear, _T("Clear\tCtrl-L"));
+#endif // wxUSE_LOG
wxMenu *help_menu = new wxMenu;
help_menu->Append(Menu_Help, _T("&Help..."));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
+#if wxUSE_LOG
menu_bar->Append(log_menu, _T("&Log"));
+#endif // wxUSE_LOG
menu_bar->Append(clip_menu, _T("&Clipboard"));
menu_bar->Append(help_menu, _T("&Help"));
m_ctrlText = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 1, &strText,
wxLB_HSCROLL | wxLB_ALWAYS_SB );
+#if wxUSE_LOG
m_ctrlLog = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER );
// redirect log messages to the text window
m_pLog = new wxLogTextCtrl(m_ctrlLog);
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
+#endif // wxUSE_LOG
#if wxUSE_DRAG_AND_DROP
// associate drop targets with the controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
+#if wxUSE_LOG
m_ctrlLog->SetDropTarget(new URLDropTarget);
+#endif // wxUSE_LOG
#endif // wxUSE_DRAG_AND_DROP
wxBoxSizer *m_sizer_top = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer *m_sizer = new wxBoxSizer( wxVERTICAL );
m_sizer->Add(m_sizer_top, 1, wxEXPAND );
- m_sizer->Add(m_ctrlLog, 1, wxEXPAND | wxBOTTOM, 50);
+#if wxUSE_LOG
+ m_sizer->Add(m_ctrlLog, 1, wxEXPAND);
+#endif // wxUSE_LOG
+ m_sizer->Add(0,50);
SetSizer( m_sizer );
m_sizer->SetSizeHints( this );
dialog.ShowModal();
}
+#if wxUSE_LOG
void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
{
m_ctrlLog->Clear();
m_ctrlText->Clear();
m_ctrlFile->Clear();
}
+#endif // wxUSE_LOG
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
DnDFrame::~DnDFrame()
{
+#if wxUSE_LOG
if ( m_pLog != NULL ) {
if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog )
delete m_pLog;
}
+#endif // wxUSE_LOG
}
// ---------------------------------------------------------------------------
DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = NULL;
DnDShapeFrame::DnDShapeFrame(wxFrame *parent)
- : wxFrame(parent, wxID_ANY, _T("Shape Frame"),
- wxDefaultPosition, wxSize(250, 150))
+ : wxFrame(parent, wxID_ANY, _T("Shape Frame"))
{
#if wxUSE_STATUSBAR
CreateStatusBar();
#include "wx/wx.h"
#endif
+#if !wxUSE_LOG
+# error You must set wxUSE_LOG to 1 in setup.h
+#endif
+
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
LboxTest_AddSeveral,
LboxTest_AddMany,
LboxTest_Clear,
+#if wxUSE_LOG
LboxTest_ClearLog,
+#endif // wxUSE_LOG
LboxTest_Change,
LboxTest_ChangeText,
LboxTest_Delete,
void OnButtonDelete(wxCommandEvent& event);
void OnButtonDeleteSel(wxCommandEvent& event);
void OnButtonClear(wxCommandEvent& event);
+#if wxUSE_LOG
void OnButtonClearLog(wxCommandEvent& event);
+#endif // wxUSE_LOG
void OnButtonAdd(wxCommandEvent& event);
void OnButtonAddSeveral(wxCommandEvent& event);
void OnButtonAddMany(wxCommandEvent& event);
wxListBox *m_lbox;
wxSizer *m_sizerLbox;
+#if wxUSE_LOG
// the listbox for logging messages
wxListBox *m_lboxLog;
+#endif // wxUSE_LOG
// the text entries for "Add/change string" and "Delete" buttons
wxTextCtrl *m_textAdd,
*m_textDelete;
private:
+#if wxUSE_LOG
// the log target we use to redirect messages to the listbox
wxLog *m_logTarget;
+#endif // wxUSE_LOG
// any class wishing to process wxWidgets events must use this macro
DECLARE_EVENT_TABLE()
};
+#if wxUSE_LOG
// A log target which just redirects the messages to a listbox
class LboxLogger : public wxLog
{
// the old log target
wxLog *m_logOld;
};
+#endif // wxUSE_LOG
// ----------------------------------------------------------------------------
// misc macros
EVT_BUTTON(LboxTest_Delete, LboxTestFrame::OnButtonDelete)
EVT_BUTTON(LboxTest_DeleteSel, LboxTestFrame::OnButtonDeleteSel)
EVT_BUTTON(LboxTest_Clear, LboxTestFrame::OnButtonClear)
+#if wxUSE_LOG
EVT_BUTTON(LboxTest_ClearLog, LboxTestFrame::OnButtonClearLog)
+#endif // wxUSE_LOG
EVT_BUTTON(LboxTest_Add, LboxTestFrame::OnButtonAdd)
EVT_BUTTON(LboxTest_AddSeveral, LboxTestFrame::OnButtonAddSeveral)
EVT_BUTTON(LboxTest_AddMany, LboxTestFrame::OnButtonAddMany)
wxFrame *frame = new LboxTestFrame(_T("wxListBox sample"));
frame->Show();
+#if wxUSE_LOG
//wxLog::AddTraceMask(_T("listbox"));
wxLog::AddTraceMask(_T("scrollbar"));
+#endif // wxUSE_LOG
return true;
}
m_chkHScroll =
m_chkSort = (wxCheckBox *)NULL;
- m_lbox =
+ m_lbox = (wxListBox *)NULL;
+#if wxUSE_LOG
m_lboxLog = (wxListBox *)NULL;
+#endif // wxUSE_LOG
m_sizerLbox = (wxSizer *)NULL;
+#if wxUSE_LOG
m_logTarget = (wxLog *)NULL;
+#endif // wxUSE_LOG
wxPanel *panel = new wxPanel(this, wxID_ANY);
sizerUp->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
// the lower one only has the log listbox and a button to clear it
+#if wxUSE_LOG
wxSizer *sizerDown = new wxStaticBoxSizer
(
new wxStaticBox(panel, wxID_ANY, _T("&Log window")),
);
m_lboxLog = new wxListBox(panel, wxID_ANY);
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
+#else
+ wxSizer *sizerDown = new wxBoxSizer(wxVERTICAL);
+#endif // wxUSE_LOG
wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
+#if wxUSE_LOG
btn = new wxButton(panel, LboxTest_ClearLog, _T("Clear &log"));
sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer
+#endif // wxUSE_LOG
btn = new wxButton(panel, LboxTest_Quit, _T("E&xit"));
sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
sizerTop->Fit(this);
sizerTop->SetSizeHints(this);
+#if wxUSE_LOG
// now that everything is created we can redirect the log messages to the
// listbox
m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget());
wxLog::SetActiveTarget(m_logTarget);
+#endif // wxUSE_LOG
}
LboxTestFrame::~LboxTestFrame()
{
+#if wxUSE_LOG
delete m_logTarget;
+#endif // wxUSE_LOG
}
// ----------------------------------------------------------------------------
m_lbox->Clear();
}
+#if wxUSE_LOG
void LboxTestFrame::OnButtonClearLog(wxCommandEvent& WXUNUSED(event))
{
m_lboxLog->Clear();
}
+#endif // wxUSE_LOG
void LboxTestFrame::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
{
void OnFullScreen( wxCommandEvent &event );
wxScrolledWindow *m_scrolled;
+#if wxUSE_LOG
wxTextCtrl *m_log;
+#endif // wxUSE_LOG
private:
DECLARE_DYNAMIC_CLASS(MyFrame)
m_scrolled = new MyScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize(100,100) );
m_scrolled->SetScrollbars( 10, 10, 50, 50 );
+#if wxUSE_LOG
m_log = new wxTextCtrl( this, wxID_ANY, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
+#endif // wxUSE_LOG
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_scrolled, 1, wxEXPAND );
+#if wxUSE_LOG
topsizer->Add( m_log, 0, wxEXPAND );
+#endif // wxUSE_LOG
SetAutoLayout( true );
SetSizer( topsizer );
{
public:
MyPanel(wxFrame *frame, int x, int y, int w, int h);
- virtual ~MyPanel() { delete wxLog::SetActiveTarget(m_logOld); }
+ virtual ~MyPanel()
+ {
+#if wxUSE_LOG
+ delete wxLog::SetActiveTarget(m_logOld);
+#endif // wxUSE_LOG
+ }
#if wxUSE_CLIPBOARD
void DoPasteFromClipboard();
MyTextCtrl *m_textrich;
+#if wxUSE_LOG
wxTextCtrl *m_log;
-
wxLog *m_logOld;
+#endif // wxUSE_LOG
private:
// get the currently focused text control or return the default one is no
wxLogMessage(_T("Already at the top"));
}
+#if wxUSE_LOG
void OnLogClear(wxCommandEvent& event);
+#endif // wxUSE_LOG
void OnFileSave(wxCommandEvent& event);
void OnFileLoad(wxCommandEvent& event);
void OnRichTextTest(wxCommandEvent& event);
menuText->Append(TEXT_PAGE_DOWN, _T("Scroll text one page up"));
menu_bar->Append(menuText, _T("Te&xt"));
+#if wxUSE_LOG
wxMenu *menuLog = new wxMenu;
menuLog->AppendCheckItem(TEXT_LOG_KEY, _T("Log &key events"));
menuLog->AppendCheckItem(TEXT_LOG_CHAR, _T("Log &char events"));
MyTextCtrl::ms_logKey =
MyTextCtrl::ms_logChar =
MyTextCtrl::ms_logText = true;
+
menu_bar->Append(menuLog, _T("&Log"));
+#endif // wxUSE_LOG
frame->SetMenuBar(menu_bar);
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
: wxPanel( frame, wxID_ANY, wxPoint(x, y), wxSize(w, h) )
{
+#if wxUSE_LOG
m_log = new wxTextCtrl( this, wxID_ANY, _T("This is the log window.\n"),
wxPoint(5,260), wxSize(630,100),
wxTE_MULTILINE | wxTE_READONLY /* | wxTE_RICH */);
m_logOld = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
+#endif // wxUSE_LOG
// single line text controls
m_text = new MyTextCtrl( this, wxID_ANY, _T("Single line."),
- wxPoint(10,10), wxSize(140,wxDefaultCoord),
+ wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
m_text->SetForegroundColour(*wxBLUE);
m_text->SetBackgroundColour(*wxLIGHT_GREY);
m_textrich->SetDefaultStyle(wxTextAttr(*wxBLUE, *wxWHITE));
m_textrich->AppendText(_T("And this should be in blue and the text you ")
_T("type should be in blue as well"));
+
+ wxBoxSizer *column1 = new wxBoxSizer(wxVERTICAL);
+ column1->Add( m_text, 0, wxALL, 10 );
+ column1->Add( m_password, 0, wxALL, 10 );
+ column1->Add( m_readonly, 0, wxALL, 10 );
+ column1->Add( m_limited, 0, wxALL, 10 );
+ column1->Add( m_horizontal, 1, wxALL | wxEXPAND, 10 );
+
+ wxBoxSizer *column2 = new wxBoxSizer(wxVERTICAL);
+ column2->Add( m_multitext, 1, wxALL | wxEXPAND, 10 );
+ column2->Add( m_tab, 1, wxALL | wxEXPAND, 10 );
+ column2->Add( m_enter, 1, wxALL | wxEXPAND, 10 );
+
+ wxBoxSizer *column3 = new wxBoxSizer(wxVERTICAL);
+ column3->Add( m_textrich, 1, wxALL | wxEXPAND, 10 );
+
+ wxBoxSizer *row1 = new wxBoxSizer(wxHORIZONTAL);
+ row1->Add( column1, 0, wxALL | wxEXPAND, 10 );
+ row1->Add( column2, 1, wxALL | wxEXPAND, 10 );
+ row1->Add( column3, 1, wxALL | wxEXPAND, 10 );
+
+ wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
+ topSizer->Add( row1, 2, wxALL | wxEXPAND, 10 );
+
+#if wxUSE_LOG
+ wxBoxSizer *row2 = new wxBoxSizer(wxHORIZONTAL);
+ row2->Add( m_log, 1, wxALL | wxEXPAND, 10 );
+ topSizer->Add( row2, 1, wxALL | wxEXPAND, 10 );
+#endif
+
+ SetAutoLayout( true );
+ SetSizer(topSizer);
}
void MyPanel::OnSize( wxSizeEvent &event )
{
+#if wxUSE_LOG
wxSize client_area( GetClientSize() );
if (m_log)
m_log->SetSize( 0, 260, client_area.x, client_area.y - 260 );
+#endif // wxUSE_LOG
event.Skip();
}
if (!wxTheClipboard->Open())
{
+#if wxUSE_LOG
*m_log << _T("Error opening the clipboard.\n");
+#endif // wxUSE_LOG
return;
}
else
{
+#if wxUSE_LOG
*m_log << _T("Successfully opened the clipboard.\n");
+#endif // wxUSE_LOG
}
wxTextDataObject data;
if (wxTheClipboard->IsSupported( data.GetFormat() ))
{
+#if wxUSE_LOG
*m_log << _T("Clipboard supports requested format.\n");
+#endif // wxUSE_LOG
if (wxTheClipboard->GetData( data ))
{
+#if wxUSE_LOG
*m_log << _T("Successfully retrieved data from the clipboard.\n");
+#endif // wxUSE_LOG
*m_multitext << data.GetText() << _T("\n");
}
else
{
+#if wxUSE_LOG
*m_log << _T("Error getting data from the clipboard.\n");
+#endif // wxUSE_LOG
}
}
else
{
+#if wxUSE_LOG
*m_log << _T("Clipboard doesn't support requested format.\n");
+#endif // wxUSE_LOG
}
wxTheClipboard->Close();
+#if wxUSE_LOG
*m_log << _T("Closed the clipboard.\n");
+#endif // wxUSE_LOG
}
void MyPanel::DoCopyToClipboard()
if (text.IsEmpty())
{
+#if wxUSE_LOG
*m_log << _T("No text to copy.\n");
+#endif // wxUSE_LOG
return;
}
if (!wxTheClipboard->Open())
{
+#if wxUSE_LOG
*m_log << _T("Error opening the clipboard.\n");
+#endif // wxUSE_LOG
return;
}
else
{
+#if wxUSE_LOG
*m_log << _T("Successfully opened the clipboard.\n");
+#endif // wxUSE_LOG
}
wxTextDataObject *data = new wxTextDataObject( text );
if (!wxTheClipboard->SetData( data ))
{
+#if wxUSE_LOG
*m_log << _T("Error while copying to the clipboard.\n");
+#endif // wxUSE_LOG
}
else
{
+#if wxUSE_LOG
*m_log << _T("Successfully copied data to the clipboard.\n");
+#endif // wxUSE_LOG
}
wxTheClipboard->Close();
+#if wxUSE_LOG
*m_log << _T("Closed the clipboard.\n");
+#endif // wxUSE_LOG
}
#endif // wxUSE_CLIPBOARD
EVT_MENU(TEXT_LOG_MOUSE,MyFrame::OnLogMouse)
EVT_MENU(TEXT_LOG_TEXT, MyFrame::OnLogText)
EVT_MENU(TEXT_LOG_FOCUS,MyFrame::OnLogFocus)
+#if wxUSE_LOG
EVT_MENU(TEXT_CLEAR, MyFrame::OnLogClear)
+#endif // wxUSE_LOG
#if wxUSE_TOOLTIPS
EVT_MENU(TEXT_TOOLTIPS_SETDELAY, MyFrame::OnSetTooltipDelay)
}
#endif // tooltips
+#if wxUSE_LOG
void MyFrame::OnLogClear(wxCommandEvent& WXUNUSED(event))
{
m_panel->m_log->Clear();
}
+#endif // wxUSE_LOG
void MyFrame::OnSetEditable(wxCommandEvent& WXUNUSED(event))
{
// My frame constructor
MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
- m_treeCtrl(NULL), m_textCtrl(NULL)
+ m_treeCtrl(NULL)
+#if wxUSE_LOG
+ , m_textCtrl(NULL)
+#endif // wxUSE_LOG
{
// This reduces flicker effects - even better would be to define
// OnEraseBackground to do nothing. When the tree control's scrollbars are
SetMenuBar(menu_bar);
#endif // wxUSE_MENUS
+#if wxUSE_LOG
// create the controls
m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxT(""),
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxSUNKEN_BORDER);
+#endif // wxUSE_LOG
CreateTreeWithDefStyle();
CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
+#if wxUSE_LOG
#ifdef __WXMOTIF__
// For some reason, we get a memcpy crash in wxLogStream::DoLogStream
// on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc?
wxLogTextCtrl *logWindow = new wxLogTextCtrl(m_textCtrl);
delete wxLog::SetActiveTarget(logWindow);
#endif
+#endif // wxUSE_LOG
}
MyFrame::~MyFrame()
{
+#if wxUSE_LOG
delete wxLog::SetActiveTarget(NULL);
+#endif // wxUSE_LOG
}
void MyFrame::CreateTreeWithDefStyle()
void MyFrame::OnSize(wxSizeEvent& event)
{
- if ( m_treeCtrl && m_textCtrl )
+ if ( m_treeCtrl
+#if wxUSE_LOG
+ && m_textCtrl
+#endif // wxUSE_LOG
+ )
{
Resize();
}
void MyFrame::Resize()
{
wxSize size = GetClientSize();
- m_treeCtrl->SetSize(0, 0, size.x, 2*size.y/3);
+ m_treeCtrl->SetSize(0, 0, size.x, size.y
+#if !wxUSE_LOG
+ );
+#else
+ *2/3);
m_textCtrl->SetSize(0, 2*size.y/3, size.x, size.y/3);
+#endif
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void CreateTree(long style);
MyTreeCtrl *m_treeCtrl;
+#if wxUSE_LOG
wxTextCtrl *m_textCtrl;
+#endif // wxUSE_LOG
void DoSetBold(bool bold = true);
protected:
// event handlers
+#if wxUSE_LOG
void OnButtonClearLog(wxCommandEvent& event);
+#endif // wxUSE_LOG
void OnButtonQuit(wxCommandEvent& event);
// initialize the notebook: add all pages to it
// the panel containing everything
wxPanel *m_panel;
+#if wxUSE_LOG
// the listbox for logging messages
wxListBox *m_lboxLog;
// the log target we use to redirect messages to the listbox
wxLog *m_logTarget;
+#endif // wxUSE_LOG
// the notebook containing the test pages
wxNotebook *m_notebook;
DECLARE_EVENT_TABLE()
};
+#if wxUSE_LOG
// A log target which just redirects the messages to a listbox
class LboxLogger : public wxLog
{
// the old log target
wxLog *m_logOld;
};
+#endif // wxUSE_LOG
// array of pages
WX_DEFINE_ARRAY_PTR(WidgetsPage *, ArrayWidgetsPage);
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(WidgetsFrame, wxFrame)
+#if wxUSE_LOG
EVT_BUTTON(Widgets_ClearLog, WidgetsFrame::OnButtonClearLog)
+#endif // wxUSE_LOG
EVT_BUTTON(Widgets_Quit, WidgetsFrame::OnButtonQuit)
END_EVENT_TABLE()
wxTAB_TRAVERSAL)
{
// init everything
+#if wxUSE_LOG
m_lboxLog = (wxListBox *)NULL;
m_logTarget = (wxLog *)NULL;
+#endif // wxUSE_LOG
m_notebook = (wxNotebook *)NULL;
m_imaglist = (wxImageList *)NULL;
InitNotebook();
// the lower one only has the log listbox and a button to clear it
+#if wxUSE_LOG
wxSizer *sizerDown = new wxStaticBoxSizer(
new wxStaticBox( m_panel, wxID_ANY, _T("&Log window") ),
wxVERTICAL);
m_lboxLog = new wxListBox(m_panel, wxID_ANY);
sizerDown->Add(m_lboxLog, 1, wxGROW | wxALL, 5);
sizerDown->SetMinSize(100, 150);
+#else
+ wxSizer *sizerDown = new wxBoxSizer(wxVERTICAL);
+#endif // wxUSE_LOG
wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
- wxButton *btn = new wxButton(m_panel, Widgets_ClearLog, _T("Clear &log"));
+ wxButton *btn;
+#if wxUSE_LOG
+ btn = new wxButton(m_panel, Widgets_ClearLog, _T("Clear &log"));
sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer
+#endif // wxUSE_LOG
btn = new wxButton(m_panel, Widgets_Quit, _T("E&xit"));
sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
sizerTop->Fit(this);
sizerTop->SetSizeHints(this);
+#if wxUSE_LOG && !defined(__WXCOCOA__)
// wxCocoa's listbox is too flakey to use for logging right now
- #if !defined(__WXCOCOA__)
// now that everything is created we can redirect the log messages to the
// listbox
m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget());
wxLog::SetActiveTarget(m_logTarget);
- #endif
+#endif
}
void WidgetsFrame::InitNotebook()
WidgetsFrame::~WidgetsFrame()
{
+#if wxUSE_LOG
delete m_logTarget;
+#endif // wxUSE_LOG
delete m_imaglist;
}
Close();
}
+#if wxUSE_LOG
void WidgetsFrame::OnButtonClearLog(wxCommandEvent& WXUNUSED(event))
{
m_lboxLog->Clear();
}
+#endif // wxUSE_LOG
// ----------------------------------------------------------------------------
// WidgetsPageInfo