Applied patch [ 867158 ] Warning free gizmos

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-01-08 08:35:31 +00:00
parent 3f8b4a3fbe
commit ba597ca831
9 changed files with 135 additions and 67 deletions

View File

@@ -132,7 +132,7 @@ private:
}; };
typedef void (wxEvtHandler::*wxDynamicSashSplitEventFunction)(wxDynamicSashSplitEvent&); typedef void (wxEvtHandler::*wxDynamicSashSplitEventFunction)(wxDynamicSashSplitEvent&);
typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashSplitEvent&); typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashUnifyEvent&);
/* /*
wxDynamicSashWindow. See above. wxDynamicSashWindow. See above.

View File

@@ -154,6 +154,16 @@ public:
m_minCellSize = 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 )
{ 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: private:
wxWindow *m_parent; wxWindow *m_parent;
unsigned int m_maxRows, m_maxCols; unsigned int m_maxRows, m_maxCols;

View File

@@ -52,12 +52,12 @@ private:
IMPLEMENT_APP(Demo) IMPLEMENT_APP(Demo)
wxChar *HTML_content = wxChar *HTML_content =
wxT("<P><H1>wxDynamicSashWindow demo</H1>" wxT("<P><H1>wxDynamicSashWindow demo</H1>")
"<P>Here is an example of how you can use <TT>wxDynamicSashWindow</TT> to allow your users to " wxT("<P>Here is an example of how you can use <TT>wxDynamicSashWindow</TT> to allow your users to ")
"dynamically split and unify the views of your windows. Try dragging out a few splits " wxT("dynamically split and unify the views of your windows. Try dragging out a few splits ")
"and then reunifying the window." wxT("and then reunifying the window.")
"<P>Also, see the <TT>dynsash_switch</TT> sample for an example of an application which " wxT("<P>Also, see the <TT>dynsash_switch</TT> sample for an example of an application which ")
"manages the scrollbars provided by <TT>wxDynamicSashWindow</TT> itself."); wxT("manages the scrollbars provided by <TT>wxDynamicSashWindow</TT> itself.");
bool Demo::OnInit() { bool Demo::OnInit() {
wxInitAllImageHandlers(); wxInitAllImageHandlers();
@@ -78,8 +78,9 @@ bool Demo::OnInit() {
SashHtmlWindow::SashHtmlWindow(wxWindow *parent, wxWindowID id, SashHtmlWindow::SashHtmlWindow(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name) : const wxPoint& pos, const wxSize& size, long style, const wxString& name) :
wxHtmlWindow(parent, id, pos, size, style, name) { wxHtmlWindow(parent, id, pos, size, style, name) {
Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
(wxObjectEventFunction)(wxCommandEventFunction)(wxDynamicSashSplitEventFunction) &SashHtmlWindow::OnSplit); (wxEventFunction)
(wxDynamicSashSplitEventFunction)&SashHtmlWindow::OnSplit);
m_dyn_sash = parent; m_dyn_sash = parent;
} }
@@ -95,7 +96,7 @@ wxSize SashHtmlWindow::DoGetBestSize() const {
return wxHtmlWindow::GetBestSize(); return wxHtmlWindow::GetBestSize();
} }
void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& event) { void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) {
wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, -1); wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, -1);
html->SetPage(HTML_content); html->SetPage(HTML_content);
} }

View File

@@ -109,30 +109,60 @@ SwitchView::SwitchView(wxDynamicSashWindow *win) {
hscroll->SetEventHandler(this); hscroll->SetEventHandler(this);
vscroll->SetEventHandler(this); vscroll->SetEventHandler(this);
Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction)&SwitchView::OnSize); Connect(GetId(), wxEVT_SIZE, (wxObjectEventFunction)
Connect(m_choice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction)&SwitchView::OnChoice); (wxEventFunction)
Connect(m_view->GetId(), wxEVT_PAINT, (wxObjectEventFunction)&SwitchView::OnPaint); (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)&SwitchView::OnFocus); Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)&SwitchView::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)&SwitchView::OnScroll); (wxFocusEventFunction)&SwitchView::OnFocus);
Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)&SwitchView::OnScroll); Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)&SwitchView::OnScroll); (wxScrollEventFunction)&SwitchView::OnScroll);
Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)&SwitchView::OnScroll); Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&SwitchView::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)&SwitchView::OnScroll); (wxScrollEventFunction)&SwitchView::OnScroll);
Connect(-1, wxEVT_ERASE_BACKGROUND, (wxObjectEventFunction)&SwitchView::OnErase); 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)&SwitchView::OnSplit); Connect(-1, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)&SwitchView::OnUnify); (wxEventFunction)
(wxDynamicSashSplitEventFunction)&SwitchView::OnSplit);
Connect(-1, wxEVT_DYNAMIC_SASH_UNIFY, (wxObjectEventFunction)
(wxEventFunction)
(wxDynamicSashUnifyEventFunction)&SwitchView::OnUnify);
} }
wxSize SwitchView::DoGetBestSize() const { wxSize SwitchView::DoGetBestSize() const {
return wxSize(64, 64); return wxSize(64, 64);
} }
void SwitchView::OnSize(wxSizeEvent& event) { void SwitchView::OnSize(wxSizeEvent& WXUNUSED(event)) {
Layout(); Layout();
wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); 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); wxPaintDC dc(m_view);
wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); 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 // Do nothing
} }
void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) { void SwitchView::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) {
SwitchView *view = new SwitchView(m_dyn_sash); SwitchView *view = new SwitchView(m_dyn_sash);
view->m_choice->SetSelection(m_choice->GetSelection()); view->m_choice->SetSelection(m_choice->GetSelection());
@@ -189,7 +219,7 @@ void SwitchView::OnSplit(wxDynamicSashSplitEvent& event) {
vscroll->SetEventHandler(this); vscroll->SetEventHandler(this);
} }
void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) { void SwitchView::OnUnify(wxDynamicSashUnifyEvent& WXUNUSED(event)) {
wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this); wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this); wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this);
@@ -197,11 +227,11 @@ void SwitchView::OnUnify(wxDynamicSashUnifyEvent& event) {
vscroll->SetEventHandler(this); vscroll->SetEventHandler(this);
} }
void SwitchView::OnChoice(wxCommandEvent& event) { void SwitchView::OnChoice(wxCommandEvent& WXUNUSED(event)) {
m_view->Refresh(); m_view->Refresh();
} }
void SwitchView::OnScroll(wxScrollEvent& event) { void SwitchView::OnScroll(wxScrollEvent& WXUNUSED(event)) {
m_view->Refresh(); m_view->Refresh();
} }

View File

@@ -225,37 +225,37 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
Close(TRUE); Close(TRUE);
} }
void MyFrame::OnIncrement(wxCommandEvent& event) void MyFrame::OnIncrement(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnIncrement(); m_panel->OnIncrement();
} }
void MyFrame::OnDecrement(wxCommandEvent& event) void MyFrame::OnDecrement(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnDecrement(); m_panel->OnDecrement();
} }
void MyFrame::OnSetValue(wxCommandEvent& event) void MyFrame::OnSetValue(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnSetValue(); m_panel->OnSetValue();
} }
void MyFrame::OnAlignLeft(wxCommandEvent& event) void MyFrame::OnAlignLeft(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnAlignLeft(); m_panel->OnAlignLeft();
} }
void MyFrame::OnAlignCenter(wxCommandEvent& event) void MyFrame::OnAlignCenter(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnAlignCenter(); m_panel->OnAlignCenter();
} }
void MyFrame::OnAlignRight(wxCommandEvent& event) void MyFrame::OnAlignRight(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnAlignRight(); m_panel->OnAlignRight();
} }
void MyFrame::OnDrawFaded(wxCommandEvent& event) void MyFrame::OnDrawFaded(wxCommandEvent& WXUNUSED(event))
{ {
m_panel->OnDrawFaded(); m_panel->OnDrawFaded();
} }

View File

@@ -208,7 +208,7 @@ void MyFrame::OnPaint(wxPaintEvent& WXUNUSED(event) )
} }
} }
void MyFrame::OnCloseWindow(wxCloseEvent& event) void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{ {
Destroy(); Destroy();
} }

View File

@@ -313,13 +313,27 @@ bool wxDynamicSashWindowImpl::Create() {
m_container->SetEventHandler(this); m_container->SetEventHandler(this);
Connect(-1, wxEVT_SIZE, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnSize); Connect(-1, wxEVT_SIZE, (wxObjectEventFunction)
Connect(-1, wxEVT_PAINT, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnPaint); (wxEventFunction)
Connect(-1, wxEVT_MOTION, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); (wxSizeEventFunction)&wxDynamicSashWindowImpl::OnSize);
Connect(-1, wxEVT_ENTER_WINDOW, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnMouseMove); Connect(-1, wxEVT_PAINT, (wxObjectEventFunction)
Connect(-1, wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnLeave); (wxEventFunction)
Connect(-1, wxEVT_LEFT_DOWN, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnPress); (wxPaintEventFunction)&wxDynamicSashWindowImpl::OnPaint);
Connect(-1, wxEVT_LEFT_UP, (wxObjectEventFunction)&wxDynamicSashWindowImpl::OnRelease); 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; return TRUE;
} }
@@ -902,15 +916,33 @@ bool wxDynamicSashWindowLeaf::Create() {
m_hscroll->SetEventHandler(this); m_hscroll->SetEventHandler(this);
m_vscroll->SetEventHandler(this); m_vscroll->SetEventHandler(this);
Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnFocus); Connect(-1, wxEVT_SET_FOCUS, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (wxFocusEventFunction)&wxDynamicSashWindowLeaf::OnFocus);
Connect(-1, wxEVT_SCROLL_LINEUP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); Connect(-1, wxEVT_SCROLL_TOP, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_LINEDOWN, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_PAGEUP, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (wxScrollEventFunction)&wxDynamicSashWindowLeaf::OnScroll);
Connect(-1, wxEVT_SCROLL_PAGEDOWN, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); Connect(-1, wxEVT_SCROLL_BOTTOM, (wxObjectEventFunction)
Connect(-1, wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (wxEventFunction)
Connect(-1, wxEVT_SCROLL_THUMBRELEASE, (wxObjectEventFunction)&wxDynamicSashWindowLeaf::OnScroll); (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(); wxLayoutConstraints *layout = new wxLayoutConstraints();

View File

@@ -380,12 +380,9 @@ wxSize wxMultiCellSizer::CalcMin()
if (m_children.GetCount() == 0) if (m_children.GetCount() == 0)
return wxSize(10,10); return wxSize(10,10);
int m_minWidth = 0;
int m_minHeight = 0;
GetMinimums(); GetMinimums();
m_minWidth = Sum(m_maxWidth, m_cell_count.GetWidth()); int m_minWidth = Sum(m_maxWidth, m_cell_count.GetWidth());
m_minHeight = Sum(m_maxHeight, m_cell_count.GetHeight()); int m_minHeight = Sum(m_maxHeight, m_cell_count.GetHeight());
return wxSize( m_minWidth, m_minHeight ); return wxSize( m_minWidth, m_minHeight );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -298,20 +298,19 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
wxRect itemRect; wxRect itemRect;
int cy=0;
wxTreeItemId h, lastH; wxTreeItemId h, lastH;
for(h=GetFirstVisibleItem();h;h=GetNextVisible(h)) for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
{ {
if (GetBoundingRect(h, itemRect)) if (GetBoundingRect(h, itemRect))
{ {
cy = itemRect.GetTop(); int cy = itemRect.GetTop();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
lastH = h; lastH = h;
} }
} }
if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
{ {
cy = itemRect.GetBottom(); int cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
} }
} }
@@ -508,13 +507,12 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
wxRect itemRect; wxRect itemRect;
int cy=0;
wxTreeItemId h, lastH; wxTreeItemId h, lastH;
for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h)) for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h))
{ {
if (m_treeCtrl->GetBoundingRect(h, itemRect)) if (m_treeCtrl->GetBoundingRect(h, itemRect))
{ {
cy = itemRect.GetTop(); int cy = itemRect.GetTop();
wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight()); wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
lastH = h; lastH = h;
@@ -526,7 +524,7 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
} }
if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect)) if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
{ {
cy = itemRect.GetBottom(); int cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
} }
} }