void UpdateClock();
// event handlers
- void OnTimer(wxTimerEvent& event) { UpdateClock(); }
+ void OnTimer(wxTimerEvent& WXUNUSED(event)) { UpdateClock(); }
void OnSize(wxSizeEvent& event);
void OnToggleClock(wxCommandEvent& event);
void OnButton(wxCommandEvent& event);
// toggle the state of the status bar controls
void DoToggle();
- wxBitmap CreateBitmapForButton(bool on = FALSE);
+ wxBitmap CreateBitmapForButton(bool on = false);
enum
{
wxStatusBar *m_statbarDefault;
MyStatusBar *m_statbarCustom;
- // any class wishing to process wxWindows events must use this macro
+ // any class wishing to process wxWidgets events must use this macro
DECLARE_EVENT_TABLE()
};
static const int BITMAP_SIZE_Y = 15;
// ----------------------------------------------------------------------------
-// event tables and other macros for wxWindows
+// event tables and other macros for wxWidgets
// ----------------------------------------------------------------------------
-// the event tables connect the wxWindows events with the functions (event
+// the event tables connect the wxWidgets events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
#ifdef USE_MDI_PARENT_FRAME
BEGIN_EVENT_TABLE(MyStatusBar, wxStatusBar)
EVT_SIZE(MyStatusBar::OnSize)
EVT_CHECKBOX(StatusBar_Checkbox, MyStatusBar::OnToggleClock)
- EVT_BUTTON(-1, MyStatusBar::OnButton)
- EVT_TIMER(-1, MyStatusBar::OnTimer)
+ EVT_BUTTON(wxID_ANY, MyStatusBar::OnButton)
+ EVT_TIMER(wxID_ANY, MyStatusBar::OnTimer)
END_EVENT_TABLE()
-// Create a new application object: this macro will allow wxWindows to create
+// Create a new application object: this macro will allow wxWidgets to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
- frame->Show(TRUE);
+ frame->Show(true);
// success: wxApp::OnRun() will be called which will enter the main message
- // loop and the application will run. If we returned FALSE here, the
+ // loop and the application will run. If we returned 'false' here, the
// application would exit immediately.
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#ifdef USE_MDI_PARENT_FRAME
- : wxMDIParentFrame((wxWindow *)NULL, -1, title, pos, size)
+ : wxMDIParentFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
#else
- : wxFrame((wxWindow *)NULL, -1, title, pos, size)
+ : wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
#endif
{
m_statbarDefault = NULL;
// create default status bar to start with
CreateStatusBar(2);
m_statbarKind = StatBar_Default;
- SetStatusText(_T("Welcome to wxWindows!"));
+ SetStatusText(_T("Welcome to wxWidgets!"));
m_statbarDefault = GetStatusBar();
}
(
_T("Select the number of fields in the status bar"),
_T("Fields:"),
- _T("wxWindows statusbar sample"),
+ _T("wxWidgets statusbar sample"),
sb->GetFieldsCount(),
1, 5,
this
DoCreateStatusBar(m_statbarKind);
}
#ifdef __WXMSW__
- // The following is a kludge suggested by Vadim Zeitlin (one of the wxWindows
+ // The following is a kludge suggested by Vadim Zeitlin (one of the wxWidgets
// authors) while we look for a proper fix..
// SendSizeEvent();
#endif
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- // TRUE is to force the frame to close
- Close(TRUE);
+ // true is to force the frame to close
+ Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
// ----------------------------------------------------------------------------
MyAboutDialog::MyAboutDialog(wxWindow *parent)
- : wxDialog(parent, -1, wxString(_T("About statbar")),
+ : wxDialog(parent, wxID_ANY, wxString(_T("About statbar")),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
- wxStaticText *text = new wxStaticText(this, -1,
+ wxStaticText *text = new wxStaticText(this, wxID_ANY,
_T("wxStatusBar sample\n")
_T("(c) 2000 Vadim Zeitlin"));
// create the top status bar without the size grip (default style),
// otherwise it looks weird
- wxStatusBar *statbarTop = new wxStatusBar(this, -1, 0);
+ wxStatusBar *statbarTop = new wxStatusBar(this, wxID_ANY, 0);
statbarTop->SetFieldsCount(3);
statbarTop->SetStatusText(_T("This is a top status bar"), 0);
statbarTop->SetStatusText(_T("in a dialog"), 1);
statbarTop->SetStatusText(_T("Great, isn't it?"), 2);
- wxStatusBar *statbarBottom = new wxStatusBar(this, -1);
+ wxStatusBar *statbarBottom = new wxStatusBar(this, wxID_ANY);
statbarBottom->SetFieldsCount(2);
statbarBottom->SetStatusText(_T("This is a bottom status bar"), 0);
statbarBottom->SetStatusText(_T("in a dialog"), 1);
sizerTop->Add(-1, 10, 1, wxGROW);
sizerTop->Add(statbarBottom, 0, wxGROW);
- SetAutoLayout(TRUE);
SetSizer(sizerTop);
sizerTop->Fit(this);
#endif
MyStatusBar::MyStatusBar(wxWindow *parent)
- : wxStatusBar(parent, -1), m_timer(this), m_checkbox(NULL)
+ : wxStatusBar(parent, wxID_ANY), m_timer(this), m_checkbox(NULL)
{
static const int widths[Field_Max] = { -1, 150, BITMAP_SIZE_X, 100 };
SetStatusWidths(Field_Max, widths);
m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, _T("&Toggle clock"));
- m_checkbox->SetValue(TRUE);
+ m_checkbox->SetValue(true);
#ifdef USE_STATIC_BITMAP
- m_statbmp = new wxStaticBitmap(this, -1, wxIcon(green_xpm));
+ m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxIcon(green_xpm));
#else
- m_statbmp = new wxBitmapButton(this, -1, CreateBitmapForButton(),
+ m_statbmp = new wxBitmapButton(this, wxID_ANY, CreateBitmapForButton(),
wxDefaultPosition, wxDefaultSize,
wxBU_EXACTFIT);
#endif
#ifdef USE_STATIC_BITMAP
m_statbmp->SetIcon(wxIcon(green_xpm));
#else
- m_statbmp->SetBitmapLabel(CreateBitmapForButton(FALSE));
+ m_statbmp->SetBitmapLabel(CreateBitmapForButton(false));
m_statbmp->Refresh();
#endif
#ifdef USE_STATIC_BITMAP
m_statbmp->SetIcon(wxIcon(red_xpm));
#else
- m_statbmp->SetBitmapLabel(CreateBitmapForButton(TRUE));
+ m_statbmp->SetBitmapLabel(CreateBitmapForButton(true));
m_statbmp->Refresh();
#endif
- SetStatusText(_T(""), Field_Clock);
+ SetStatusText(wxEmptyString, Field_Clock);
}
}