From: Robert Roebling Date: Wed, 4 Aug 1999 13:01:20 +0000 (+0000) Subject: Compile fixes for samples and dialoged, X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/33961d59b0fc1271fd7f12cf99819a552610269c Compile fixes for samples and dialoged, small optical improvements, distrib changes, link fix for treectrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/copy_src.bat b/distrib/msw/copy_src.bat index 15f2352211..13a133c5ab 100755 --- a/distrib/msw/copy_src.bat +++ b/distrib/msw/copy_src.bat @@ -116,13 +116,10 @@ copy *.cpp \wxmsw_dist\wxMSW\src\common cd .. cd html -md \wxgtk_dist\wxGTK\src\html -copy *.cpp \wxgtk_dist\wxGTK\src\html -copy *.h \wxgtk_dist\wxGTK\src\html -cd bitmaps -md \wxgtk_dist\wxGTK\src\html\bitmaps -copy *.xpm \wxgtk_dist\wxGTK\src\html\bitmaps -cd ..\.. +md \wxmsw_dist\wxMSW\src\html +copy *.cpp \wxmsw_dist\wxMSW\src\html +copy *.h \wxmsw_dist\wxMSW\src\html +cd .. cd generic md \wxmsw_dist\wxMSW\src\generic diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 39d202b99c..038d2e9bff 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -112,12 +112,10 @@ class wxMenu : public wxEvtHandler DECLARE_DYNAMIC_CLASS(wxMenu) public: -#ifdef WXWIN_COMPATIBILITY wxMenu( const wxString& title, const wxFunction func) { Init(title, 0, func); } -#endif wxMenu( long style ) { Init( wxEmptyString, style ); @@ -176,15 +174,16 @@ public: wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); } -#ifdef WXWIN_COMPATIBILITY wxFunction GetCallback() const { return m_callback; } void Callback(const wxFunction func) { m_callback = func; } + wxFunction m_callback; + +#ifdef WXWIN_COMPATIBILITY // compatibility: these functions are deprecated bool Enabled(int id) const { return IsEnabled(id); } bool Checked(int id) const { return IsChecked(id); } - wxFunction m_callback; #endif // WXWIN_COMPATIBILITY // implementation @@ -204,11 +203,8 @@ public: private: // common code for both constructors: void Init( const wxString& title, - long style -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func = (wxFunction) NULL -#endif - ); + long style, + const wxFunction func = (wxFunction) NULL ); wxString m_title; wxList m_items; diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index 39d202b99c..038d2e9bff 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -112,12 +112,10 @@ class wxMenu : public wxEvtHandler DECLARE_DYNAMIC_CLASS(wxMenu) public: -#ifdef WXWIN_COMPATIBILITY wxMenu( const wxString& title, const wxFunction func) { Init(title, 0, func); } -#endif wxMenu( long style ) { Init( wxEmptyString, style ); @@ -176,15 +174,16 @@ public: wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); } -#ifdef WXWIN_COMPATIBILITY wxFunction GetCallback() const { return m_callback; } void Callback(const wxFunction func) { m_callback = func; } + wxFunction m_callback; + +#ifdef WXWIN_COMPATIBILITY // compatibility: these functions are deprecated bool Enabled(int id) const { return IsEnabled(id); } bool Checked(int id) const { return IsChecked(id); } - wxFunction m_callback; #endif // WXWIN_COMPATIBILITY // implementation @@ -204,11 +203,8 @@ public: private: // common code for both constructors: void Init( const wxString& title, - long style -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func = (wxFunction) NULL -#endif - ); + long style, + const wxFunction func = (wxFunction) NULL ); wxString m_title; wxList m_items; diff --git a/include/wx/msw/menu.h b/include/wx/msw/menu.h index ed9641b35b..3e6aad81d7 100644 --- a/include/wx/msw/menu.h +++ b/include/wx/msw/menu.h @@ -37,13 +37,16 @@ class WXDLLEXPORT wxMenu : public wxEvtHandler public: // ctors & dtor -#ifdef WXWIN_COMPATIBILITY wxMenu(const wxString& title, const wxFunction func) { Init(title, func); } -#endif + + wxMenu( long WXUNUSED(style) ) + { + Init( wxEmptyString ); + } wxMenu(const wxString& title = wxEmptyString, long WXUNUSED(style) = 0) { @@ -143,24 +146,20 @@ public: size_t CopyAccels(wxAcceleratorEntry *accels) const; #endif // wxUSE_ACCEL -#ifdef WXWIN_COMPATIBILITY + wxFunction GetCallback() const { return m_callback; } void Callback(const wxFunction func) { m_callback = func; } + wxFunction m_callback; +#ifdef WXWIN_COMPATIBILITY // compatibility: these functions are deprecated bool Enabled(int id) const { return IsEnabled(id); } bool Checked(int id) const { return IsChecked(id); } -private: - wxFunction m_callback; #endif // WXWIN_COMPATIBILITY private: // common part of all ctors - void Init(const wxString& title -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func = NULL -#endif - ); + void Init(const wxString& title, const wxFunction func = NULL ); bool m_doBreak; diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index bd43837570..78c674dee3 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -433,16 +433,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio); panel = new wxPanel(m_notebook); - (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) ); + (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) ); m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) ); m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS ); - (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(200,10), wxSize(290,130) ); + (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(220,10), wxSize(270,130) ); #ifdef __WXMOTIF__ // No wrapping text in wxStaticText yet :-( (void)new wxStaticText( panel, -1, "Drag the slider!", - wxPoint(208,30), - wxSize(210, -1) + wxPoint(228,30), + wxSize(230, -1) ); #else (void)new wxStaticText( panel, -1, @@ -452,8 +452,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) "\n" "This is also supposed to demonstrate how\n" "to use static controls.\n", - wxPoint(208,25), - wxSize(250, 110) + wxPoint(228,25), + wxSize(230, 110) ); #endif m_spintext = new wxTextCtrl( panel, -1, "0", wxPoint(20,160), wxSize(80,-1) ); diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index e21460c41a..281efc5183 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -106,7 +106,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title, // VA cannot resolve this so: dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL, FALSE); #else - dc.GetTextExtent(message, &widthText, NULL); + dc.GetTextExtent(message, &widthText, (long*)NULL); #endif m_msg = new wxStaticText(this, -1, message); @@ -143,7 +143,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title, m_gauge = (wxGauge *)NULL; // create the estimated/remaining/total time zones if requested - m_elapsed = m_estimated = m_remaining = NULL; + m_elapsed = m_estimated = m_remaining = (wxStaticText*)NULL; int nTimeLabels = 0; if ( style & wxPD_ELAPSED_TIME ) @@ -224,6 +224,9 @@ wxProgressDialog::wxProgressDialog(wxString const &title, Show(TRUE); Enable(TRUE); // enable this window + + // Update the display (especially on X, GTK) + wxYield(); } wxStaticText *wxProgressDialog::CreateLabel(const wxString& text, diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index b41ead44f4..1fec1d74fc 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -638,11 +638,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) void wxMenu::Init( const wxString& title, - long style -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func -#endif - ) + long style, + const wxFunction func + ) { m_title = title; m_items.DeleteContents( TRUE ); @@ -657,9 +655,7 @@ wxMenu::Init( const wxString& title, m_menu = gtk_menu_new(); // Do not show! #endif -#ifdef WXWIN_COMPATIBILITY m_callback = func; -#endif m_eventHandler = this; m_clientData = (void*) NULL; diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index b41ead44f4..1fec1d74fc 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -638,11 +638,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) void wxMenu::Init( const wxString& title, - long style -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func -#endif - ) + long style, + const wxFunction func + ) { m_title = title; m_items.DeleteContents( TRUE ); @@ -657,9 +655,7 @@ wxMenu::Init( const wxString& title, m_menu = gtk_menu_new(); // Do not show! #endif -#ifdef WXWIN_COMPATIBILITY m_callback = func; -#endif m_eventHandler = this; m_clientData = (void*) NULL; diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index fee40a5cee..019415a9e8 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -78,11 +78,7 @@ static const int idMenuTitle = -2; // --------------------------------------------------------------------------- // Construct a menu with optional title (then use append) -void wxMenu::Init(const wxString& title -#ifdef WXWIN_COMPATIBILITY - , const wxFunction func -#endif - ) +void wxMenu::Init(const wxString& title, const wxFunction func ) { m_title = title; m_parent = NULL; @@ -102,9 +98,7 @@ void wxMenu::Init(const wxString& title AppendSeparator() ; } -#if WXWIN_COMPATIBILITY Callback(func); -#endif } // The wxWindow destructor will take care of deleting the submenus. @@ -537,14 +531,12 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event) { bool processed = FALSE; -#if WXWIN_COMPATIBILITY // Try a callback if (m_callback) { (void)(*(m_callback))(*this, event); processed = TRUE; } -#endif // WXWIN_COMPATIBILITY // Try the menu's event handler if ( !processed && GetEventHandler()) diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8363d6ca9f..2e4440df70 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -345,15 +345,14 @@ void wxTreeCtrl::SetStateImageList(wxImageList *imageList) SetAnyImageList(m_imageListState = imageList, TVSIL_STATE); } -size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, - bool recursively) const +// internal class for counting tree items + +class TraverseCounter : public wxTreeTraversal { - class TraverseCounter : public wxTreeTraversal - { - public: +public: TraverseCounter(const wxTreeCtrl *tree, const wxTreeItemId& root, - bool recursively) + bool recursively) : wxTreeTraversal(tree) { m_count = 0; @@ -370,9 +369,15 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, size_t GetCount() const { return m_count; } - private: +private: size_t m_count; - } counter(this, item, recursively); +}; + + +size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, + bool recursively) const +{ + TraverseCounter counter(this, item, recursively); return counter.GetCount(); } @@ -645,11 +650,11 @@ void wxTreeCtrl::SetItemCheck(const wxTreeItemId& item, bool check) DoSetItem(&tvItem); } -size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const +// internal class for getting the selected + +class TraverseSelections : public wxTreeTraversal { - class TraverseSelections : public wxTreeTraversal - { - public: +public: TraverseSelections(const wxTreeCtrl *tree, wxArrayTreeItemIds& selections) : wxTreeTraversal(tree), m_selections(selections) @@ -669,9 +674,13 @@ size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const return TRUE; } - private: +private: wxArrayTreeItemIds& m_selections; - } selector(this, selections); +}; + +size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const +{ + TraverseSelections selector(this, selections); return selections.GetCount(); } diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index 55a60b962c..da588d9349 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -2268,19 +2268,10 @@ void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event) * */ -#if defined(__WXGTK__) || defined(__WXMOTIF__) // I don't dare to delete it... - BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar) +// EVT_PAINT(EditorToolBar::OnPaint) END_EVENT_TABLE() -#else - -BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar) - EVT_PAINT(EditorToolBar::OnPaint) -END_EVENT_TABLE() - -#endif - EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style): wxToolBar(frame, -1, pos, size, style)