From: Julian Smart Date: Thu, 8 Jan 2004 08:35:31 +0000 (+0000) Subject: Applied patch [ 867158 ] Warning free gizmos X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ba597ca8315df299a603990df4e0f334e3f21f6a?hp=3f8b4a3fbe730e5843de98529cc2c1b03a7910ef Applied patch [ 867158 ] Warning free gizmos git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/include/wx/gizmos/dynamicsash.h b/contrib/include/wx/gizmos/dynamicsash.h index aebaaa595d..2a37a2be3c 100644 --- a/contrib/include/wx/gizmos/dynamicsash.h +++ b/contrib/include/wx/gizmos/dynamicsash.h @@ -132,7 +132,7 @@ private: }; typedef void (wxEvtHandler::*wxDynamicSashSplitEventFunction)(wxDynamicSashSplitEvent&); -typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashSplitEvent&); +typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashUnifyEvent&); /* wxDynamicSashWindow. See above. diff --git a/contrib/include/wx/gizmos/multicell.h b/contrib/include/wx/gizmos/multicell.h index f4cab3fffb..a22b9871ca 100644 --- a/contrib/include/wx/gizmos/multicell.h +++ b/contrib/include/wx/gizmos/multicell.h @@ -154,6 +154,16 @@ public: 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 ) + { wxFlexGridSizer::Add( window, proportion, flag, border, userData); } + void Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ) + { wxFlexGridSizer::Add( sizer, proportion, flag, border, userData); } + void Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ) + { wxFlexGridSizer::Add( width, height, proportion, flag, border, userData); } + void Add( wxSizerItem *item ) + { wxFlexGridSizer::Add( item); } + private: wxWindow *m_parent; unsigned int m_maxRows, m_maxCols; diff --git a/contrib/samples/gizmos/dynsash/dynsash.cpp b/contrib/samples/gizmos/dynsash/dynsash.cpp index e31b11c036..8c38649dc7 100644 --- a/contrib/samples/gizmos/dynsash/dynsash.cpp +++ b/contrib/samples/gizmos/dynsash/dynsash.cpp @@ -52,12 +52,12 @@ private: IMPLEMENT_APP(Demo) wxChar *HTML_content = -wxT("

wxDynamicSashWindow demo

" -"

Here is an example of how you can use wxDynamicSashWindow to allow your users to " -"dynamically split and unify the views of your windows. Try dragging out a few splits " -"and then reunifying the window." -"

Also, see the dynsash_switch sample for an example of an application which " -"manages the scrollbars provided by wxDynamicSashWindow itself."); +wxT("

wxDynamicSashWindow demo

") +wxT("

Here is an example of how you can use wxDynamicSashWindow to allow your users to ") +wxT("dynamically split and unify the views of your windows. Try dragging out a few splits ") +wxT("and then reunifying the window.") +wxT("

Also, see the dynsash_switch sample for an example of an application which ") +wxT("manages the scrollbars provided by wxDynamicSashWindow itself."); bool Demo::OnInit() { wxInitAllImageHandlers(); @@ -78,8 +78,9 @@ bool Demo::OnInit() { 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)(wxCommandEventFunction)(wxDynamicSashSplitEventFunction) &SashHtmlWindow::OnSplit); + Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) + (wxEventFunction) + (wxDynamicSashSplitEventFunction)&SashHtmlWindow::OnSplit); m_dyn_sash = parent; } @@ -95,7 +96,7 @@ wxSize SashHtmlWindow::DoGetBestSize() const { return wxHtmlWindow::GetBestSize(); } -void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& event) { +void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) { wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, -1); 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 1ac49a9eda..50db96f4ac 100644 --- a/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp +++ b/contrib/samples/gizmos/dynsash_switch/dynsash_switch.cpp @@ -109,30 +109,60 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) { hscroll->SetEventHandler(this); vscroll->SetEventHandler(this); - Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction)&SwitchView::OnSize); - Connect(m_choice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction)&SwitchView::OnChoice); - Connect(m_view->GetId(), wxEVT_PAINT, (wxObjectEventFunction)&SwitchView::OnPaint); - - Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)&SwitchView::OnFocus); - Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)&SwitchView::OnScroll); - Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)&SwitchView::OnErase); - - Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)&SwitchView::OnSplit); - Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)&SwitchView::OnUnify); + Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction) + (wxEventFunction) + (wxSizeEventFunction)&SwitchView::OnSize); + Connect(m_choice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) + (wxEventFunction) + (wxCommandEventFunction)&SwitchView::OnChoice); + Connect(m_view->GetId(), wxEVT_PAINT, (wxObjectEventFunction) + (wxEventFunction) + (wxPaintEventFunction)&SwitchView::OnPaint); + + Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction) + (wxEventFunction) + (wxFocusEventFunction)&SwitchView::OnFocus); + Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&SwitchView::OnScroll); + Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction) + (wxEventFunction) + (wxEraseEventFunction)&SwitchView::OnErase); + + Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction) + (wxEventFunction) + (wxDynamicSashSplitEventFunction)&SwitchView::OnSplit); + Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction) + (wxEventFunction) + (wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify); } wxSize SwitchView::DoGetBestSize() const { return wxSize(64, 64); } -void SwitchView::OnSize(wxSizeEvent& event) { +void SwitchView::OnSize(wxSizeEvent& WXUNUSED(event)) { Layout(); wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); @@ -153,7 +183,7 @@ void SwitchView::OnSize(wxSizeEvent& event) { } } -void SwitchView::OnPaint(wxPaintEvent& event) { +void SwitchView::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(m_view); wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); @@ -174,11 +204,11 @@ void SwitchView::OnPaint(wxPaintEvent& event) { } } -void SwitchView::OnErase(wxEraseEvent& event) { +void SwitchView::OnErase(wxEraseEvent& WXUNUSED(event)) { // Do nothing } -void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) { +void SwitchView::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) { SwitchView *view = new SwitchView(m_dyn_sash); view->m_choice->SetSelection(m_choice->GetSelection()); @@ -189,7 +219,7 @@ void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) { vscroll->SetEventHandler(this); } -void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) { +void SwitchView::OnUnify(wxDynamicSashUnifyEvent& WXUNUSED(event)) { wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this); @@ -197,11 +227,11 @@ void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) { vscroll->SetEventHandler(this); } -void SwitchView::OnChoice(wxCommandEvent& event) { +void SwitchView::OnChoice(wxCommandEvent& WXUNUSED(event)) { m_view->Refresh(); } -void SwitchView::OnScroll(wxScrollEvent& event) { +void SwitchView::OnScroll(wxScrollEvent& WXUNUSED(event)) { m_view->Refresh(); } diff --git a/contrib/samples/gizmos/led/led.cpp b/contrib/samples/gizmos/led/led.cpp index 4818281f8b..356be602f3 100644 --- a/contrib/samples/gizmos/led/led.cpp +++ b/contrib/samples/gizmos/led/led.cpp @@ -225,37 +225,37 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) Close(TRUE); } -void MyFrame::OnIncrement(wxCommandEvent& event) +void MyFrame::OnIncrement(wxCommandEvent& WXUNUSED(event)) { m_panel->OnIncrement(); } -void MyFrame::OnDecrement(wxCommandEvent& event) +void MyFrame::OnDecrement(wxCommandEvent& WXUNUSED(event)) { m_panel->OnDecrement(); } -void MyFrame::OnSetValue(wxCommandEvent& event) +void MyFrame::OnSetValue(wxCommandEvent& WXUNUSED(event)) { m_panel->OnSetValue(); } -void MyFrame::OnAlignLeft(wxCommandEvent& event) +void MyFrame::OnAlignLeft(wxCommandEvent& WXUNUSED(event)) { m_panel->OnAlignLeft(); } -void MyFrame::OnAlignCenter(wxCommandEvent& event) +void MyFrame::OnAlignCenter(wxCommandEvent& WXUNUSED(event)) { m_panel->OnAlignCenter(); } -void MyFrame::OnAlignRight(wxCommandEvent& event) +void MyFrame::OnAlignRight(wxCommandEvent& WXUNUSED(event)) { m_panel->OnAlignRight(); } -void MyFrame::OnDrawFaded(wxCommandEvent& event) +void MyFrame::OnDrawFaded(wxCommandEvent& WXUNUSED(event)) { m_panel->OnDrawFaded(); } diff --git a/contrib/samples/gizmos/multicell/mtest.cpp b/contrib/samples/gizmos/multicell/mtest.cpp index e9c6db6b39..a35ae93898 100644 --- a/contrib/samples/gizmos/multicell/mtest.cpp +++ b/contrib/samples/gizmos/multicell/mtest.cpp @@ -208,7 +208,7 @@ void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event) ) } } -void MyFrame::OnCloseWindow(wxCloseEvent& event) +void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { Destroy(); } diff --git a/contrib/src/gizmos/dynamicsash.cpp b/contrib/src/gizmos/dynamicsash.cpp index 365955d8f8..32d3e93822 100644 --- a/contrib/src/gizmos/dynamicsash.cpp +++ b/contrib/src/gizmos/dynamicsash.cpp @@ -313,13 +313,27 @@ bool wxDynamicSashWindowImpl::Create() { m_container->SetEventHandler(this); - Connect(-1, wxEVT_SIZE, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnSize); - Connect(-1, wxEVT_PAINT, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnPaint); - Connect(-1, wxEVT_MOTION, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); - Connect(-1, wxEVT_ENTER_WINDOW, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); - Connect(-1, wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnLeave); - Connect(-1, wxEVT_LEFT_DOWN, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnPress); - Connect(-1, wxEVT_LEFT_UP, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnRelease); + Connect(-1, wxEVT_SIZE, (wxObjectEventFunction) + (wxEventFunction) + (wxSizeEventFunction)&wxDynamicSashWindowImpl::OnSize); + Connect(-1, wxEVT_PAINT, (wxObjectEventFunction) + (wxEventFunction) + (wxPaintEventFunction)&wxDynamicSashWindowImpl::OnPaint); + Connect(-1, wxEVT_MOTION, (wxObjectEventFunction) + (wxEventFunction) + (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); + Connect(-1, wxEVT_ENTER_WINDOW, (wxObjectEventFunction) + (wxEventFunction) + (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); + Connect(-1, wxEVT_LEAVE_WINDOW, (wxObjectEventFunction) + (wxEventFunction) + (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnLeave); + Connect(-1, wxEVT_LEFT_DOWN, (wxObjectEventFunction) + (wxEventFunction) + (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnPress); + Connect(-1, wxEVT_LEFT_UP, (wxObjectEventFunction) + (wxEventFunction) + (wxMouseEventFunction)&wxDynamicSashWindowImpl::OnRelease); return TRUE; } @@ -902,15 +916,33 @@ bool wxDynamicSashWindowLeaf::Create() { m_hscroll->SetEventHandler(this); m_vscroll->SetEventHandler(this); - Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnFocus); - Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); - Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction) + (wxEventFunction) + (wxFocusEventFunction)&wxDynamicSashWindowLeaf::OnFocus); + Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); + Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction) + (wxEventFunction) + (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll); } wxLayoutConstraints *layout = new wxLayoutConstraints(); diff --git a/contrib/src/gizmos/multicell.cpp b/contrib/src/gizmos/multicell.cpp index 49ece0103f..d50fd58826 100644 --- a/contrib/src/gizmos/multicell.cpp +++ b/contrib/src/gizmos/multicell.cpp @@ -380,12 +380,9 @@ wxSize wxMultiCellSizer::CalcMin() if (m_children.GetCount() == 0) return wxSize(10,10); - int m_minWidth = 0; - int m_minHeight = 0; - GetMinimums(); - m_minWidth = Sum(m_maxWidth, m_cell_count.GetWidth()); - m_minHeight = Sum(m_maxHeight, m_cell_count.GetHeight()); + 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 ); } //--------------------------------------------------------------------------- diff --git a/contrib/src/gizmos/splittree.cpp b/contrib/src/gizmos/splittree.cpp index 8a16309acf..87b3668ffd 100644 --- a/contrib/src/gizmos/splittree.cpp +++ b/contrib/src/gizmos/splittree.cpp @@ -298,20 +298,19 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event) wxSize clientSize = GetClientSize(); wxRect itemRect; - int cy=0; wxTreeItemId h, lastH; for(h=GetFirstVisibleItem();h;h=GetNextVisible(h)) { if (GetBoundingRect(h, itemRect)) { - cy = itemRect.GetTop(); + int cy = itemRect.GetTop(); dc.DrawLine(0, cy, clientSize.x, cy); lastH = h; } } if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) { - cy = itemRect.GetBottom(); + int cy = itemRect.GetBottom(); dc.DrawLine(0, cy, clientSize.x, cy); } } @@ -508,13 +507,12 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) wxSize clientSize = GetClientSize(); wxRect itemRect; - int cy=0; wxTreeItemId h, lastH; for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h)) { if (m_treeCtrl->GetBoundingRect(h, itemRect)) { - cy = itemRect.GetTop(); + int cy = itemRect.GetTop(); wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight()); lastH = h; @@ -526,7 +524,7 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) } if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect)) { - cy = itemRect.GetBottom(); + int cy = itemRect.GetBottom(); dc.DrawLine(0, cy, clientSize.x, cy); } }