Fixes for wxUSE_STATUSBAR.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28310 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-07-19 15:36:01 +00:00
parent d96cdd4a88
commit 8520f1374c
41 changed files with 220 additions and 19 deletions

View File

@@ -225,9 +225,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
m_canvas = new MyCanvas(this); m_canvas = new MyCanvas(this);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(_T("Welcome to wxWidgets!")); SetStatusText(_T("Welcome to wxWidgets!"));
#endif // wxUSE_STATUSBAR
} }
@@ -385,15 +387,16 @@ void MyCanvas::ChangeSize()
free(m_text); free(m_text);
m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar)); m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar));
#if wxUSE_STATUSBAR
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && frame->GetStatusBar() ) if ( frame && frame->GetStatusBar() )
{ {
wxString msg; wxString msg;
msg.Printf(_T("Panel size is (%d, %d)"), m_xChars, m_yChars); msg.Printf(_T("Panel size is (%d, %d)"), m_xChars, m_yChars);
frame->SetStatusText(msg, 1); frame->SetStatusText(msg, 1);
} }
#endif // wxUSE_STATUSBAR
} }
// NB: this method is horrible inefficient especially because the caret // NB: this method is horrible inefficient especially because the caret

View File

@@ -138,11 +138,13 @@ CheckListBoxFrame::CheckListBoxFrame(wxFrame *frame,
int x, int y, int w, int h) int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)) : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{ {
#if wxUSE_STATUSBAR
// create the status line // create the status line
const int widths[] = { -1, 60 }; const int widths[] = { -1, 60 };
CreateStatusBar(2); CreateStatusBar(2);
SetStatusWidths(2, widths); SetStatusWidths(2, widths);
wxLogStatus(this, _T("no selection")); wxLogStatus(this, _T("no selection"));
#endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
// -------------- // --------------

View File

@@ -159,7 +159,9 @@ MyFrame::MyFrame()
menu_bar->Append(file_menu, _T("&File")); menu_bar->Append(file_menu, _T("&File"));
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
// child controls // child controls
wxPanel *panel = new wxPanel(this); wxPanel *panel = new wxPanel(this);

View File

@@ -178,7 +178,9 @@ bool MyApp::OnInit()
return false; return false;
} }
#if wxUSE_STATUSBAR
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? _T("LAN") : _T("No LAN"), 2); frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? _T("LAN") : _T("No LAN"), 2);
#endif // wxUSE_STATUSBAR
return true; return true;
} }
@@ -238,10 +240,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
// create status bar and fill the LAN field // create status bar and fill the LAN field
CreateStatusBar(3); CreateStatusBar(3);
static const int widths[3] = { -1, 100, 60 }; static const int widths[3] = { -1, 100, 60 };
SetStatusWidths(3, widths); SetStatusWidths(3, widths);
#endif // wxUSE_STATUSBAR
} }
@@ -335,6 +339,8 @@ void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
{ {
s_isOnline = isOnline; s_isOnline = isOnline;
#if wxUSE_STATUSBAR
SetStatusText(isOnline ? _T("Online") : _T("Offline"), 1); SetStatusText(isOnline ? _T("Online") : _T("Offline"), 1);
#endif // wxUSE_STATUSBAR
} }
} }

View File

@@ -220,8 +220,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
SetMenuBar(menuBar); SetMenuBar(menuBar);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// create status bar // create status bar
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
// create child controls // create child controls
@@ -336,7 +338,9 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event))
{ {
#if wxUSE_STATUSBAR
SetStatusText(_T("Press the mouse anywhere...")); SetStatusText(_T("Press the mouse anywhere..."));
#endif // wxUSE_STATUSBAR
CaptureMouse(); CaptureMouse();
} }

View File

@@ -742,9 +742,18 @@ public:
// override base class (pure) virtuals // override base class (pure) virtuals
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
{ m_frame->SetStatusText(_T("Mouse entered the frame")); return OnDragOver(x, y, def); } {
#if wxUSE_STATUSBAR
m_frame->SetStatusText(_T("Mouse entered the frame"));
#endif // wxUSE_STATUSBAR
return OnDragOver(x, y, def);
}
virtual void OnLeave() virtual void OnLeave()
{ m_frame->SetStatusText(_T("Mouse left the frame")); } {
#if wxUSE_STATUSBAR
m_frame->SetStatusText(_T("Mouse left the frame"));
#endif // wxUSE_STATUSBAR
}
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
{ {
if ( !GetData() ) if ( !GetData() )
@@ -919,7 +928,9 @@ DnDFrame::DnDFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h)
// frame icon and status bar // frame icon and status bar
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
#if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
// construct menu // construct menu
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
@@ -1155,8 +1166,11 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
else if ( m_moveAllow ) else if ( m_moveAllow )
flags |= wxDrag_AllowMove; flags |= wxDrag_AllowMove;
wxDragResult result = source.DoDragDrop(flags);
#if wxUSE_STATUSBAR
const wxChar *pc; const wxChar *pc;
switch ( source.DoDragDrop(flags) ) switch ( result )
{ {
case wxDragError: pc = _T("Error!"); break; case wxDragError: pc = _T("Error!"); break;
case wxDragNone: pc = _T("Nothing"); break; case wxDragNone: pc = _T("Nothing"); break;
@@ -1167,6 +1181,9 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
} }
SetStatusText(wxString(_T("Drag result: ")) + pc); SetStatusText(wxString(_T("Drag result: ")) + pc);
#else
wxUnusedVar(result);
#endif // wxUSE_STATUSBAR
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
} }
@@ -1625,7 +1642,9 @@ DnDShapeFrame::DnDShapeFrame(wxFrame *parent)
: wxFrame(parent, wxID_ANY, _T("Shape Frame"), : wxFrame(parent, wxID_ANY, _T("Shape Frame"),
wxDefaultPosition, wxSize(250, 150)) wxDefaultPosition, wxSize(250, 150))
{ {
#if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
wxMenu *menuShape = new wxMenu; wxMenu *menuShape = new wxMenu;
menuShape->Append(Menu_Shape_New, _T("&New default shape\tCtrl-S")); menuShape->Append(Menu_Shape_New, _T("&New default shape\tCtrl-S"));
@@ -1643,7 +1662,9 @@ DnDShapeFrame::DnDShapeFrame(wxFrame *parent)
SetMenuBar(menubar); SetMenuBar(menubar);
#if wxUSE_STATUSBAR
SetStatusText(_T("Press Ctrl-S to create a new shape")); SetStatusText(_T("Press Ctrl-S to create a new shape"));
#endif // wxUSE_STATUSBAR
SetDropTarget(new DnDShapeDropTarget(this)); SetDropTarget(new DnDShapeDropTarget(this));
@@ -1689,7 +1710,9 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
break; break;
case wxDragNone: case wxDragNone:
#if wxUSE_STATUSBAR
SetStatusText(_T("Nothing happened")); SetStatusText(_T("Nothing happened"));
#endif // wxUSE_STATUSBAR
break; break;
case wxDragCopy: case wxDragCopy:
@@ -1706,13 +1729,17 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
break; break;
case wxDragCancel: case wxDragCancel:
#if wxUSE_STATUSBAR
SetStatusText(_T("Drag and drop operation cancelled")); SetStatusText(_T("Drag and drop operation cancelled"));
#endif // wxUSE_STATUSBAR
break; break;
} }
if ( pc ) if ( pc )
{ {
#if wxUSE_STATUSBAR
SetStatusText(wxString(_T("Shape successfully ")) + pc); SetStatusText(wxString(_T("Shape successfully ")) + pc);
#endif // wxUSE_STATUSBAR
} }
//else: status text already set //else: status text already set
} }
@@ -1723,9 +1750,11 @@ void DnDShapeFrame::OnDrop(wxCoord x, wxCoord y, DnDShape *shape)
wxPoint pt(x, y); wxPoint pt(x, y);
#if wxUSE_STATUSBAR
wxString s; wxString s;
s.Printf(wxT("Shape dropped at (%d, %d)"), pt.x, pt.y); s.Printf(wxT("Shape dropped at (%d, %d)"), pt.x, pt.y);
SetStatusText(s); SetStatusText(s);
#endif // wxUSE_STATUSBAR
shape->Move(pt); shape->Move(pt);
SetShape(shape); SetShape(shape);
@@ -1738,10 +1767,12 @@ void DnDShapeFrame::OnEditShape(wxCommandEvent& WXUNUSED(event))
{ {
SetShape(dlg.GetShape()); SetShape(dlg.GetShape());
#if wxUSE_STATUSBAR
if ( m_shape ) if ( m_shape )
{ {
SetStatusText(_T("You can now drag the shape to another frame")); SetStatusText(_T("You can now drag the shape to another frame"));
} }
#endif // wxUSE_STATUSBAR
} }
} }
@@ -1749,7 +1780,9 @@ void DnDShapeFrame::OnNewShape(wxCommandEvent& WXUNUSED(event))
{ {
SetShape(new DnDEllipticShape(wxPoint(10, 10), wxSize(80, 60), *wxRED)); SetShape(new DnDEllipticShape(wxPoint(10, 10), wxSize(80, 60), *wxRED));
#if wxUSE_STATUSBAR
SetStatusText(_T("You can now drag the shape to another frame")); SetStatusText(_T("You can now drag the shape to another frame"));
#endif // wxUSE_STATUSBAR
} }
void DnDShapeFrame::OnClearShape(wxCommandEvent& WXUNUSED(event)) void DnDShapeFrame::OnClearShape(wxCommandEvent& WXUNUSED(event))
@@ -1902,13 +1935,17 @@ void DnDShapeDataObject::CreateBitmap() const
static void ShowBitmap(const wxBitmap& bitmap) static void ShowBitmap(const wxBitmap& bitmap)
{ {
wxFrame *frame = new wxFrame(NULL, wxID_ANY, _T("Bitmap view")); wxFrame *frame = new wxFrame(NULL, wxID_ANY, _T("Bitmap view"));
#if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
DnDCanvasBitmap *canvas = new DnDCanvasBitmap(frame); DnDCanvasBitmap *canvas = new DnDCanvasBitmap(frame);
canvas->SetBitmap(bitmap); canvas->SetBitmap(bitmap);
int w = bitmap.GetWidth(), int w = bitmap.GetWidth(),
h = bitmap.GetHeight(); h = bitmap.GetHeight();
#if wxUSE_STATUSBAR
frame->SetStatusText(wxString::Format(_T("%dx%d"), w, h)); frame->SetStatusText(wxString::Format(_T("%dx%d"), w, h));
#endif // wxUSE_STATUSBAR
frame->SetClientSize(w > 100 ? 100 : w, h > 100 ? 100 : h); frame->SetClientSize(w > 100 ? 100 : w, h > 100 ? 100 : h);
frame->Show(true); frame->Show(true);

View File

@@ -341,9 +341,11 @@ MyFrame::MyFrame()
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR
m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) ); m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );
} }

View File

@@ -323,15 +323,19 @@ void MyFrame::OnConnect(wxCommandEvent& event)
(wxEventFunction) (wxEventFunction)
(wxCommandEventFunction)&MyFrame::OnDynamic); (wxCommandEventFunction)&MyFrame::OnDynamic);
#if wxUSE_STATUSBAR
SetStatusText(_T("You can now use \"Dynamic\" item in the menu")); SetStatusText(_T("You can now use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: on"), Status_Dynamic); SetStatusText(_T("Dynamic: on"), Status_Dynamic);
#endif // wxUSE_STATUSBAR
} }
else // connect else // connect
{ {
Disconnect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED); Disconnect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED);
#if wxUSE_STATUSBAR
SetStatusText(_T("You can no more use \"Dynamic\" item in the menu")); SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: off"), Status_Dynamic); SetStatusText(_T("Dynamic: off"), Status_Dynamic);
#endif // wxUSE_STATUSBAR
} }
} }
@@ -343,7 +347,9 @@ void MyFrame::OnPushEventHandler(wxCommandEvent& WXUNUSED(event))
{ {
PushEventHandler(new MyEvtHandler(++m_nPush)); PushEventHandler(new MyEvtHandler(++m_nPush));
#if wxUSE_STATUSBAR
SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push); SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
@@ -353,7 +359,9 @@ void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
PopEventHandler(true /* delete handler */); PopEventHandler(true /* delete handler */);
m_nPush--; m_nPush--;
#if wxUSE_STATUSBAR
SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push); SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))

View File

@@ -293,9 +293,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
splitter->SplitHorizontally(m_textctrl, m_canvas, 100); splitter->SplitHorizontally(m_textctrl, m_canvas, 100);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(); CreateStatusBar();
SetStatusText(wxT("Welcome to wxWidgets font demo!")); SetStatusText(wxT("Welcome to wxWidgets font demo!"));
#endif // wxUSE_STATUSBAR
} }
// -------------------------------------------------------- // --------------------------------------------------------

View File

@@ -425,9 +425,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(); CreateStatusBar();
SetStatusText(_T("Welcome to wxWidgets!")); SetStatusText(_T("Welcome to wxWidgets!"));
#endif // wxUSE_STATUSBAR
// now create some controls // now create some controls

View File

@@ -335,7 +335,9 @@ void MyFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
m_hlbox->SetBackgroundColour(col); m_hlbox->SetBackgroundColour(col);
m_hlbox->Refresh(); m_hlbox->Refresh();
#if wxUSE_STATUSBAR
SetStatusText(_T("Background colour changed.")); SetStatusText(_T("Background colour changed."));
#endif // wxUSE_STATUSBAR
} }
} }
@@ -347,7 +349,9 @@ void MyFrame::OnSetSelBgCol(wxCommandEvent& WXUNUSED(event))
m_hlbox->SetSelectionBackground(col); m_hlbox->SetSelectionBackground(col);
m_hlbox->Refresh(); m_hlbox->Refresh();
#if wxUSE_STATUSBAR
SetStatusText(_T("Selection background colour changed.")); SetStatusText(_T("Selection background colour changed."));
#endif // wxUSE_STATUSBAR
} }
} }
@@ -387,10 +391,12 @@ void MyFrame::OnLboxSelect(wxCommandEvent& event)
wxLogMessage(_T("Selected items: %s"), s.c_str()); wxLogMessage(_T("Selected items: %s"), s.c_str());
} }
#if wxUSE_STATUSBAR
SetStatusText(wxString::Format( SetStatusText(wxString::Format(
_T("# items selected = %lu"), _T("# items selected = %lu"),
(unsigned long)m_hlbox->GetSelectedCount() (unsigned long)m_hlbox->GetSelectedCount()
)); ));
#endif // wxUSE_STATUSBAR
} }
// ============================================================================ // ============================================================================

View File

@@ -189,11 +189,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
#endif // wxUSE_STATUSBAR
m_Html = new wxHtmlWindow(this); m_Html = new wxHtmlWindow(this);
m_Html -> SetRelatedFrame(this, _("HTML : %s")); m_Html -> SetRelatedFrame(this, _("HTML : %s"));
#if wxUSE_STATUSBAR
m_Html -> SetRelatedStatusBar(0); m_Html -> SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR
m_Name = wxT("test.htm"); m_Name = wxT("test.htm");
m_Html -> LoadPage(m_Name); m_Html -> LoadPage(m_Name);

View File

@@ -184,13 +184,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
SetAcceleratorTable(accel); SetAcceleratorTable(accel);
#endif // wxUSE_ACCEL #endif // wxUSE_ACCEL
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
#endif // wxUSE_STATUSBAR
m_Processor = new BoldProcessor; m_Processor = new BoldProcessor;
m_Processor->Enable(false); m_Processor->Enable(false);
m_Html = new wxHtmlWindow(this); m_Html = new wxHtmlWindow(this);
m_Html->SetRelatedFrame(this, _("HTML : %s")); m_Html->SetRelatedFrame(this, _("HTML : %s"));
#if wxUSE_STATUSBAR
m_Html->SetRelatedStatusBar(0); m_Html->SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR
m_Html->ReadCustomization(wxConfig::Get()); m_Html->ReadCustomization(wxConfig::Get());
m_Html->LoadFile(wxFileName(wxT("test.htm"))); m_Html->LoadFile(wxFileName(wxT("test.htm")));
m_Html->AddProcessor(m_Processor); m_Html->AddProcessor(m_Processor);

View File

@@ -202,11 +202,15 @@ wxHtmlWindow *html;
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
html = new wxHtmlWindow(this); html = new wxHtmlWindow(this);
html -> SetRelatedFrame(this, _("VFS Demo: '%s'")); html -> SetRelatedFrame(this, _("VFS Demo: '%s'"));
#if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(1); html -> SetRelatedStatusBar(1);
#endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage(wxT("start.htm"));
} }

View File

@@ -193,11 +193,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
html = new wxHtmlWindow(this); html = new wxHtmlWindow(this);
html -> SetRelatedFrame(this, _("VFS Demo: '%s'")); html -> SetRelatedFrame(this, _("VFS Demo: '%s'"));
#if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(1); html -> SetRelatedStatusBar(1);
#endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage(wxT("start.htm"));
} }

View File

@@ -153,15 +153,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
#endif // wxUSE_STATUSBAR
{
html = new wxHtmlWindow(this); html = new wxHtmlWindow(this);
html -> SetRelatedFrame(this, _("HTML : %s")); html -> SetRelatedFrame(this, _("HTML : %s"));
#if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(0); html -> SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage(wxT("start.htm"));
} }
}
// event handlers // event handlers

View File

@@ -880,9 +880,11 @@ MyFrame::MyFrame()
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR
m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) ); m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );

View File

@@ -100,7 +100,9 @@ int MyApp::OnExit()
MyFrame::MyFrame(wxFrame *frame, const wxString& title) MyFrame::MyFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(350, 250)) : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(350, 250))
{ {
#if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
// Give it an icon // Give it an icon
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));

View File

@@ -24,10 +24,6 @@
# error You must set wxUSE_JOYSTICK to 1 in setup.h # error You must set wxUSE_JOYSTICK to 1 in setup.h
#endif #endif
#if !wxUSE_STATUSBAR
# error You must set wxUSE_STATUSBAR to 1 in setup.h
#endif
#include "wx/sound.h" #include "wx/sound.h"
#include "wx/joystick.h" #include "wx/joystick.h"
@@ -87,7 +83,9 @@ bool MyApp::OnInit()
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
frame->CenterOnScreen(); frame->CenterOnScreen();
frame->Show(true); frame->Show(true);
@@ -151,6 +149,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
xpos = pt.x; xpos = pt.x;
ypos = pt.y; ypos = pt.y;
#if wxUSE_STATUSBAR
wxString buf; wxString buf;
if (event.ButtonDown()) if (event.ButtonDown())
buf.Printf(_T("Joystick (%d, %d) Fire!"), pt.x, pt.y); buf.Printf(_T("Joystick (%d, %d) Fire!"), pt.x, pt.y);
@@ -158,6 +157,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
buf.Printf(_T("Joystick (%d, %d)"), pt.x, pt.y); buf.Printf(_T("Joystick (%d, %d)"), pt.x, pt.y);
frame->SetStatusText(buf); frame->SetStatusText(buf);
#endif // wxUSE_STATUSBAR
#if wxUSE_SOUND #if wxUSE_SOUND
if (event.ButtonDown() && wxGetApp().m_fire.IsOk()) if (event.ButtonDown() && wxGetApp().m_fire.IsOk())

View File

@@ -91,9 +91,10 @@ MyFrame::MyFrame()
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(_T("wxWidgets layout demo")); SetStatusText(_T("wxWidgets layout demo"));
#endif // wxUSE_STATUSBAR
// we want to get a dialog that is stretchable because it // we want to get a dialog that is stretchable because it
// has a text ctrl in the middle. at the bottom, we have // has a text ctrl in the middle. at the bottom, we have

View File

@@ -238,7 +238,9 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL); RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);
#if wxUSE_STATUSBAR
CreateStatusBar(3); CreateStatusBar(3);
#endif // wxUSE_STATUSBAR
} }
MyFrame::~MyFrame() MyFrame::~MyFrame()

View File

@@ -145,7 +145,9 @@ bool MyApp::OnInit()
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
frame->Show(true); frame->Show(true);
@@ -260,8 +262,10 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
// Associate the menu bar with the frame // Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
subframe->CreateStatusBar(); subframe->CreateStatusBar();
subframe->SetStatusText(title); subframe->SetStatusText(title);
#endif // wxUSE_STATUSBAR
int width, height; int width, height;
subframe->GetClientSize(&width, &height); subframe->GetClientSize(&width, &height);

View File

@@ -37,8 +37,10 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
{ {
// Create menu and status bar. // Create menu and status bar.
CreateMyMenuBar(); CreateMyMenuBar();
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
SetStatusText( _T("Welcome to Styles!") ); SetStatusText( _T("Welcome to Styles!") );
#endif // wxUSE_STATUSBAR
wxImage image; wxImage image;
image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG ); image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );

View File

@@ -58,8 +58,10 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
{ {
// Create menu and status bar. // Create menu and status bar.
CreateMyMenuBar(); CreateMyMenuBar();
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
SetStatusText( _T("Welcome to wxEdit!") ); SetStatusText( _T("Welcome to wxEdit!") );
#endif // wxUSE_STATUSBAR
// Create edit control. Since it is the only // Create edit control. Since it is the only
// control in the frame, it will be resized // control in the frame, it will be resized
@@ -184,7 +186,9 @@ void MyFrame::OnLastFiles( wxCommandEvent &event )
m_text->Clear(); m_text->Clear();
m_text->LoadFile( m_filename ); m_text->LoadFile( m_filename );
#if wxUSE_STATUSBAR
SetStatusText( m_filename ); SetStatusText( m_filename );
#endif // wxUSE_STATUSBAR
} }
else else
{ {
@@ -208,7 +212,9 @@ void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) )
m_filename = wxEmptyString; m_filename = wxEmptyString;
#if wxUSE_STATUSBAR
SetStatusText( _T("") ); SetStatusText( _T("") );
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
@@ -252,7 +258,9 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
m_filename = dialog.GetPath(); m_filename = dialog.GetPath();
m_text->LoadFile( m_filename ); m_text->LoadFile( m_filename );
#if wxUSE_STATUSBAR
SetStatusText( m_filename ); SetStatusText( m_filename );
#endif // wxUSE_STATUSBAR
} }
} }
@@ -271,7 +279,9 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
m_filename = dialog.GetPath(); m_filename = dialog.GetPath();
m_text->SaveFile( m_filename ); m_text->SaveFile( m_filename );
#if wxUSE_STATUSBAR
SetStatusText( m_filename ); SetStatusText( m_filename );
#endif // wxUSE_STATUSBAR
} }
} }

View File

@@ -44,8 +44,10 @@ bool MyApp::OnInit(void)
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(NULL, wxID_ANY, _T("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250)); MyFrame *frame = new MyFrame(NULL, wxID_ANY, _T("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250));
#if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
frame->CreateStatusBar(2); frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;

View File

@@ -170,9 +170,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(_T("Welcome to wxWidgets!")); SetStatusText(_T("Welcome to wxWidgets!"));
#endif // wxUSE_STATUSBAR
} }

View File

@@ -212,11 +212,13 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
// create the menu // create the menu
InitMenu(); InitMenu();
#if wxUSE_STATUSBAR
// create the status line // create the status line
const int widths[] = { -1, 60 }; const int widths[] = { -1, 60 };
CreateStatusBar(2); CreateStatusBar(2);
SetStatusWidths(2, widths); SetStatusWidths(2, widths);
SetStatusText(_T("no selection"), 0); SetStatusText(_T("no selection"), 0);
#endif // wxUSE_STATUSBAR
// make a panel with some controls // make a panel with some controls
wxPanel *pPanel = new wxPanel(this); wxPanel *pPanel = new wxPanel(this);
@@ -332,11 +334,15 @@ void OwnerDrawnFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event) void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
{ {
#if wxUSE_STATUSBAR
wxString strSelection; wxString strSelection;
unsigned int nSel = event.GetSelection(); unsigned int nSel = event.GetSelection();
strSelection.Printf(wxT("item %d selected (%schecked)"), nSel, strSelection.Printf(wxT("item %d selected (%schecked)"), nSel,
m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not ")); m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
SetStatusText(strSelection); SetStatusText(strSelection);
#else
wxUnusedVar(event);
#endif // wxUSE_STATUSBAR
} }
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event)) void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event))
@@ -350,9 +356,13 @@ void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event))
void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event) void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
{ {
#if wxUSE_STATUSBAR
wxString strSelection; wxString strSelection;
unsigned int nItem = event.GetInt(); unsigned int nItem = event.GetInt();
strSelection.Printf(wxT("item %d was %schecked"), nItem, strSelection.Printf(wxT("item %d was %schecked"), nItem,
m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un")); m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
SetStatusText(strSelection); SetStatusText(strSelection);
#else
wxUnusedVar(event);
#endif // wxUSE_STATUSBAR
} }

View File

@@ -40,8 +40,10 @@ bool MyApp::OnInit(void)
// Create the main frame window // Create the main frame window
frame = new MyFrame((wxFrame *) NULL, _T("wxPNGBitmap Demo"), wxPoint(0, 0), wxSize(300, 300)); frame = new MyFrame((wxFrame *) NULL, _T("wxPNGBitmap Demo"), wxPoint(0, 0), wxSize(300, 300));
#if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
frame->CreateStatusBar(2); frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
@@ -68,7 +70,9 @@ bool MyApp::OnInit(void)
frame->Show(true); frame->Show(true);
#if wxUSE_STATUSBAR
frame->SetStatusText(_T("Hello, wxWidgets")); frame->SetStatusText(_T("Hello, wxWidgets"));
#endif // wxUSE_STATUSBAR
return true; return true;
} }

View File

@@ -82,8 +82,10 @@ bool MyApp::OnInit(void)
// Create the main frame window // Create the main frame window
frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets Printing Demo"), wxPoint(0, 0), wxSize(400, 400)); frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets Printing Demo"), wxPoint(0, 0), wxSize(400, 400));
#if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
frame->CreateStatusBar(2); frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Load icon and bitmap // Load icon and bitmap
frame->SetIcon( wxICON( mondrian) ); frame->SetIcon( wxICON( mondrian) );
@@ -135,7 +137,9 @@ bool MyApp::OnInit(void)
frame->Centre(wxBOTH); frame->Centre(wxBOTH);
frame->Show(); frame->Show();
#if wxUSE_STATUSBAR
frame->SetStatusText(_T("Printing demo")); frame->SetStatusText(_T("Printing demo"));
#endif // wxUSE_STATUSBAR
SetTopWindow(frame); SetTopWindow(frame);

View File

@@ -361,9 +361,11 @@ RegFrame::RegFrame(wxFrame *parent, wxChar *title, int x, int y, int w, int h)
m_treeCtrl = new RegTreeCtrl(this, Ctrl_RegTree); m_treeCtrl = new RegTreeCtrl(this, Ctrl_RegTree);
#endif #endif
#if wxUSE_STATUSBAR
// create the status line // create the status line
// ---------------------- // ----------------------
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
} }
RegFrame::~RegFrame() RegFrame::~RegFrame()
@@ -697,8 +699,12 @@ void RegTreeCtrl::OnChar(wxKeyEvent& event)
void RegTreeCtrl::OnSelChanged(wxTreeEvent& event) void RegTreeCtrl::OnSelChanged(wxTreeEvent& event)
{ {
#if wxUSE_STATUSBAR
wxFrame *pFrame = (wxFrame *) wxWindow::GetParent(); wxFrame *pFrame = (wxFrame *) wxWindow::GetParent();
pFrame->SetStatusText(GetNode(event)->FullName(), 1); pFrame->SetStatusText(GetNode(event)->FullName(), 1);
#else
wxUnusedVar(event);
#endif // wxUSE_STATUSBAR
} }
void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event) void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)

View File

@@ -70,7 +70,9 @@ bool MyApp::OnInit(void)
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
frame->Show(true); frame->Show(true);
@@ -228,8 +230,10 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
subframe->SetIcon(wxIcon(_T("sashtest_icn"))); subframe->SetIcon(wxIcon(_T("sashtest_icn")));
#endif #endif
#if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
subframe->CreateStatusBar(); subframe->CreateStatusBar();
#endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;

View File

@@ -453,9 +453,11 @@ MyFrame::MyFrame()
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );

View File

@@ -391,9 +391,11 @@ MyFrame::MyFrame()
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
int widths[] = { -1, 100 }; int widths[] = { -1, 100 };
SetStatusWidths( 2, widths ); SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR
m_scrolled = new MyScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize(100,100) ); m_scrolled = new MyScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize(100,100) );
m_scrolled->SetScrollbars( 10, 10, 50, 50 ); m_scrolled->SetScrollbars( 10, 10, 50, 50 );

View File

@@ -205,8 +205,10 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
m_menuBar->Append(m_menuProtocols, _("&Protocols")); m_menuBar->Append(m_menuProtocols, _("&Protocols"));
SetMenuBar(m_menuBar); SetMenuBar(m_menuBar);
#if wxUSE_STATUSBAR
// Status bar // Status bar
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Make a textctrl for logging // Make a textctrl for logging
m_text = new wxTextCtrl(this, wxID_ANY, m_text = new wxTextCtrl(this, wxID_ANY,
@@ -622,7 +624,9 @@ void MyFrame::UpdateStatusBar()
s.Printf(_("%s : %d"), (addr.Hostname()).c_str(), addr.Service()); s.Printf(_("%s : %d"), (addr.Hostname()).c_str(), addr.Service());
} }
#if wxUSE_STATUSBAR
SetStatusText(s, 1); SetStatusText(s, 1);
#endif // wxUSE_STATUSBAR
m_menuSocket->Enable(CLIENT_OPEN, !m_sock->IsConnected() && !m_busy); m_menuSocket->Enable(CLIENT_OPEN, !m_sock->IsConnected() && !m_busy);
m_menuSocket->Enable(CLIENT_TEST1, m_sock->IsConnected() && !m_busy); m_menuSocket->Enable(CLIENT_TEST1, m_sock->IsConnected() && !m_busy);

View File

@@ -163,8 +163,10 @@ MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY,
m_menuBar->Append(m_menuFile, _("&File")); m_menuBar->Append(m_menuFile, _("&File"));
SetMenuBar(m_menuBar); SetMenuBar(m_menuBar);
#if wxUSE_STATUSBAR
// Status bar // Status bar
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Make a textctrl for logging // Make a textctrl for logging
m_text = new wxTextCtrl(this, wxID_ANY, m_text = new wxTextCtrl(this, wxID_ANY,
@@ -412,7 +414,9 @@ void MyFrame::OnSocketEvent(wxSocketEvent& event)
void MyFrame::UpdateStatusBar() void MyFrame::UpdateStatusBar()
{ {
#if wxUSE_STATUSBAR
wxString s; wxString s;
s.Printf(_("%d clients connected"), m_numClients); s.Printf(_("%d clients connected"), m_numClients);
SetStatusText(s, 1); SetStatusText(s, 1);
#endif // wxUSE_STATUSBAR
} }

View File

@@ -176,7 +176,9 @@ MyFrame::MyFrame()
wxDefaultPosition, wxSize(420, 300), wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Make a menubar // Make a menubar
wxMenu *splitMenu = new wxMenu; wxMenu *splitMenu = new wxMenu;
@@ -235,7 +237,9 @@ MyFrame::MyFrame()
m_splitter->SplitVertically(m_left, m_right, 100); m_splitter->SplitVertically(m_left, m_right, 100);
#endif #endif
#if wxUSE_STATUSBAR
SetStatusText(_T("Min pane size = 0"), 1); SetStatusText(_T("Min pane size = 0"), 1);
#endif // wxUSE_STATUSBAR
} }
MyFrame::~MyFrame() MyFrame::~MyFrame()
@@ -257,7 +261,9 @@ void MyFrame::SplitHorizontal(wxCommandEvent& WXUNUSED(event) )
m_right->Show(true); m_right->Show(true);
m_splitter->SplitHorizontally( m_left, m_right ); m_splitter->SplitHorizontally( m_left, m_right );
#if wxUSE_STATUSBAR
SetStatusText(_T("Splitter split horizontally"), 1); SetStatusText(_T("Splitter split horizontally"), 1);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::SplitVertical(wxCommandEvent& WXUNUSED(event) ) void MyFrame::SplitVertical(wxCommandEvent& WXUNUSED(event) )
@@ -268,14 +274,18 @@ void MyFrame::SplitVertical(wxCommandEvent& WXUNUSED(event) )
m_right->Show(true); m_right->Show(true);
m_splitter->SplitVertically( m_left, m_right ); m_splitter->SplitVertically( m_left, m_right );
#if wxUSE_STATUSBAR
SetStatusText(_T("Splitter split vertically"), 1); SetStatusText(_T("Splitter split vertically"), 1);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::Unsplit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::Unsplit(wxCommandEvent& WXUNUSED(event) )
{ {
if ( m_splitter->IsSplit() ) if ( m_splitter->IsSplit() )
m_splitter->Unsplit(); m_splitter->Unsplit();
#if wxUSE_STATUSBAR
SetStatusText(_T("No splitter")); SetStatusText(_T("No splitter"));
#endif // wxUSE_STATUSBAR
} }
void MyFrame::ToggleLive(wxCommandEvent& event ) void MyFrame::ToggleLive(wxCommandEvent& event )
@@ -319,8 +329,10 @@ void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) )
int minsize = wxStrtol( str, (wxChar**)NULL, 10 ); int minsize = wxStrtol( str, (wxChar**)NULL, 10 );
m_splitter->SetMinimumPaneSize(minsize); m_splitter->SetMinimumPaneSize(minsize);
#if wxUSE_STATUSBAR
str.Printf( wxT("Min pane size = %d"), minsize); str.Printf( wxT("Min pane size = %d"), minsize);
SetStatusText(str, 1); SetStatusText(str, 1);
#endif // wxUSE_STATUSBAR
} }
// Update UI handlers // Update UI handlers
@@ -380,14 +392,18 @@ void MySplitterWindow::OnPositionChanging(wxSplitterEvent& event)
void MySplitterWindow::OnDClick(wxSplitterEvent& event) void MySplitterWindow::OnDClick(wxSplitterEvent& event)
{ {
#if wxUSE_STATUSBAR
m_frame->SetStatusText(_T("Splitter double clicked"), 1); m_frame->SetStatusText(_T("Splitter double clicked"), 1);
#endif // wxUSE_STATUSBAR
event.Skip(); event.Skip();
} }
void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event) void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
{ {
#if wxUSE_STATUSBAR
m_frame->SetStatusText(_T("Splitter unsplit"), 1); m_frame->SetStatusText(_T("Splitter unsplit"), 1);
#endif // wxUSE_STATUSBAR
event.Skip(); event.Skip();
} }

View File

@@ -1135,7 +1135,9 @@ END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h) MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) ) : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
{ {
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
m_panel = new MyPanel( this, 10, 10, 300, 100 ); m_panel = new MyPanel( this, 10, 10, 300, 100 );
} }
@@ -1280,7 +1282,9 @@ void MyFrame::OnIdle( wxIdleEvent& event )
#endif #endif
); );
#if wxUSE_STATUSBAR
SetStatusText(msg); SetStatusText(msg);
#endif // wxUSE_STATUSBAR
} }
event.Skip(); event.Skip();
} }
@@ -1357,7 +1361,9 @@ RichTextFrame::RichTextFrame(wxWindow* parent, const wxString& title):
menuBar->Append(editMenu, _("Edit")); menuBar->Append(editMenu, _("Edit"));
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR
} }
// Event handlers // Event handlers
@@ -1548,6 +1554,7 @@ void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
long insertionPoint = m_textCtrl->GetInsertionPoint(); long insertionPoint = m_textCtrl->GetInsertionPoint();
if (insertionPoint != m_currentPosition) if (insertionPoint != m_currentPosition)
{ {
#if wxUSE_STATUSBAR
wxTextAttr attr; wxTextAttr attr;
if (m_textCtrl->GetStyle(insertionPoint, attr)) if (m_textCtrl->GetStyle(insertionPoint, attr))
{ {
@@ -1572,6 +1579,7 @@ void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
(const wxChar*) alignment); (const wxChar*) alignment);
SetStatusText(msg); SetStatusText(msg);
} }
#endif // wxUSE_STATUSBAR
m_currentPosition = insertionPoint; m_currentPosition = insertionPoint;
} }
} }

View File

@@ -423,7 +423,9 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title,
m_dlgProgress = (wxProgressDialog *)NULL; m_dlgProgress = (wxProgressDialog *)NULL;
#if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
m_txtctrl = new wxTextCtrl(this, wxID_ANY, _T(""), wxPoint(0, 0), wxSize(0, 0), m_txtctrl = new wxTextCtrl(this, wxID_ANY, _T(""), wxPoint(0, 0), wxSize(0, 0),
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
@@ -525,9 +527,11 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
threads.Add(thr); threads.Add(thr);
} }
#if wxUSE_STATUSBAR
wxString msg; wxString msg;
msg.Printf(wxT("%d new threads created."), count); msg.Printf(wxT("%d new threads created."), count);
SetStatusText(msg, 1); SetStatusText(msg, 1);
#endif // wxUSE_STATUSBAR
// ...and then start them // ...and then start them
for ( n = 0; n < count; n++ ) for ( n = 0; n < count; n++ )
@@ -545,7 +549,9 @@ void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) )
wxLogError(wxT("Can't start thread!")); wxLogError(wxT("Can't start thread!"));
} }
#if wxUSE_STATUSBAR
SetStatusText(_T("New thread started."), 1); SetStatusText(_T("New thread started."), 1);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
@@ -570,7 +576,9 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
thread->Delete(); thread->Delete();
#if wxUSE_STATUSBAR
SetStatusText(_T("Thread stopped."), 1); SetStatusText(_T("Thread stopped."), 1);
#endif // wxUSE_STATUSBAR
} }
} }
@@ -591,7 +599,9 @@ void MyFrame::OnResumeThread(wxCommandEvent& WXUNUSED(event) )
{ {
wxGetApp().m_threads[n]->Resume(); wxGetApp().m_threads[n]->Resume();
#if wxUSE_STATUSBAR
SetStatusText(_T("Thread resumed."), 1); SetStatusText(_T("Thread resumed."), 1);
#endif // wxUSE_STATUSBAR
} }
} }
@@ -612,7 +622,9 @@ void MyFrame::OnPauseThread(wxCommandEvent& WXUNUSED(event) )
{ {
wxGetApp().m_threads[n]->Pause(); wxGetApp().m_threads[n]->Pause();
#if wxUSE_STATUSBAR
SetStatusText(_T("Thread paused."), 1); SetStatusText(_T("Thread paused."), 1);
#endif // wxUSE_STATUSBAR
} }
} }

View File

@@ -265,7 +265,7 @@ bool MyApp::OnInit()
frame->Show(true); frame->Show(true);
#ifndef __SMARTPHONE__ #if wxUSE_STATUSBAR
frame->SetStatusText(_T("Hello, wxWidgets")); frame->SetStatusText(_T("Hello, wxWidgets"));
#endif #endif
@@ -389,7 +389,7 @@ MyFrame::MyFrame(wxFrame* parent,
m_rows = 1; m_rows = 1;
m_nPrint = 1; m_nPrint = 1;
#ifndef __SMARTPHONE__ #if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
CreateStatusBar(); CreateStatusBar();
#endif #endif
@@ -711,7 +711,7 @@ void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnToolEnter(wxCommandEvent& event) void MyFrame::OnToolEnter(wxCommandEvent& event)
{ {
#ifndef __SMARTPHONE__ #if wxUSE_STATUSBAR
if (event.GetSelection() > -1) if (event.GetSelection() > -1)
{ {
wxString str; wxString str;
@@ -720,7 +720,9 @@ void MyFrame::OnToolEnter(wxCommandEvent& event)
} }
else else
SetStatusText(_T("")); SetStatusText(_T(""));
#endif #else
wxUnusedVar(event);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnToggleRadioBtn(wxCommandEvent& event) void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)

View File

@@ -120,7 +120,9 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int
wxValidator::SetBellOnError(m_silent); wxValidator::SetBellOnError(m_silent);
file_menu->Check(VALIDATE_TOGGLE_BELL, !wxValidator::IsSilent()); file_menu->Check(VALIDATE_TOGGLE_BELL, !wxValidator::IsSilent());
#if wxUSE_STATUSBAR
CreateStatusBar(1); CreateStatusBar(1);
#endif // wxUSE_STATUSBAR
} }
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))

View File

@@ -100,6 +100,7 @@ public:
void OnIdle(wxIdleEvent&) void OnIdle(wxIdleEvent&)
{ {
#if wxUSE_STATUSBAR
m_frame->SetStatusText(wxString::Format m_frame->SetStatusText(wxString::Format
( (
_T("Page size = %d, pos = %d, max = %d"), _T("Page size = %d, pos = %d, max = %d"),
@@ -107,6 +108,7 @@ public:
GetScrollPos(wxVERTICAL), GetScrollPos(wxVERTICAL),
GetScrollRange(wxVERTICAL) GetScrollRange(wxVERTICAL)
)); ));
#endif // wxUSE_STATUSBAR
m_changed = false; m_changed = false;
} }