From: Włodzimierz Skiba Date: Tue, 8 Jun 2004 19:27:42 +0000 (+0000) Subject: -1->wxID_ANY, TRUE->true, FALSE->false and tabs replacements. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a2d49353d4ac77775d5c513e55940175458faa1c?ds=sidebyside;hp=fda5e7a16ef41d1c4672e9e8d4451f680aee44f6 -1->wxID_ANY, TRUE->true, FALSE->false and tabs replacements. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/include/wx/gizmos/editlbox.h b/contrib/include/wx/gizmos/editlbox.h index 5674b08cb4..cbe61488bc 100644 --- a/contrib/include/wx/gizmos/editlbox.h +++ b/contrib/include/wx/gizmos/editlbox.h @@ -12,7 +12,7 @@ #define __WX_EDITLBOX_H__ #if defined(__GNUG__) && !defined(__APPLE__) - #pragma interface "editlbox.h" + #pragma interface "editlbox.h" #endif #include "wx/panel.h" @@ -31,7 +31,7 @@ class WXDLLEXPORT wxListEvent; class WXDLLIMPEXP_GIZMOS wxEditableListBox : public wxPanel { - DECLARE_CLASS(wxEditableListBox); + DECLARE_CLASS(wxEditableListBox); public: wxEditableListBox(wxWindow *parent, wxWindowID id, diff --git a/contrib/include/wx/gizmos/ledctrl.h b/contrib/include/wx/gizmos/ledctrl.h index a46cf53c10..4e5158fe3e 100644 --- a/contrib/include/wx/gizmos/ledctrl.h +++ b/contrib/include/wx/gizmos/ledctrl.h @@ -33,18 +33,18 @@ enum wxLEDValueAlign // wxLEDNumberCtrl // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_GIZMOS wxLEDNumberCtrl : public wxControl +class WXDLLIMPEXP_GIZMOS wxLEDNumberCtrl : public wxControl { public: // Constructors. wxLEDNumberCtrl(); - wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1, + wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED); // Create functions. - bool Create(wxWindow *parent, wxWindowID id = -1, + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); @@ -53,9 +53,9 @@ public: bool GetDrawFaded() const { return m_DrawFaded; } const wxString &GetValue() const { return m_Value; } - void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = TRUE); - void SetDrawFaded(bool DrawFaded, bool Redraw = TRUE); - void SetValue(const wxString &Value, bool Redraw = TRUE); + void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true); + void SetDrawFaded(bool DrawFaded, bool Redraw = true); + void SetValue(const wxString &Value, bool Redraw = true); private: // Members. diff --git a/contrib/include/wx/gizmos/multicell.h b/contrib/include/wx/gizmos/multicell.h index a22b9871ca..9fc9b5b691 100644 --- a/contrib/include/wx/gizmos/multicell.h +++ b/contrib/include/wx/gizmos/multicell.h @@ -16,7 +16,7 @@ #define __WX_MULTICELL_H__ #if defined(__GNUG__) && !defined(__APPLE__) - #pragma interface "multicell.h" + #pragma interface "multicell.h" #endif #include "wx/gizmos/gizmos.h" @@ -33,10 +33,10 @@ // ---------------------------------------------------------------------------- enum wxResizable { - wxNOT_RESIZABLE = 0x00, - wxHORIZONTAL_RESIZABLE = 0x01, - wxVERTICAL_RESIZABLE = 0x10, - wxRESIZABLE = 0x11 + wxNOT_RESIZABLE = 0x00, + wxHORIZONTAL_RESIZABLE = 0x01, + wxVERTICAL_RESIZABLE = 0x10, + wxRESIZABLE = 0x11 }; //--------------------------------------------------------------------------- @@ -49,33 +49,33 @@ enum wxResizable class WXDLLIMPEXP_GIZMOS wxMultiCellItemHandle: public wxObject { - DECLARE_CLASS(wxMultiCellItemHandle); + DECLARE_CLASS(wxMultiCellItemHandle); protected: - int m_column; - int m_row; - int m_width; - int m_height; - wxResizable m_style; - wxSize m_fixedSize; - int m_alignment; - wxSize m_weight; + int m_column; + int m_row; + int m_width; + int m_height; + wxResizable m_style; + wxSize m_fixedSize; + int m_alignment; + wxSize m_weight; public: - wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); - wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); - wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); - wxMultiCellItemHandle( int row, int column, int align); - int GetColumn(); - int GetRow(); - int GetWidth(); - int GetHeight(); - wxResizable GetStyle(); - wxSize GetLocalSize(); - int GetAlignment(); - wxSize GetWeight(); + wxMultiCellItemHandle( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); + wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); + wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); + wxMultiCellItemHandle( int row, int column, int align); + int GetColumn(); + int GetRow(); + int GetWidth(); + int GetHeight(); + wxResizable GetStyle(); + wxSize GetLocalSize(); + int GetAlignment(); + wxSize GetWeight(); private: - void Initialize( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); + void Initialize( int row, int column, int height = 1, int width = 1, wxSize size = wxDefaultSize, wxResizable style = wxNOT_RESIZABLE, wxSize weight = wxSize(1,1), int align = wxALIGN_NOT); }; @@ -85,43 +85,43 @@ private: class WXDLLIMPEXP_GIZMOS wxMultiCellSizer : virtual public wxSizer { - DECLARE_CLASS(wxMultiCellSizer); + DECLARE_CLASS(wxMultiCellSizer); protected: - wxSize m_cell_count; + wxSize m_cell_count; public: - wxMultiCellSizer(wxSize & size); - wxMultiCellSizer(int rows, int cols); - ~wxMultiCellSizer(); - - virtual void RecalcSizes(); - virtual wxSize CalcMin(); - bool SetDefaultCellSize(wxSize size); - bool SetColumnWidth(int column, int colSize = 5, bool expandable = FALSE); - bool SetRowHeight(int row, int rowSize = 5, bool expandable = FALSE); - bool EnableGridLines(wxWindow *win); - bool SetGridPen(wxPen *pen); - void OnPaint(wxDC& dc); + wxMultiCellSizer(wxSize & size); + wxMultiCellSizer(int rows, int cols); + ~wxMultiCellSizer(); + + virtual void RecalcSizes(); + virtual wxSize CalcMin(); + bool SetDefaultCellSize(wxSize size); + bool SetColumnWidth(int column, int colSize = 5, bool expandable = false); + bool SetRowHeight(int row, int rowSize = 5, bool expandable = false); + bool EnableGridLines(wxWindow *win); + bool SetGridPen(wxPen *pen); + void OnPaint(wxDC& dc); private: - void GetMinimums(); - int Sum(int *array, int x); + void GetMinimums(); + int Sum(int *array, int x); private: - int *m_maxHeight; - int *m_maxWidth; - int *m_rowStretch; - int *m_colStretch; - wxSize **m_weights; - wxSize **m_minSizes; - int m_maxWeights; - wxSize m_defaultCellSize; - wxWindow *m_win; // usually used for debugging - wxPen *m_pen; - - void DrawGridLines(wxDC& dc); - void Initialize(wxSize size); + int *m_maxHeight; + int *m_maxWidth; + int *m_rowStretch; + int *m_colStretch; + wxSize **m_weights; + wxSize **m_minSizes; + int m_maxWeights; + wxSize m_defaultCellSize; + wxWindow *m_win; // usually used for debugging + wxPen *m_pen; + + void DrawGridLines(wxDC& dc); + void Initialize(wxSize size); }; @@ -136,23 +136,23 @@ class wxCell; class WXDLLIMPEXP_GIZMOS wxMultiCellCanvas : public wxFlexGridSizer { public: - wxMultiCellCanvas(wxWindow *parent, int numRows = 2, int numCols = 2); - void Add(wxWindow *win, unsigned int row, unsigned int col); - - void Resize(int numRows, int numCols); - int MaxRows() - { - return m_maxRows; - }; - int MaxCols() - { - return m_maxCols; - }; - void CalculateConstraints(); - void SetMinCellSize(const wxSize size) - { - m_minCellSize = size; - }; + wxMultiCellCanvas(wxWindow *parent, int numRows = 2, int numCols = 2); + void Add(wxWindow *win, unsigned int row, unsigned int col); + + void Resize(int numRows, int numCols); + int MaxRows() + { + return m_maxRows; + }; + int MaxCols() + { + return m_maxCols; + }; + void CalculateConstraints(); + void SetMinCellSize(const wxSize size) + { + m_minCellSize = size; + }; /* These are to hide Add() method of parents and to avoid Borland warning about hiding virtual functions */ void Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ) @@ -165,11 +165,11 @@ public: { wxFlexGridSizer::Add( item); } private: - wxWindow *m_parent; - unsigned int m_maxRows, m_maxCols; + wxWindow *m_parent; + unsigned int m_maxRows, m_maxCols; - wxSize m_minCellSize; - wxCell **m_cells; + wxSize m_minCellSize; + wxCell **m_cells; }; #endif diff --git a/contrib/include/wx/gizmos/splittree.h b/contrib/include/wx/gizmos/splittree.h index 98bbea58d4..fdf99a44b7 100644 --- a/contrib/include/wx/gizmos/splittree.h +++ b/contrib/include/wx/gizmos/splittree.h @@ -72,7 +72,7 @@ public: virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos = 0, int yPos = 0, - bool noRefresh = FALSE ); + bool noRefresh = false ); // In case we're using the generic tree control. // Get the view start @@ -127,7 +127,7 @@ class WXDLLIMPEXP_GIZMOS wxTreeCompanionWindow: public wxWindow public: DECLARE_CLASS(wxTreeCompanionWindow) - wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1, + wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); @@ -166,7 +166,7 @@ class WXDLLIMPEXP_GIZMOS wxThinSplitterWindow: public wxSplitterWindow public: DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow) - wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1, + wxThinSplitterWindow(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = wxSP_3D | wxCLIP_CHILDREN); @@ -210,7 +210,7 @@ class WXDLLIMPEXP_GIZMOS wxSplitterScrolledWindow: public wxScrolledWindow public: DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow) - wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1, + wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); diff --git a/contrib/samples/gizmos/dynsash/dynsash.cpp b/contrib/samples/gizmos/dynsash/dynsash.cpp index ccc2b4b021..1623553548 100644 --- a/contrib/samples/gizmos/dynsash/dynsash.cpp +++ b/contrib/samples/gizmos/dynsash/dynsash.cpp @@ -37,7 +37,7 @@ public: class SashHtmlWindow : public wxHtmlWindow { public: - SashHtmlWindow(wxWindow *parent, wxWindowID id = -1, + SashHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHW_SCROLLBAR_NEVER, const wxString& name = wxT("sashHtmlWindow")); @@ -62,23 +62,23 @@ wxT("manages the scrollbars provided by wxDynamicSashWindow itself."); bool Demo::OnInit() { wxInitAllImageHandlers(); - wxFrame *frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Demo")); + wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Demo")); frame->SetSize(480, 480); - wxDynamicSashWindow *sash = new wxDynamicSashWindow(frame, -1); - wxHtmlWindow *html = new SashHtmlWindow(sash, -1); + wxDynamicSashWindow *sash = new wxDynamicSashWindow(frame, wxID_ANY); + wxHtmlWindow *html = new SashHtmlWindow(sash, wxID_ANY); html->SetPage(HTML_content); frame->Show(); - return TRUE; + return true; } SashHtmlWindow::SashHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxHtmlWindow(parent, id, pos, size, style, name) { - Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) (wxEventFunction) (wxDynamicSashSplitEventFunction)&SashHtmlWindow::OnSplit); @@ -97,6 +97,6 @@ wxSize SashHtmlWindow::DoGetBestSize() const { } void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) { - wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, -1); + wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, wxID_ANY); html->SetPage(HTML_content); } diff --git a/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp b/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp index 0910f46caf..045d6d33b9 100644 --- a/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp +++ b/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp @@ -65,14 +65,14 @@ IMPLEMENT_APP(SwitchDemo) SwitchView::SwitchView(wxDynamicSashWindow *win) { - Create(win, -1); + Create(win, wxID_ANY); m_dyn_sash = win; - m_bar = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar")); - m_choice = new wxChoice(m_bar, -1); + m_bar = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER, wxT("bar")); + m_choice = new wxChoice(m_bar, wxID_ANY); m_choice->SetEventHandler(this); - m_view = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, 0, wxT("view")); + m_view = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("view")); m_view->SetBackgroundColour(*wxWHITE); m_view->SetEventHandler(this); @@ -119,41 +119,41 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) { (wxEventFunction) (wxPaintEventFunction)&SwitchView::OnPaint); - Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction)&SwitchView::OnFocus); - Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_TOP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction)&SwitchView::OnErase); - Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) (wxEventFunction) (wxDynamicSashSplitEventFunction)&SwitchView::OnSplit); - Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction) (wxEventFunction) (wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify); } @@ -252,12 +252,12 @@ bool SwitchDemo::OnInit() { wxFrame *frame; wxDynamicSashWindow *dyn; - frame = new wxFrame(NULL, -1, wxT("Dynamic Sash Window Switch Demo")); - dyn = new wxDynamicSashWindow(frame, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); + frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Window Switch Demo")); + dyn = new wxDynamicSashWindow(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); new SwitchView(dyn); frame->SetSize(480, 480); frame->Show(); - return TRUE; + return true; } diff --git a/contrib/samples/gizmos/editlbox/test.cpp b/contrib/samples/gizmos/editlbox/test.cpp index 10fb0f3839..f3a612df32 100644 --- a/contrib/samples/gizmos/editlbox/test.cpp +++ b/contrib/samples/gizmos/editlbox/test.cpp @@ -25,17 +25,17 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { - wxDialog dlg(NULL, -1, _("Test dialog"), wxDefaultPosition, wxDefaultSize, + wxDialog dlg(NULL, wxID_ANY, _("Test dialog"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxSizer *sizer = new wxBoxSizer(wxVERTICAL); - sizer->Add(new wxEditableListBox(&dlg, -1, _("Match these wildcards:"), + sizer->Add(new wxEditableListBox(&dlg, wxID_ANY, _("Match these wildcards:"), wxDefaultPosition,wxSize(300,200)), 1, wxEXPAND|wxALL, 10); sizer->Add(5,5); - wxEditableListBox *lb = new wxEditableListBox(&dlg, -1, _("Except:"), + wxEditableListBox *lb = new wxEditableListBox(&dlg, wxID_ANY, _("Except:"), wxDefaultPosition,wxSize(300,200)); wxArrayString ar; ar.Add(_T("*.cpp")); @@ -48,10 +48,10 @@ bool MyApp::OnInit() sizer->Add(5,5); sizer->Add(new wxButton(&dlg, wxID_OK, _("OK")), 0, wxALIGN_RIGHT | wxALL, 10); - dlg.SetAutoLayout(TRUE); + dlg.SetAutoLayout(true); dlg.SetSizer(sizer); sizer->Fit(&dlg); - dlg.Centre(); + dlg.Centre(); dlg.ShowModal(); @@ -61,5 +61,5 @@ bool MyApp::OnInit() res << ar[i] << _T("\n"); wxMessageBox(res); - return FALSE; + return false; } diff --git a/contrib/samples/gizmos/led/led.cpp b/contrib/samples/gizmos/led/led.cpp index 6aab5cce46..8195289fdc 100644 --- a/contrib/samples/gizmos/led/led.cpp +++ b/contrib/samples/gizmos/led/led.cpp @@ -165,12 +165,12 @@ bool MyApp::OnInit() // 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; } // ---------------------------------------------------------------------------- @@ -179,7 +179,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, -1, title, pos, size, style) + : wxFrame(NULL, wxID_ANY, title, pos, size, style) { #if wxUSE_MENUS // create a menu bar @@ -202,7 +202,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, editMenu->AppendSeparator(); editMenu->AppendCheckItem(LED_Edit_DrawFaded, _T("Draw &Faded\tCtrl-F")); - editMenu->Check(LED_Edit_DrawFaded, TRUE); + editMenu->Check(LED_Edit_DrawFaded, true); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); @@ -222,8 +222,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, 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::OnIncrement(wxCommandEvent& WXUNUSED(event)) diff --git a/contrib/samples/gizmos/multicell/mtest.cpp b/contrib/samples/gizmos/multicell/mtest.cpp index a35ae93898..b3da3f73ee 100644 --- a/contrib/samples/gizmos/multicell/mtest.cpp +++ b/contrib/samples/gizmos/multicell/mtest.cpp @@ -1,194 +1,194 @@ /* - * File: mtest.cpp - * Purpose: wxMultiCellSizer and wxMultiCellCanvas test - * Author: Alex Andruschak - * Created: 2000 - * Updated: + * File: mtest.cpp + * Purpose: wxMultiCellSizer and wxMultiCellCanvas test + * Author: Alex Andruschak + * Created: 2000 + * Updated: * Copyright: */ static const char sccsid[] = "%W% %G%"; #if defined(__GNUG__) && !defined(__APPLE__) - #pragma implementation - #pragma interface + #pragma implementation + #pragma interface #endif #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP - #include "wx/wx.h" + #include "wx/wx.h" #endif #include "wx/gizmos/multicell.h" class MyApp: public wxApp {public: - bool OnInit(void); + bool OnInit(void); }; class MyFrame: public wxFrame { public: - MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); + MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); - void OnCloseWindow(wxCloseEvent& event); - void OnPaint(wxPaintEvent& event); - wxMultiCellSizer *sizer; + void OnCloseWindow(wxCloseEvent& event); + void OnPaint(wxPaintEvent& event); + wxMultiCellSizer *sizer; - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; IMPLEMENT_APP(MyApp) bool MyApp::OnInit(void) { - MyFrame *frame = new MyFrame(1, (wxFrame *) NULL, wxT("wxMultiCellSizer Sample"), wxPoint(50, 50), wxDefaultSize); //, wxSize(600, 500)); + MyFrame *frame = new MyFrame(1, (wxFrame *) NULL, wxT("wxMultiCellSizer Sample"), wxPoint(50, 50), wxDefaultSize); //, wxSize(600, 500)); - frame->Show(TRUE); + frame->Show(true); - SetTopWindow(frame); - frame = new MyFrame(2, (wxFrame *) NULL, wxT("wxMultiCellCanvas Sample"), wxPoint(100, 100), wxSize(600, 500)); + SetTopWindow(frame); + frame = new MyFrame(2, (wxFrame *) NULL, wxT("wxMultiCellCanvas Sample"), wxPoint(100, 100), wxSize(600, 500)); - frame->Show(TRUE); + frame->Show(true); - SetTopWindow(frame); - return TRUE; + SetTopWindow(frame); + return true; } MyFrame::MyFrame(int type, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size): -wxFrame(frame, -1, title, pos, size, wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL) +wxFrame(frame, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL) { - CreateStatusBar(1); - sizer = NULL; - if (type == 1) - { - // create sizer 4 columns 5 rows - wxSize aa(4,9); - sizer = new wxMultiCellSizer(aa); - sizer->SetDefaultCellSize(wxSize(15,15)); - sizer->SetRowHeight(7,5,TRUE); - sizer->SetRowHeight(8,5,FALSE); - // add first row - sizer->Add( - new wxButton( this, -1,wxT( "B1 - 0,0, horizontal resizable")), - 0, 0, 0, new wxMultiCellItemHandle(0,0,1,1, wxDefaultSize, wxHORIZONTAL_RESIZABLE, wxSize(2,2))); - sizer->Add( - new wxButton( this, -1, wxT("B2 - 0,1, vertical resizable")), - 0, 0, 0, new wxMultiCellItemHandle(0,1,1,1, wxDefaultSize, wxVERTICAL_RESIZABLE, wxSize(2, 2))); - sizer->Add( - new wxButton( this, -1, wxT("B3 - 0,2")), - 0, 0, 0, new wxMultiCellItemHandle(0,2,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_CENTER_HORIZONTAL)); //, wxALIGN_CENTER)); - sizer->Add( - new wxStaticText(this, -1, wxT("jbb 0,3, lower-right")), - 0, 0, 0, new wxMultiCellItemHandle(0,3,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_BOTTOM | wxALIGN_RIGHT)); - - // add button for secord row - sizer->Add( - new wxTextCtrl(this, -1, wxT("Text control - 1,0, 4 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(1,0,1,4)); - - // add buttons for next row - sizer->Add( - new wxButton( this, -1, wxT("B6 - 2,0, 2 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(2,0,1,2)); - sizer->Add( - new wxButton( this, -1, wxT("B7 - 2,3")), - 0, 0, 0, new wxMultiCellItemHandle(2,3,1,1)); - - // and last additions - sizer->Add( - new wxButton( this, -1, wxT("B8 - 3,0, 4 rows high, vert resizable")), - 0, 0, 0, new wxMultiCellItemHandle(3,0,4,1,wxDefaultSize, wxVERTICAL_RESIZABLE)); - sizer->Add( - new wxButton( this, -1, wxT("B9 - 3,2, 2 cols wide, vert resizable")), - 0, 0, 0, new wxMultiCellItemHandle(3,2,1,2,wxDefaultSize, wxVERTICAL_RESIZABLE)); - sizer->Add( - new wxButton( this, -1, wxT("B10 - 4,1, 3 cols wide, vert resizable")), - 0, 0, 0, new wxMultiCellItemHandle(4,1,1,3,wxDefaultSize, wxVERTICAL_RESIZABLE)); - - sizer->Add( - new wxButton( this, -1, wxT("B11 - 5,1, 3 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(5,1,1,3)); - - sizer->Add( - new wxButton( this, -1, wxT("B12 - 6,1, 3 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(6,1,1,3)); - - sizer->Add( - new wxButton( this, -1, wxT("B13 - 7,1, 2 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(7,1,1,2)); - - sizer->Add( - new wxButton( this, -1, wxT("B14 - 8,1, 3 cols wide")), - 0, 0, 0, new wxMultiCellItemHandle(8,1,1,3)); - - SetAutoLayout( TRUE ); -// sizer->SetMinSize(sizer->CalcMin()); - SetSizer( sizer ); - wxSize s = sizer->CalcMin(); - wxSize c = GetSize() - GetClientSize(); - SetSizeHints(s.GetWidth() + c.GetWidth() , s.GetHeight() + c.GetHeight()); - sizer->EnableGridLines(this); - } - else - { - // create sizer 4 columns 5 rows - wxMultiCellCanvas *sizer = new wxMultiCellCanvas(this, 5,5); - - // add first row - sizer->Add( - new wxButton( this, -1, wxT("Button 1")), - 0, 0); - sizer->Add( - new wxButton( this, -1, wxT("Button 2")), - 0, 1); - sizer->Add( - new wxButton( this, -1, wxT("Button 3")), - 0, 2); - sizer->Add( - new wxStaticText(this, -1, wxT("jbb test")), - 0, 3); - - sizer->Add( - new wxStaticText(this, -1, wxT("jbb test 2")), - 0, 4); - - // add button for secord row - sizer->Add( - new wxTextCtrl(this, -1, wxT("Text control")), - 1, 0); - - // add buttons for next row - sizer->Add( - new wxButton( this, -1, wxT("Button 6")), - 2, 0); - sizer->Add( - new wxButton( this, -1, wxT("Button 7")), - 2, 3); - - // and last additions - sizer->Add( - new wxButton( this, -1, wxT("Button 8")), - 3, 0); - sizer->Add( - new wxButton( this, -1, wxT("Button 9")), - 3, 1); - sizer->Add( - new wxButton( this, -1, wxT("Button 10")), - 4, 1); - - sizer->CalculateConstraints(); - SetSizer( sizer ); - SetAutoLayout( TRUE ); - } + CreateStatusBar(1); + sizer = NULL; + if (type == 1) + { + // create sizer 4 columns 5 rows + wxSize aa(4,9); + sizer = new wxMultiCellSizer(aa); + sizer->SetDefaultCellSize(wxSize(15,15)); + sizer->SetRowHeight(7,5,true); + sizer->SetRowHeight(8,5,false); + // add first row + sizer->Add( + new wxButton( this, wxID_ANY, wxT( "B1 - 0,0, horizontal resizable")), + 0, 0, 0, new wxMultiCellItemHandle(0,0,1,1, wxDefaultSize, wxHORIZONTAL_RESIZABLE, wxSize(2,2))); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B2 - 0,1, vertical resizable")), + 0, 0, 0, new wxMultiCellItemHandle(0,1,1,1, wxDefaultSize, wxVERTICAL_RESIZABLE, wxSize(2, 2))); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B3 - 0,2")), + 0, 0, 0, new wxMultiCellItemHandle(0,2,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_CENTER_HORIZONTAL)); //, wxALIGN_CENTER)); + sizer->Add( + new wxStaticText(this, wxID_ANY, wxT("jbb 0,3, lower-right")), + 0, 0, 0, new wxMultiCellItemHandle(0,3,1,1, wxDefaultSize, wxNOT_RESIZABLE, wxSize(1,1), wxALIGN_BOTTOM | wxALIGN_RIGHT)); + + // add button for secord row + sizer->Add( + new wxTextCtrl(this, wxID_ANY, wxT("Text control - 1,0, 4 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(1,0,1,4)); + + // add buttons for next row + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B6 - 2,0, 2 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(2,0,1,2)); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B7 - 2,3")), + 0, 0, 0, new wxMultiCellItemHandle(2,3,1,1)); + + // and last additions + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B8 - 3,0, 4 rows high, vert resizable")), + 0, 0, 0, new wxMultiCellItemHandle(3,0,4,1,wxDefaultSize, wxVERTICAL_RESIZABLE)); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B9 - 3,2, 2 cols wide, vert resizable")), + 0, 0, 0, new wxMultiCellItemHandle(3,2,1,2,wxDefaultSize, wxVERTICAL_RESIZABLE)); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B10 - 4,1, 3 cols wide, vert resizable")), + 0, 0, 0, new wxMultiCellItemHandle(4,1,1,3,wxDefaultSize, wxVERTICAL_RESIZABLE)); + + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B11 - 5,1, 3 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(5,1,1,3)); + + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B12 - 6,1, 3 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(6,1,1,3)); + + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B13 - 7,1, 2 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(7,1,1,2)); + + sizer->Add( + new wxButton( this, wxID_ANY, wxT("B14 - 8,1, 3 cols wide")), + 0, 0, 0, new wxMultiCellItemHandle(8,1,1,3)); + + SetAutoLayout( true ); +// sizer->SetMinSize(sizer->CalcMin()); + SetSizer( sizer ); + wxSize s = sizer->CalcMin(); + wxSize c = GetSize() - GetClientSize(); + SetSizeHints(s.GetWidth() + c.GetWidth() , s.GetHeight() + c.GetHeight()); + sizer->EnableGridLines(this); + } + else + { + // create sizer 4 columns 5 rows + wxMultiCellCanvas *sizer = new wxMultiCellCanvas(this, 5,5); + + // add first row + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 1")), + 0, 0); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 2")), + 0, 1); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 3")), + 0, 2); + sizer->Add( + new wxStaticText(this, wxID_ANY, wxT("jbb test")), + 0, 3); + + sizer->Add( + new wxStaticText(this, wxID_ANY, wxT("jbb test 2")), + 0, 4); + + // add button for secord row + sizer->Add( + new wxTextCtrl(this, wxID_ANY, wxT("Text control")), + 1, 0); + + // add buttons for next row + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 6")), + 2, 0); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 7")), + 2, 3); + + // and last additions + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 8")), + 3, 0); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 9")), + 3, 1); + sizer->Add( + new wxButton( this, wxID_ANY, wxT("Button 10")), + 4, 1); + + sizer->CalculateConstraints(); + SetSizer( sizer ); + SetAutoLayout( true ); + } } // Define the repainting behaviour @@ -200,16 +200,16 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event) ) { - wxPaintDC dc(this); + wxPaintDC dc(this); - if (sizer) - { - sizer->OnPaint(dc); - } + if (sizer) + { + sizer->OnPaint(dc); + } } void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { - Destroy(); + Destroy(); } diff --git a/contrib/samples/gizmos/splittree/tree.cpp b/contrib/samples/gizmos/splittree/tree.cpp index 10aff3c601..4a7beba3fc 100644 --- a/contrib/samples/gizmos/splittree/tree.cpp +++ b/contrib/samples/gizmos/splittree/tree.cpp @@ -138,12 +138,12 @@ bool MyApp::OnInit() // 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; } // ---------------------------------------------------------------------------- @@ -155,7 +155,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame((wxFrame *)NULL, idMAIN_FRAME, title, pos, size) { m_splitter = NULL; - m_scrolledWindow = NULL; + m_scrolledWindow = NULL; m_tree = NULL; m_valueWindow = NULL; #ifdef __WXMAC__ @@ -165,26 +165,26 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) #endif m_scrolledWindow = new wxSplitterScrolledWindow(this, idSCROLLED_WINDOW, wxDefaultPosition, - wxSize(300, 400), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); + wxSize(300, 400), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); m_splitter = new wxThinSplitterWindow(m_scrolledWindow, idSPLITTER_WINDOW, wxDefaultPosition, - wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); - m_splitter->SetSashSize(2); + wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); + m_splitter->SetSashSize(2); - /* Note the wxTR_ROW_LINES style: draws horizontal lines between items */ + /* Note the wxTR_ROW_LINES style: draws horizontal lines between items */ m_tree = new TestTree(m_splitter , idTREE_CTRL, wxDefaultPosition, - wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES ); + wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES ); m_valueWindow = new TestValueWindow(m_splitter, idVALUE_WINDOW, wxDefaultPosition, - wxDefaultSize, wxNO_BORDER); + wxDefaultSize, wxNO_BORDER); m_splitter->SplitVertically(m_tree, m_valueWindow); - //m_splitter->AdjustScrollbars(); - m_splitter->SetSashPosition(200); - m_scrolledWindow->SetTargetWindow(m_tree); + //m_splitter->AdjustScrollbars(); + m_splitter->SetSashPosition(200); + m_scrolledWindow->SetTargetWindow(m_tree); - m_scrolledWindow->EnableScrolling(FALSE, FALSE); + m_scrolledWindow->EnableScrolling(false, false); - // Let the two controls know about each other - m_valueWindow->SetTreeCtrl(m_tree); - m_tree->SetCompanionWindow(m_valueWindow); + // Let the two controls know about each other + m_valueWindow->SetTreeCtrl(m_tree); + m_tree->SetCompanionWindow(m_valueWindow); // set the frame icon SetIcon(wxICON(mondrian)); @@ -212,8 +212,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) 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)) @@ -238,7 +238,7 @@ TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt, const wxSize& sz, long style): wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style) { - m_imageList = new wxImageList(16, 16, TRUE); + m_imageList = new wxImageList(16, 16, true); #if !defined(__WXMSW__) // || wxUSE_XPM_IN_MSW m_imageList->Add(wxIcon(icon1_xpm)); m_imageList->Add(wxIcon(icon2_xpm)); @@ -250,28 +250,28 @@ TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt, #endif SetImageList(m_imageList); - - // Add some dummy items - wxTreeItemId rootId = AddRoot(_("Root"), -1, -1); - int i; - for (i = 1; i <= 20; i++) - { - wxString label; - label.Printf(wxT("Item %d"), i); - wxTreeItemId id = AppendItem(rootId, label, 0); - //SetItemImage( id, 1, wxTreeItemIcon_Expanded ); - - int j; - for (j = 0; j < 10; j++) - AppendItem(id, _("Child"), 1); - } - Expand(rootId); + + // Add some dummy items + wxTreeItemId rootId = AddRoot(_("Root"), -1, -1); + int i; + for (i = 1; i <= 20; i++) + { + wxString label; + label.Printf(wxT("Item %d"), i); + wxTreeItemId id = AppendItem(rootId, label, 0); + //SetItemImage( id, 1, wxTreeItemIcon_Expanded ); + + int j; + for (j = 0; j < 10; j++) + AppendItem(id, _("Child"), 1); + } + Expand(rootId); } TestTree::~TestTree() { - SetImageList(NULL); - delete m_imageList; + SetImageList(NULL); + delete m_imageList; } /* @@ -289,5 +289,5 @@ TestValueWindow::TestValueWindow(wxWindow* parent, wxWindowID id, long style): wxTreeCompanionWindow(parent, id, pos, sz, style) { - SetBackgroundColour(* wxWHITE); + SetBackgroundColour(* wxWHITE); } diff --git a/contrib/samples/gizmos/splittree/tree.h b/contrib/samples/gizmos/splittree/tree.h index ab02e6dd2f..fd939628fc 100644 --- a/contrib/samples/gizmos/splittree/tree.h +++ b/contrib/samples/gizmos/splittree/tree.h @@ -87,7 +87,7 @@ protected: class TestValueWindow: public wxTreeCompanionWindow { public: - TestValueWindow(wxWindow* parent, wxWindowID id = -1, + TestValueWindow(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = 0); diff --git a/contrib/src/gizmos/dynamicsash.cpp b/contrib/src/gizmos/dynamicsash.cpp index 1d508f2825..fa9ee2d622 100644 --- a/contrib/src/gizmos/dynamicsash.cpp +++ b/contrib/src/gizmos/dynamicsash.cpp @@ -230,22 +230,22 @@ bool wxDynamicSashWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if (m_impl) - return FALSE; + return false; if (!wxWindow::Create(parent, id, pos, size, style, name)) - return FALSE; + return false; m_impl = new wxDynamicSashWindowImpl(this); if (!m_impl) - return FALSE; + return false; if (!m_impl->Create()) { delete m_impl; m_impl = NULL; - return FALSE; + return false; } - return TRUE; + return true; } void wxDynamicSashWindow::AddChild(wxWindowBase *child) { @@ -303,39 +303,39 @@ bool wxDynamicSashWindowImpl::Create() { m_leaf = new wxDynamicSashWindowLeaf(this); if (!m_leaf) - return FALSE; + return false; if (!m_leaf->Create()) { delete m_leaf; m_leaf = NULL; - return FALSE; + return false; } m_container->SetEventHandler(this); - Connect(-1, wxEVT_SIZE, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SIZE, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction)&wxDynamicSashWindowImpl::OnSize); - Connect(-1, wxEVT_PAINT, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_PAINT, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction)&wxDynamicSashWindowImpl::OnPaint); - Connect(-1, wxEVT_MOTION, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_MOTION, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); - Connect(-1, wxEVT_ENTER_WINDOW, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_ENTER_WINDOW, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); - Connect(-1, wxEVT_LEAVE_WINDOW, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_LEAVE_WINDOW, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnLeave); - Connect(-1, wxEVT_LEFT_DOWN, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_LEFT_DOWN, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnPress); - Connect(-1, wxEVT_LEFT_UP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_LEFT_UP, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnRelease); - return TRUE; + return true; } void wxDynamicSashWindowImpl::AddChild(wxWindow *window) { @@ -573,7 +573,7 @@ void wxDynamicSashWindowImpl::Split(int px, int py) { m_add_child_target = NULL; m_child[0] = new wxDynamicSashWindowImpl(m_window); - m_child[0]->m_container = new wxWindow(m_container, -1); + m_child[0]->m_container = new wxWindow(m_container, wxID_ANY); m_child[0]->m_parent = this; m_child[0]->m_top = m_top; m_child[0]->Create(); @@ -583,7 +583,7 @@ void wxDynamicSashWindowImpl::Split(int px, int py) { } m_child[1] = new wxDynamicSashWindowImpl(m_window); - m_child[1]->m_container = new wxWindow(m_container, -1); + m_child[1]->m_container = new wxWindow(m_container, wxID_ANY); m_child[1]->m_parent = this; m_child[1]->m_top = m_top; m_child[1]->Create(); @@ -892,16 +892,16 @@ bool wxDynamicSashWindowLeaf::Create() { m_viewport = new wxWindow(); if (!m_hscroll || !m_vscroll || !m_viewport) { - return FALSE; + return false; } wxDynamicSashWindowImpl *add_child_target = m_impl->m_add_child_target; m_impl->m_add_child_target = NULL; - success = m_hscroll->Create(m_impl->m_container, -1, wxDefaultPosition, wxDefaultSize, + success = m_hscroll->Create(m_impl->m_container, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL); - success = success && m_vscroll->Create(m_impl->m_container, -1, wxDefaultPosition, wxDefaultSize, + success = success && m_vscroll->Create(m_impl->m_container, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); - success = success && m_viewport->Create(m_impl->m_container, -1); + success = success && m_viewport->Create(m_impl->m_container, wxID_ANY); m_impl->m_add_child_target = add_child_target; wxCursor cursor(wxCURSOR_ARROW); @@ -910,44 +910,44 @@ bool wxDynamicSashWindowLeaf::Create() { m_viewport->SetCursor(cursor); m_viewport->SetEventHandler(this); - Connect(-1, wxEVT_DYNAMIC_SASH_REPARENT, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnReparent); + Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_REPARENT, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnReparent); if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS) { m_hscroll->SetEventHandler(this); m_vscroll->SetEventHandler(this); - Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction)&wxDynamicSashWindowLeaf::OnFocus); - Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_TOP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) + Connect(wxID_ANY, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); } wxLayoutConstraints *layout = new wxLayoutConstraints(); if (!layout) - return FALSE; + return false; wxSize size = m_hscroll->GetBestSize(); #ifdef __WXMSW__ size = m_hscroll->GetSize(); @@ -961,7 +961,7 @@ bool wxDynamicSashWindowLeaf::Create() { layout = new wxLayoutConstraints(); if (!layout) - return FALSE; + return false; size = size = m_vscroll->GetBestSize(); #ifdef __WXMSW__ size = m_vscroll->GetSize(); @@ -975,7 +975,7 @@ bool wxDynamicSashWindowLeaf::Create() { layout = new wxLayoutConstraints(); if (!layout) - return FALSE; + return false; layout->left.SameAs(m_impl->m_container, wxLeft, 3); layout->right.LeftOf(m_vscroll); layout->top.SameAs(m_impl->m_container, wxTop, 3); diff --git a/contrib/src/gizmos/editlbox.cpp b/contrib/src/gizmos/editlbox.cpp index 656b11ae3e..14c7b90831 100644 --- a/contrib/src/gizmos/editlbox.cpp +++ b/contrib/src/gizmos/editlbox.cpp @@ -36,7 +36,7 @@ class CleverListCtrl : public wxListCtrl { public: CleverListCtrl(wxWindow *parent, - wxWindowID id = -1, + wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxLC_ICON, @@ -119,10 +119,10 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id, wxSizer *sizer = new wxBoxSizer(wxVERTICAL); - wxPanel *subp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, + wxPanel *subp = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL); wxSizer *subsizer = new wxBoxSizer(wxHORIZONTAL); - subsizer->Add(new wxStaticText(subp, -1, label), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT, 4); + subsizer->Add(new wxStaticText(subp, wxID_ANY, label), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT, 4); #ifdef __WXMSW__ #define BTN_BORDER 4 @@ -165,7 +165,7 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id, m_bDown->SetToolTip(_("Move down")); #endif - subp->SetAutoLayout(TRUE); + subp->SetAutoLayout(true); subp->SetSizer(subsizer); subsizer->Fit(subp); @@ -181,7 +181,7 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id, sizer->Add(m_listCtrl, 1, wxEXPAND); - SetAutoLayout(TRUE); + SetAutoLayout(true); SetSizer(sizer); Layout(); } diff --git a/contrib/src/gizmos/ledctrl.cpp b/contrib/src/gizmos/ledctrl.cpp index 21a260cbc5..ffcd8ad150 100644 --- a/contrib/src/gizmos/ledctrl.cpp +++ b/contrib/src/gizmos/ledctrl.cpp @@ -66,7 +66,7 @@ wxLEDNumberCtrl::wxLEDNumberCtrl() m_DigitMargin(-1), m_LineLength(-1), m_LineWidth(-1), - m_DrawFaded(FALSE), + m_DrawFaded(false), m_LeftStartPos(-1) { } @@ -80,7 +80,7 @@ wxLEDNumberCtrl::wxLEDNumberCtrl(wxWindow *parent, wxWindowID id, m_DigitMargin(-1), m_LineLength(-1), m_LineWidth(-1), - m_DrawFaded(FALSE), + m_DrawFaded(false), m_LeftStartPos(-1) { Create(parent, id, pos, size, style); @@ -94,7 +94,7 @@ bool wxLEDNumberCtrl::Create(wxWindow *parent, wxWindowID id, bool RetVal = wxControl::Create(parent, id, pos, size, style); if ((style & wxLED_DRAW_FADED) != 0) - SetDrawFaded(TRUE); + SetDrawFaded(true); if ((style & wxLED_ALIGN_MASK) != 0) SetAlignment((wxLEDValueAlign)(style & wxLED_ALIGN_MASK)); @@ -113,7 +113,7 @@ void wxLEDNumberCtrl::SetAlignment(wxLEDValueAlign Alignment, bool Redraw) RecalcInternals(GetClientSize()); if (Redraw) - Refresh(FALSE); + Refresh(false); } } @@ -125,7 +125,7 @@ void wxLEDNumberCtrl::SetDrawFaded(bool DrawFaded, bool Redraw) m_DrawFaded = DrawFaded; if (Redraw) - Refresh(FALSE); + Refresh(false); } } @@ -149,7 +149,7 @@ void wxLEDNumberCtrl::SetValue(wxString const &Value, bool Redraw) RecalcInternals(GetClientSize()); if (Redraw) - Refresh(FALSE); + Refresh(false); } } @@ -271,7 +271,7 @@ void wxLEDNumberCtrl::DrawDigit(wxDC &Dc, int Digit, int Column) { Dc.DrawLine(XPos + m_LineMargin*2, m_LineMargin, XPos + m_LineLength, m_LineMargin); - } + } if (Digit & LINE2) { diff --git a/contrib/src/gizmos/multicell.cpp b/contrib/src/gizmos/multicell.cpp index d9bf7b1364..6c6d1069ba 100644 --- a/contrib/src/gizmos/multicell.cpp +++ b/contrib/src/gizmos/multicell.cpp @@ -12,14 +12,14 @@ // This was inspired by the gbsizer class written by Alex Andruschak #ifdef __GNUG__ - #pragma implementation "multicell.h" + #pragma implementation "multicell.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop + #pragma hdrstop #endif // ---------------------------------------------------------------------------- @@ -27,10 +27,10 @@ // ---------------------------------------------------------------------------- #ifndef WX_PRECOMP - #include "wx/wx.h" + #include "wx/wx.h" #endif -#include "wx/gizmos/multicell.h" +#include "wx/gizmos/multicell.h" @@ -44,93 +44,93 @@ IMPLEMENT_ABSTRACT_CLASS(wxMultiCellItemHandle, wxObject); // wxMultiCellItemHandle //--------------------------------------------------------------------------- /* - *Function Name: wxMultiCellItemHandle :: wxMultiCellItemHandle + *Function Name: wxMultiCellItemHandle :: wxMultiCellItemHandle * - *Parameters: int row - * int column - * int height - * int width - * wxSize size - * wxResizable Style - * wxSize weight - * int align + *Parameters: int row + * int column + * int height + * int width + * wxSize size + * wxResizable Style + * wxSize weight + * int align * - *Description: This is the constructor for the class. + *Description: This is the constructor for the class. * */ void wxMultiCellItemHandle :: Initialize( int row, int column, int height, int width, wxSize size, wxResizable Style, wxSize weight, int align) { - m_column = column; - m_row = row; - m_width = width; - m_height = height; + m_column = column; + m_row = row; + m_width = width; + m_height = height; - m_style = Style; - m_fixedSize = size; - m_alignment = align; - m_weight = weight; + m_style = Style; + m_fixedSize = size; + m_alignment = align; + m_weight = weight; } //--------------------------------------------------------------------------- wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, int height, int width, wxSize size, wxResizable Style, wxSize weight, int align) { - Initialize(row, column,height, width, size, Style, weight, align); + Initialize(row, column,height, width, size, Style, weight, align); } //--------------------------------------------------------------------------- wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, wxSize size, wxResizable style, wxSize weight, int align) { - Initialize(row, column,1, 1, size, style, weight, align); + Initialize(row, column,1, 1, size, style, weight, align); } //--------------------------------------------------------------------------- wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, wxResizable style, wxSize weight, int align) { - Initialize(row, column, 1, 1, wxSize(1, 1), style, weight, align); + Initialize(row, column, 1, 1, wxSize(1, 1), style, weight, align); } //--------------------------------------------------------------------------- wxMultiCellItemHandle :: wxMultiCellItemHandle( int row, int column, int align) { - Initialize(row, column, 1, 1, wxSize(1,1), wxNOT_RESIZABLE, wxSize(1, 1), align); + Initialize(row, column, 1, 1, wxSize(1,1), wxNOT_RESIZABLE, wxSize(1, 1), align); } //--------------------------------------------------------------------------- int wxMultiCellItemHandle::GetColumn() { - return m_column; + return m_column; } //--------------------------------------------------------------------------- int wxMultiCellItemHandle::GetRow() { - return m_row; + return m_row; } //--------------------------------------------------------------------------- int wxMultiCellItemHandle::GetWidth() { - return m_width; + return m_width; } //--------------------------------------------------------------------------- int wxMultiCellItemHandle::GetHeight() { - return m_height; + return m_height; } //--------------------------------------------------------------------------- wxResizable wxMultiCellItemHandle :: GetStyle() { - return m_style; + return m_style; }; //--------------------------------------------------------------------------- wxSize wxMultiCellItemHandle :: GetLocalSize() { - return m_fixedSize; + return m_fixedSize; }; //--------------------------------------------------------------------------- int wxMultiCellItemHandle :: GetAlignment() { - return m_alignment; + return m_alignment; }; //--------------------------------------------------------------------------- wxSize wxMultiCellItemHandle :: GetWeight() { - return m_weight; + return m_weight; }; @@ -142,445 +142,445 @@ wxSize wxMultiCellItemHandle :: GetWeight() //--------------------------------------------------------------------------- /* - *Function Name: wxMultiCellSizer::Initialize + *Function Name: wxMultiCellSizer::Initialize * - *Parameters: wxsize Initial size of sizer + *Parameters: wxsize Initial size of sizer * - *Description: This is a common function to initialize all the members of - * this class. It is only called from the constructors + *Description: This is a common function to initialize all the members of + * this class. It is only called from the constructors * */ void wxMultiCellSizer::Initialize( wxSize size ) { - m_cell_count = size; - m_maxHeight = (int *)malloc((1 + m_cell_count.GetHeight()) * sizeof(int)); - m_maxWidth = (int *)malloc( (1 + m_cell_count.GetWidth()) * sizeof(int)); - m_rowStretch = (int *)malloc( (1 + m_cell_count.GetHeight()) * sizeof(int)); - m_colStretch = (int *)malloc((1 + m_cell_count.GetWidth()) * sizeof(int)); - - m_weights = (wxSize **)malloc((1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); - m_minSizes = (wxSize **)malloc((1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); - for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - m_weights[x] = new wxSize(0,0); - m_minSizes[x] = new wxSize(0,0); - } - - m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); - m_defaultCellSize = wxSize(5, 5); - m_win = NULL; - m_pen = wxRED_PEN; + m_cell_count = size; + m_maxHeight = (int *)malloc((1 + m_cell_count.GetHeight()) * sizeof(int)); + m_maxWidth = (int *)malloc( (1 + m_cell_count.GetWidth()) * sizeof(int)); + m_rowStretch = (int *)malloc( (1 + m_cell_count.GetHeight()) * sizeof(int)); + m_colStretch = (int *)malloc((1 + m_cell_count.GetWidth()) * sizeof(int)); + + m_weights = (wxSize **)malloc((1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); + m_minSizes = (wxSize **)malloc((1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); + for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + m_weights[x] = new wxSize(0,0); + m_minSizes[x] = new wxSize(0,0); + } + + m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); + m_defaultCellSize = wxSize(5, 5); + m_win = NULL; + m_pen = wxRED_PEN; } //--------------------------------------------------------------------------- wxMultiCellSizer::wxMultiCellSizer( wxSize & size ) { - Initialize(size); + Initialize(size); } //--------------------------------------------------------------------------- wxMultiCellSizer::wxMultiCellSizer( int rows, int cols) { - wxSize size(cols, rows); - Initialize(size); + wxSize size(cols, rows); + Initialize(size); } //--------------------------------------------------------------------------- wxMultiCellSizer::~wxMultiCellSizer() { - WX_CLEAR_LIST(wxSizerItemList, m_children); + WX_CLEAR_LIST(wxSizerItemList, m_children); - free(m_maxHeight); - free(m_maxWidth); - free(m_rowStretch); - free(m_colStretch); + free(m_maxHeight); + free(m_maxWidth); + free(m_rowStretch); + free(m_colStretch); - for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - delete m_weights[x]; - delete m_minSizes[x]; - } - free(m_weights); - free(m_minSizes); + for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + delete m_weights[x]; + delete m_minSizes[x]; + } + free(m_weights); + free(m_minSizes); } //--------------------------------------------------------------------------- bool wxMultiCellSizer::EnableGridLines(wxWindow *win) { - m_win = win; - return TRUE; + m_win = win; + return true; } //--------------------------------------------------------------------------- bool wxMultiCellSizer::SetGridPen(wxPen *pen) { - m_pen = pen; - return TRUE; + m_pen = pen; + return true; } //--------------------------------------------------------------------------- bool wxMultiCellSizer::SetDefaultCellSize(wxSize size) { - m_defaultCellSize = size; - return TRUE; + m_defaultCellSize = size; + return true; } //--------------------------------------------------------------------------- bool wxMultiCellSizer::SetColumnWidth(int column, int colSize, bool expandable) { - if (expandable) - { - m_minSizes[column]->SetWidth(-colSize); - } - else - { - m_minSizes[column]->SetWidth(colSize); - } - return TRUE; + if (expandable) + { + m_minSizes[column]->SetWidth(-colSize); + } + else + { + m_minSizes[column]->SetWidth(colSize); + } + return true; } //--------------------------------------------------------------------------- bool wxMultiCellSizer::SetRowHeight(int row, int rowSize, bool expandable) { - if (expandable) - { - m_minSizes[row]->SetHeight(-rowSize); - } - else - { - m_minSizes[row]->SetHeight(rowSize); - } - return TRUE; + if (expandable) + { + m_minSizes[row]->SetHeight(-rowSize); + } + else + { + m_minSizes[row]->SetHeight(rowSize); + } + return true; } //--------------------------------------------------------------------------- void wxMultiCellSizer::RecalcSizes() { - if (m_children.GetCount() == 0) - return; - wxSize size = GetSize(); - wxPoint pos = GetPosition(); - - GetMinimums(); - - // We need to take the unused space and equally give it out to all the rows/columns - // which are stretchable - - int unUsedWidth = size.GetWidth() - Sum(m_maxWidth, m_cell_count.GetWidth()); - int unUsedHeight = size.GetHeight() - Sum(m_maxHeight, m_cell_count.GetHeight()); - int totalWidthWeight = 0; - int totalHeightWeight = 0; - int x; - - for (x = 0; x < wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - if (m_rowStretch[x]) - { - totalHeightWeight += m_weights[x]->GetHeight(); - } - if (x < m_cell_count.GetWidth() && m_colStretch[x]) - { - totalWidthWeight += m_weights[x]->GetWidth(); - } - } - for (x = 0; x < wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - if (x < m_cell_count.GetHeight() && m_rowStretch[x]) - { - m_maxHeight[x] += unUsedHeight * m_weights[x]->GetHeight() / totalHeightWeight; - } - if (x < m_cell_count.GetWidth() && m_colStretch[x]) - { - m_maxWidth[x] += unUsedWidth * m_weights[x]->GetWidth() / totalWidthWeight; - } - } - // We now have everything we need to figure each cell position and size - // The arrays m_maxHeight and m_maxWidth now contain the final widths and height of - // each row and column. - - double cell_width = (double)size.GetWidth() / (double)m_cell_count.GetWidth(); - double cell_height = (double)size.GetHeight() / (double)m_cell_count.GetHeight(); - wxPoint c_point; - wxSize c_size; - - wxSizerItemList::compatibility_iterator current = m_children.GetFirst(); - while (current) - { - wxSizerItem *item = current->GetData(); - - wxMultiCellItemHandle *rect; - if (item != NULL && - (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL) - { - c_point.x = pos.x + (int)(rect->GetColumn() * cell_width); - c_point.y = pos.y + (int)(rect->GetRow() * cell_height); - - c_point.x = pos.x + Sum(m_maxWidth, rect->GetColumn()); - c_point.y = pos.y + Sum(m_maxHeight, rect->GetRow()); - - - c_size = rect->GetLocalSize(); - wxSize minSize( item->CalcMin() ); - if (c_size.GetHeight() != wxDefaultSize.GetHeight() || - c_size.GetWidth() != wxDefaultSize.GetWidth()) - { - minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight())); - minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth())); - } - if (rect->GetStyle() & wxHORIZONTAL_RESIZABLE || - rect->GetWidth() > 1 - || m_minSizes[rect->GetColumn()]->GetWidth() < 0) - { - int w = 0; - for (int x = 0; x < rect->GetWidth(); x++) - { - w += m_maxWidth[rect->GetColumn() + x]; - } - c_size.SetWidth(w); - } - else - { - c_size.SetWidth(minSize.GetWidth() ); - } - if (rect->GetStyle() & wxVERTICAL_RESIZABLE || - rect->GetHeight() > 1 || - m_minSizes[rect->GetRow()]->GetHeight() < 0) - { - int h = 0; - for (int x = 0; x < rect->GetHeight(); x++) - { - h += m_maxHeight[rect->GetRow() + x]; - } - c_size.SetHeight(h); - } - else - { - c_size.SetHeight(minSize.GetHeight()); - } - int extraHeight = (m_maxHeight[rect->GetRow()] - c_size.GetHeight()); - int extraWidth = (m_maxWidth[rect->GetColumn()] - c_size.GetWidth()); - - if (rect->GetWidth() == 1 && rect->GetAlignment() & wxALIGN_CENTER_HORIZONTAL) - { - c_point.x += extraWidth / 2; - } - if (rect->GetWidth() == 1 && rect->GetAlignment() & wxALIGN_RIGHT) - { - c_point.x += extraWidth; - } - if (rect->GetHeight() == 1 && rect->GetAlignment() & wxALIGN_CENTER_VERTICAL) - { - c_point.y += extraHeight / 2; - } - if (rect->GetHeight() == 1 && rect->GetAlignment() & wxALIGN_BOTTOM) - { - c_point.y += extraHeight; - } - item->SetDimension(c_point, c_size); - } - current = current->GetNext(); - } + if (m_children.GetCount() == 0) + return; + wxSize size = GetSize(); + wxPoint pos = GetPosition(); + + GetMinimums(); + + // We need to take the unused space and equally give it out to all the rows/columns + // which are stretchable + + int unUsedWidth = size.GetWidth() - Sum(m_maxWidth, m_cell_count.GetWidth()); + int unUsedHeight = size.GetHeight() - Sum(m_maxHeight, m_cell_count.GetHeight()); + int totalWidthWeight = 0; + int totalHeightWeight = 0; + int x; + + for (x = 0; x < wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + if (m_rowStretch[x]) + { + totalHeightWeight += m_weights[x]->GetHeight(); + } + if (x < m_cell_count.GetWidth() && m_colStretch[x]) + { + totalWidthWeight += m_weights[x]->GetWidth(); + } + } + for (x = 0; x < wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + if (x < m_cell_count.GetHeight() && m_rowStretch[x]) + { + m_maxHeight[x] += unUsedHeight * m_weights[x]->GetHeight() / totalHeightWeight; + } + if (x < m_cell_count.GetWidth() && m_colStretch[x]) + { + m_maxWidth[x] += unUsedWidth * m_weights[x]->GetWidth() / totalWidthWeight; + } + } + // We now have everything we need to figure each cell position and size + // The arrays m_maxHeight and m_maxWidth now contain the final widths and height of + // each row and column. + + double cell_width = (double)size.GetWidth() / (double)m_cell_count.GetWidth(); + double cell_height = (double)size.GetHeight() / (double)m_cell_count.GetHeight(); + wxPoint c_point; + wxSize c_size; + + wxSizerItemList::compatibility_iterator current = m_children.GetFirst(); + while (current) + { + wxSizerItem *item = current->GetData(); + + wxMultiCellItemHandle *rect; + if (item != NULL && + (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL) + { + c_point.x = pos.x + (int)(rect->GetColumn() * cell_width); + c_point.y = pos.y + (int)(rect->GetRow() * cell_height); + + c_point.x = pos.x + Sum(m_maxWidth, rect->GetColumn()); + c_point.y = pos.y + Sum(m_maxHeight, rect->GetRow()); + + + c_size = rect->GetLocalSize(); + wxSize minSize( item->CalcMin() ); + if (c_size.GetHeight() != wxDefaultSize.GetHeight() || + c_size.GetWidth() != wxDefaultSize.GetWidth()) + { + minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight())); + minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth())); + } + if (rect->GetStyle() & wxHORIZONTAL_RESIZABLE || + rect->GetWidth() > 1 + || m_minSizes[rect->GetColumn()]->GetWidth() < 0) + { + int w = 0; + for (int x = 0; x < rect->GetWidth(); x++) + { + w += m_maxWidth[rect->GetColumn() + x]; + } + c_size.SetWidth(w); + } + else + { + c_size.SetWidth(minSize.GetWidth() ); + } + if (rect->GetStyle() & wxVERTICAL_RESIZABLE || + rect->GetHeight() > 1 || + m_minSizes[rect->GetRow()]->GetHeight() < 0) + { + int h = 0; + for (int x = 0; x < rect->GetHeight(); x++) + { + h += m_maxHeight[rect->GetRow() + x]; + } + c_size.SetHeight(h); + } + else + { + c_size.SetHeight(minSize.GetHeight()); + } + int extraHeight = (m_maxHeight[rect->GetRow()] - c_size.GetHeight()); + int extraWidth = (m_maxWidth[rect->GetColumn()] - c_size.GetWidth()); + + if (rect->GetWidth() == 1 && rect->GetAlignment() & wxALIGN_CENTER_HORIZONTAL) + { + c_point.x += extraWidth / 2; + } + if (rect->GetWidth() == 1 && rect->GetAlignment() & wxALIGN_RIGHT) + { + c_point.x += extraWidth; + } + if (rect->GetHeight() == 1 && rect->GetAlignment() & wxALIGN_CENTER_VERTICAL) + { + c_point.y += extraHeight / 2; + } + if (rect->GetHeight() == 1 && rect->GetAlignment() & wxALIGN_BOTTOM) + { + c_point.y += extraHeight; + } + item->SetDimension(c_point, c_size); + } + current = current->GetNext(); + } } //--------------------------------------------------------------------------- wxSize wxMultiCellSizer::CalcMin() { - if (m_children.GetCount() == 0) - return wxSize(10,10); + if (m_children.GetCount() == 0) + return wxSize(10,10); - GetMinimums(); - int m_minWidth = Sum(m_maxWidth, m_cell_count.GetWidth()); - int m_minHeight = Sum(m_maxHeight, m_cell_count.GetHeight()); - return wxSize( m_minWidth, m_minHeight ); + GetMinimums(); + int m_minWidth = Sum(m_maxWidth, m_cell_count.GetWidth()); + int m_minHeight = Sum(m_maxHeight, m_cell_count.GetHeight()); + return wxSize( m_minWidth, m_minHeight ); } //--------------------------------------------------------------------------- void wxMultiCellSizer :: GetMinimums() { - // We first initial all the arrays EXCEPT for the m_minsizes array. - - memset(m_maxHeight, 0, sizeof(int) * m_cell_count.GetHeight()); - memset(m_maxWidth, 0, sizeof(int) * m_cell_count.GetWidth()); - memset(m_rowStretch, 0, sizeof(int) * m_cell_count.GetHeight()); - memset(m_colStretch, 0, sizeof(int) * m_cell_count.GetWidth()); - for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - m_weights[x]->SetHeight(0); - m_weights[x]->SetWidth(0); - } - - wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); - while (node) - { - wxSizerItem *item = node->GetData(); - wxMultiCellItemHandle *rect; - if (item != NULL && - (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL) - { - int row = rect->GetRow(); - int col = rect->GetColumn(); - - // First make sure that the control knows about the max rows and columns - - int changed = FALSE; - if (row + 1 > m_cell_count.GetHeight()) - { - changed++; - m_maxHeight = (int *)realloc(m_maxHeight, (1 + row) * sizeof(int)); - m_rowStretch = (int *)realloc(m_rowStretch, (1 + row) * sizeof(int)); - for (int x = m_cell_count.GetHeight(); x < row + 1; x++) - { - m_maxHeight[x - 1] = 0; - m_rowStretch[x - 1] = 0; - } - m_cell_count.SetHeight(row + 1); - } - if (col + 1 > m_cell_count.GetWidth()) - { - changed++; - m_maxWidth = (int *)realloc(m_maxWidth, (1 + col) * sizeof(int)); - m_colStretch = (int *)realloc(m_colStretch, ( 1 + col) * sizeof(int)); - for (int x = m_cell_count.GetWidth(); x < col + 1; x++) - { - m_maxWidth[x - 1] = 0; - m_colStretch[x - 1] = 0; - } - m_cell_count.SetWidth(col + 1); - } - if (changed) - { - m_weights = (wxSize **)realloc(m_weights, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); - m_minSizes = (wxSize **)realloc(m_minSizes, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); - for (int x = m_maxWeights; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) - { - m_weights[x - 1] = new wxSize(0,0); - m_minSizes[x - 1] = new wxSize(0,0); - } - m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); - } - - // Sum the m_weights for each row/column, but only if they are resizable - - wxSize minSize( item->CalcMin() ); - wxSize c_size = rect->GetLocalSize(); - if (c_size.GetHeight() != wxDefaultSize.GetHeight() || - c_size.GetWidth() != wxDefaultSize.GetWidth()) - { - minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight())); - minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth())); - } - - // For each row, calculate the max height for those fields which are not - // resizable in the vertical pane - - if (!(rect->GetStyle() & wxVERTICAL_RESIZABLE || m_minSizes[row]->GetHeight() < 0)) - { - m_maxHeight[row] = wxMax(m_maxHeight[row], minSize.GetHeight() / rect->GetHeight()); - } - else - { - m_rowStretch[row] = 1; - if (m_minSizes[row]->GetHeight()) - { - m_maxHeight[row] = abs(m_minSizes[row]->GetHeight()); - } - else - { - m_maxHeight[row] = wxMax(m_maxHeight[row], m_defaultCellSize.GetHeight()); - } - m_weights[row]->SetHeight(wxMax(m_weights[row]->GetHeight(), rect->GetWeight().GetHeight())); - } - - // For each column, calculate the max width for those fields which are not - // resizable in the horizontal pane - - if (!(rect->GetStyle() & wxHORIZONTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0)) - { - if (m_minSizes[col]->GetWidth()) - { - m_maxWidth[col] = abs(m_minSizes[col]->GetWidth()); - } - else - { - m_maxWidth[col] = wxMax(m_maxWidth[col], minSize.GetWidth() / rect->GetWidth()); - } - } - else - { - m_colStretch[col] = 1; - m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth()); - m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth())); - } - node = node->GetNext(); - } - } + // We first initial all the arrays EXCEPT for the m_minsizes array. + + memset(m_maxHeight, 0, sizeof(int) * m_cell_count.GetHeight()); + memset(m_maxWidth, 0, sizeof(int) * m_cell_count.GetWidth()); + memset(m_rowStretch, 0, sizeof(int) * m_cell_count.GetHeight()); + memset(m_colStretch, 0, sizeof(int) * m_cell_count.GetWidth()); + for (int x = 0; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + m_weights[x]->SetHeight(0); + m_weights[x]->SetWidth(0); + } + + wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); + while (node) + { + wxSizerItem *item = node->GetData(); + wxMultiCellItemHandle *rect; + if (item != NULL && + (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL) + { + int row = rect->GetRow(); + int col = rect->GetColumn(); + + // First make sure that the control knows about the max rows and columns + + int changed = false; + if (row + 1 > m_cell_count.GetHeight()) + { + changed++; + m_maxHeight = (int *)realloc(m_maxHeight, (1 + row) * sizeof(int)); + m_rowStretch = (int *)realloc(m_rowStretch, (1 + row) * sizeof(int)); + for (int x = m_cell_count.GetHeight(); x < row + 1; x++) + { + m_maxHeight[x - 1] = 0; + m_rowStretch[x - 1] = 0; + } + m_cell_count.SetHeight(row + 1); + } + if (col + 1 > m_cell_count.GetWidth()) + { + changed++; + m_maxWidth = (int *)realloc(m_maxWidth, (1 + col) * sizeof(int)); + m_colStretch = (int *)realloc(m_colStretch, ( 1 + col) * sizeof(int)); + for (int x = m_cell_count.GetWidth(); x < col + 1; x++) + { + m_maxWidth[x - 1] = 0; + m_colStretch[x - 1] = 0; + } + m_cell_count.SetWidth(col + 1); + } + if (changed) + { + m_weights = (wxSize **)realloc(m_weights, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); + m_minSizes = (wxSize **)realloc(m_minSizes, (1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth())) * sizeof(wxSize *)); + for (int x = m_maxWeights; x < 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); x++) + { + m_weights[x - 1] = new wxSize(0,0); + m_minSizes[x - 1] = new wxSize(0,0); + } + m_maxWeights = 1 + wxMax(m_cell_count.GetHeight(), m_cell_count.GetWidth()); + } + + // Sum the m_weights for each row/column, but only if they are resizable + + wxSize minSize( item->CalcMin() ); + wxSize c_size = rect->GetLocalSize(); + if (c_size.GetHeight() != wxDefaultSize.GetHeight() || + c_size.GetWidth() != wxDefaultSize.GetWidth()) + { + minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight())); + minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth())); + } + + // For each row, calculate the max height for those fields which are not + // resizable in the vertical pane + + if (!(rect->GetStyle() & wxVERTICAL_RESIZABLE || m_minSizes[row]->GetHeight() < 0)) + { + m_maxHeight[row] = wxMax(m_maxHeight[row], minSize.GetHeight() / rect->GetHeight()); + } + else + { + m_rowStretch[row] = 1; + if (m_minSizes[row]->GetHeight()) + { + m_maxHeight[row] = abs(m_minSizes[row]->GetHeight()); + } + else + { + m_maxHeight[row] = wxMax(m_maxHeight[row], m_defaultCellSize.GetHeight()); + } + m_weights[row]->SetHeight(wxMax(m_weights[row]->GetHeight(), rect->GetWeight().GetHeight())); + } + + // For each column, calculate the max width for those fields which are not + // resizable in the horizontal pane + + if (!(rect->GetStyle() & wxHORIZONTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0)) + { + if (m_minSizes[col]->GetWidth()) + { + m_maxWidth[col] = abs(m_minSizes[col]->GetWidth()); + } + else + { + m_maxWidth[col] = wxMax(m_maxWidth[col], minSize.GetWidth() / rect->GetWidth()); + } + } + else + { + m_colStretch[col] = 1; + m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth()); + m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth())); + } + node = node->GetNext(); + } + } } // wxMultiCellSizer :: GetMinimums //--------------------------------------------------------------------------- /* - *Function Name: wxMultiCellSizer :: Sum + *Function Name: wxMultiCellSizer :: Sum * - *Parameters: int * pointer to array of ints - * int Number of cells to sum up + *Parameters: int* pointer to array of ints + * int Number of cells to sum up * - *Description: This member function sums up all the elements of the array which - * preceed the specified cell. + *Description: This member function sums up all the elements of the array which + * preceed the specified cell. * - *Returns: int Sum + *Returns: int Sum * */ int wxMultiCellSizer :: Sum(int *array, int x) { - int sum = 0; - while (x--) - { - sum += array[x]; - } - return sum; + int sum = 0; + while (x--) + { + sum += array[x]; + } + return sum; } //--------------------------------------------------------------------------- /* - *Function Name: wxMultiCellSizer :: DrawGridLines + *Function Name: wxMultiCellSizer :: DrawGridLines * - *Parameters: wxDC Device context + *Parameters: wxDC Device context * - *Description: This function draws the grid lines in the specified device context. + *Description: This function draws the grid lines in the specified device context. * */ void wxMultiCellSizer :: DrawGridLines(wxDC& dc) { - RecalcSizes(); - int maxW = Sum(m_maxWidth, m_cell_count.GetWidth()); - int maxH = Sum(m_maxHeight, m_cell_count.GetHeight()); - int x; - - // Draw the columns - dc.SetPen(* m_pen); - for (x = 1; x < m_cell_count.GetWidth(); x++) - { - int colPos = Sum(m_maxWidth, x) ; - dc.DrawLine(colPos, 0, colPos, maxH); - } - - // Draw the rows - for (x = 1; x < m_cell_count.GetHeight(); x++) - { - int rowPos = Sum(m_maxHeight, x); - dc.DrawLine(0, rowPos, maxW, rowPos); - } + RecalcSizes(); + int maxW = Sum(m_maxWidth, m_cell_count.GetWidth()); + int maxH = Sum(m_maxHeight, m_cell_count.GetHeight()); + int x; + + // Draw the columns + dc.SetPen(* m_pen); + for (x = 1; x < m_cell_count.GetWidth(); x++) + { + int colPos = Sum(m_maxWidth, x) ; + dc.DrawLine(colPos, 0, colPos, maxH); + } + + // Draw the rows + for (x = 1; x < m_cell_count.GetHeight(); x++) + { + int rowPos = Sum(m_maxHeight, x); + dc.DrawLine(0, rowPos, maxW, rowPos); + } } //--------------------------------------------------------------------------- // Define the repainting behaviour /* - *Function Name: wxMultiCellSizer::OnPaint + *Function Name: wxMultiCellSizer::OnPaint * - *Parameters: wxDC Device context + *Parameters: wxDC Device context * - *Description: This function calls the DrawGridLines() member if a window - * has been previously specified. This functions MUST be called - * from an OnPaint member belonging to the window which the sizer - * is attached to. + *Description: This function calls the DrawGridLines() member if a window + * has been previously specified. This functions MUST be called + * from an OnPaint member belonging to the window which the sizer + * is attached to. * */ void wxMultiCellSizer::OnPaint(wxDC& dc ) { - if (m_win) - { - DrawGridLines(dc); - } + if (m_win) + { + DrawGridLines(dc); + } } @@ -590,27 +590,27 @@ void wxMultiCellSizer::OnPaint(wxDC& dc ) -#define CELL_LOC(row, col) ((row) * m_maxCols + col) +#define CELL_LOC(row, col) ((row) * m_maxCols + col) //--------------------------------------------------------------------------- // wxCell //--------------------------------------------------------------------------- /* - *Function Name: wxCell : wxLayoutConstraints + *Function Name: wxCell : wxLayoutConstraints * - *Description: This class is used by wxMultiCellCanvas for internal storage + *Description: This class is used by wxMultiCellCanvas for internal storage * */ class wxCell : public wxLayoutConstraints { public: - wxCell(wxWindow *win) - { - m_window = win; - }; + wxCell(wxWindow *win) + { + m_window = win; + }; - wxWindow *m_window; + wxWindow *m_window; }; @@ -621,43 +621,43 @@ public: wxMultiCellCanvas :: wxMultiCellCanvas(wxWindow *par, int numRows, int numCols) : wxFlexGridSizer(numRows, numCols, 0, 0) { - m_cells = (wxCell **)calloc(numRows * numCols, sizeof(wxCell *)); + m_cells = (wxCell **)calloc(numRows * numCols, sizeof(wxCell *)); - m_parent = par; - m_maxRows = numRows; - m_maxCols = numCols; - m_minCellSize = wxSize(5, 5); + m_parent = par; + m_maxRows = numRows; + m_maxCols = numCols; + m_minCellSize = wxSize(5, 5); } //--------------------------------------------------------------------------- void wxMultiCellCanvas :: Add(wxWindow *win, unsigned int row, unsigned int col) { // thanks to unsigned data row and col are always >= 0 - wxASSERT_MSG( /* row >= 0 && */ row < m_maxRows, + wxASSERT_MSG( /* row >= 0 && */ row < m_maxRows, wxString::Format(_T("Row %d out of bounds (0..%d)"), row, m_maxRows) ); - wxASSERT_MSG( /* col >= 0 && */ col < m_maxCols, + wxASSERT_MSG( /* col >= 0 && */ col < m_maxCols, wxString::Format(_T("Column %d out of bounds (0..%d)"), col, m_maxCols) ); - wxASSERT_MSG(m_cells[CELL_LOC(row, col)] == NULL, wxT("Cell already occupied")); + wxASSERT_MSG(m_cells[CELL_LOC(row, col)] == NULL, wxT("Cell already occupied")); - wxCell *newCell = new wxCell(win); - m_cells[CELL_LOC(row,col)] = newCell; + wxCell *newCell = new wxCell(win); + m_cells[CELL_LOC(row,col)] = newCell; } //--------------------------------------------------------------------------- void wxMultiCellCanvas :: CalculateConstraints() { - unsigned int row, col; - for (row = 0; row < m_maxRows; row++) - { - for (col = 0; col < m_maxCols; col++) - { - if (!m_cells[CELL_LOC(row, col)]) - { - // Create an empty static text field as a placeholder - m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, -1, wxT(""))); - } - wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window); - } - } + unsigned int row, col; + for (row = 0; row < m_maxRows; row++) + { + for (col = 0; col < m_maxCols; col++) + { + if (!m_cells[CELL_LOC(row, col)]) + { + // Create an empty static text field as a placeholder + m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, wxID_ANY, wxT(""))); + } + wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window); + } + } } /*** End of File ***/ diff --git a/contrib/src/gizmos/splittree.cpp b/contrib/src/gizmos/splittree.cpp index 6ce95b5552..5f189b2235 100644 --- a/contrib/src/gizmos/splittree.cpp +++ b/contrib/src/gizmos/splittree.cpp @@ -60,8 +60,8 @@ BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl) #endif EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize) EVT_PAINT(wxRemotelyScrolledTreeCtrl::OnPaint) - EVT_TREE_ITEM_EXPANDED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) - EVT_TREE_ITEM_COLLAPSED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) + EVT_TREE_ITEM_EXPANDED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) + EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll) END_EVENT_TABLE() @@ -90,7 +90,7 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar() if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) #endif { - ::ShowScrollBar((HWND) GetHWND(), SB_VERT, FALSE); + ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); } #if USE_GENERIC_TREECTRL else @@ -122,7 +122,7 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars( if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ TRUE); + win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ true); wxScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) @@ -541,7 +541,7 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event) return; // TODO: scroll the window physically instead of just refreshing. - Refresh(TRUE); + Refresh(true); } void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event)) @@ -674,37 +674,37 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) { // Ensure that events being propagated back up the window hierarchy // don't cause an infinite loop - static bool inOnScroll = FALSE; + static bool inOnScroll = false; if (inOnScroll) { event.Skip(); return; } - inOnScroll = TRUE; + inOnScroll = true; int orient = event.GetOrientation(); int nScrollInc = CalcScrollInc(event); if (nScrollInc == 0) { - inOnScroll = FALSE; + inOnScroll = false; return; } if (orient == wxHORIZONTAL) { - inOnScroll = FALSE; + inOnScroll = false; event.Skip(); return; #if 0 int newPos = m_xScrollPosition + nScrollInc; - SetScrollPos(wxHORIZONTAL, newPos, TRUE ); + SetScrollPos(wxHORIZONTAL, newPos, true ); #endif } else { int newPos = m_yScrollPosition + nScrollInc; - SetScrollPos(wxVERTICAL, newPos, TRUE ); + SetScrollPos(wxVERTICAL, newPos, true ); } if (orient == wxHORIZONTAL) @@ -735,6 +735,6 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) m_targetWindow->Update() ; - inOnScroll = FALSE; + inOnScroll = false; } diff --git a/contrib/src/gizmos/statpict.cpp b/contrib/src/gizmos/statpict.cpp index 1886d3c54e..5f6ce086de 100644 --- a/contrib/src/gizmos/statpict.cpp +++ b/contrib/src/gizmos/statpict.cpp @@ -43,9 +43,9 @@ bool wxStaticPicture::Create(wxWindow *parent, wxWindowID id, wxSize size = s ; if ( bitmap.Ok() ) { - if ( size.x == -1 ) + if ( size.x == wxDefaultSize.x ) size.x = bitmap.GetWidth() ; - if ( size.y == -1 ) + if ( size.y == wxDefaultSize.y ) size.y = bitmap.GetHeight() ; } @@ -63,7 +63,7 @@ bool wxStaticPicture::Create(wxWindow *parent, wxWindowID id, OriginalImage = Bitmap.ConvertToImage(); #endif - if ( id == -1 ) + if ( id == wxID_ANY ) m_windowId = (int)NewControlId(); else m_windowId = id;