From 256b8649ff5f7f9721878394e7cc5052129d3502 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 11 Sep 2003 12:52:20 +0000 Subject: [PATCH] Add longtool tip for a button in wxToolBar test Various warning suppressions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/generic.rsp | 4 +++- docs/toback24.txt | 34 ++++++++++++++++++++++++++++++++ docs/todo30.txt | 7 +------ samples/menu/menu.cpp | 4 ++-- samples/mobile/styles/styles.cpp | 6 +++--- samples/scroll/scroll.cpp | 2 +- samples/scrollsub/scrollsub.cpp | 4 ++-- samples/shaped/shaped.cpp | 12 +++++------ samples/taskbar/tbtest.cpp | 6 +++--- samples/toolbar/toolbar.cpp | 2 +- samples/treectrl/treetest.cpp | 19 ++++++++++-------- 11 files changed, 67 insertions(+), 33 deletions(-) diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 28660683d2..fa3bf33a7e 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -15,8 +15,10 @@ setup.h_vms regen build/bakefiles/*.bkl -build/bakefiles/Makefile +build/bakefiles/Bakefiles.bkgen +build/bakefiles/README build/bakefiles/*.py +build/bakefiles/*.mk build/bakefiles/compat/FORMATS.bkmanifest build/bakefiles/compat/README build/bakefiles/compat/wx24dsp.bkl diff --git a/docs/toback24.txt b/docs/toback24.txt index 0a83c4b0b1..a0f0758650 100644 --- a/docs/toback24.txt +++ b/docs/toback24.txt @@ -271,6 +271,40 @@ Checking in sizer.cpp; new revision: 1.71; previous revision: 1.70 +28. patch [ 771772 ] Crashes when setting icon tooltip longer than 63 characters + +Checking in window.cpp; +/pack/cvsroots/wxwindows/wxWindows/src/msw/window.cpp,v <-- window.cpp +new revision: 1.431; previous revision: 1.430 +done + +#if wxUSE_UNICODE + // in Unicode mode this is just what we need + ttText->lpszText = (wxChar *)ttip.c_str(); +#else // !Unicode + // Fix by dimitrishortcut: see patch 771772 + + // FIXME: szText has a max of 80 bytes, so limit the tooltip string + // length accordingly. Ideally lpszText should be used, but who + // would be responsible for freeing the buffer? + + // Maximum length of a tip is 39 characters. 39 is 80/2 minus 1 byte + // needed for NULL character. + size_t tipLength = wxMin(ttip.Len(), 39); + + // Convert to WideChar without adding the NULL character. The NULL + // character is added afterwards (Could have used ttip.Left(tipLength) + // and a cchMultiByte parameter of tipLength+1, but this is more + //efficient. + ::MultiByteToWideChar(CP_ACP, 0, ttip, tipLength, + (wchar_t *)ttText->szText, + sizeof(ttText->szText) / sizeof(wchar_t)); + + // Add the NULL character. + ttText->szText[tipLength*2+0] = '\0'; + ttText->szText[tipLength*2+1] = '\0'; +#endif // Unicode/!Unicode + TODO for 2.4 (items that are not backports) =========================================== diff --git a/docs/todo30.txt b/docs/todo30.txt index 9c80803e08..f6c46d24ba 100644 --- a/docs/todo30.txt +++ b/docs/todo30.txt @@ -80,9 +80,8 @@ Core we definitely need it for the users makefiles. - Properties/Member-Metadata, 2-Step Init with virtual create - TODO: still unclear what do we need exactly -- Tidy code and add comments to headers (preferably in +- Tidy code and add comments to headers (possibly in Doxygen/Javadoc style) @@ -152,12 +151,8 @@ Removal of old code In addition to wxCOMPATIBILITY code: -- wxProperty classes. -- All wxCOMPATIBILITY (1.X) code. -- contrib/src/canvas? - contrib/src/mmedia - contrib/src/applet? -- Old wxODBC code - Dialog Editor wxMiscellaneous diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 4d02ddac38..8e23b49843 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -876,7 +876,7 @@ void MyFrame::ShowContextMenu(const wxPoint& pos) #endif // 0 } -void MyFrame::OnTestNormal(wxCommandEvent& event) +void MyFrame::OnTestNormal(wxCommandEvent& WXUNUSED(event)) { wxLogMessage(_T("Normal item selected")); } @@ -919,7 +919,7 @@ void MyFrame::OnUpdateSubMenuRadio(wxUpdateUIEvent& event) event.Check(FALSE); } -void MyFrame::OnSize(wxSizeEvent& event) +void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { if ( !m_textctrl ) return; diff --git a/samples/mobile/styles/styles.cpp b/samples/mobile/styles/styles.cpp index 9593096ed5..cd92e50fe5 100644 --- a/samples/mobile/styles/styles.cpp +++ b/samples/mobile/styles/styles.cpp @@ -66,16 +66,16 @@ void MyFrame::CreateMyMenuBar() SetMenuBar( menu_bar ); } -void MyFrame::OnAbout( wxCommandEvent &event ) +void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) { } -void MyFrame::OnQuit( wxCommandEvent &event ) +void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) { Close( TRUE ); } -void MyFrame::OnCloseWindow( wxCloseEvent &event ) +void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) ) { Destroy(); } diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index 790c8eaa4a..0d43910962 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -318,7 +318,7 @@ void MyCanvas::OnAddButton( wxCommandEvent &WXUNUSED(event) ) wxLogMessage( wxT("-> Position after inserting %d %d"), pt.x, pt.y ); } -void MyCanvas::OnDeleteButton( wxCommandEvent &event ) +void MyCanvas::OnDeleteButton( wxCommandEvent &WXUNUSED(event) ) { wxLogMessage( wxT("Deleting button inserted with \"Add button\"...") ); wxWindow *win = FindWindow( ID_NEWBUTTON ); diff --git a/samples/scrollsub/scrollsub.cpp b/samples/scrollsub/scrollsub.cpp index 371c4f97a5..1f09dc1962 100644 --- a/samples/scrollsub/scrollsub.cpp +++ b/samples/scrollsub/scrollsub.cpp @@ -207,7 +207,7 @@ MyTopLabels::MyTopLabels( wxScrolledWindow *parent, wxWindowID id, const wxPoint m_owner = parent; } -void MyTopLabels::OnPaint( wxPaintEvent &event ) +void MyTopLabels::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc(this); @@ -241,7 +241,7 @@ MyRightLabels::MyRightLabels( wxScrolledWindow *parent, wxWindowID id, const wxP m_owner = parent; } -void MyRightLabels::OnPaint( wxPaintEvent &event ) +void MyRightLabels::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc(this); diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp index eefa2639db..a79b97abbf 100644 --- a/samples/shaped/shaped.cpp +++ b/samples/shaped/shaped.cpp @@ -182,7 +182,7 @@ void ShapedFrame::SetWindowShape() m_hasShape = SetShape(region); } -void ShapedFrame::OnDoubleClick(wxMouseEvent& evt) +void ShapedFrame::OnDoubleClick(wxMouseEvent& WXUNUSED(evt)) { if (m_hasShape) { @@ -205,13 +205,13 @@ void ShapedFrame::OnLeftDown(wxMouseEvent& evt) m_delta = wxPoint(dx, dy); } -void ShapedFrame::OnLeftUp(wxMouseEvent& evt) +void ShapedFrame::OnLeftUp(wxMouseEvent& WXUNUSED(evt)) { if (HasCapture()) { ReleaseMouse(); //printf("Mouse released\n"); -} + } } void ShapedFrame::OnMouseMove(wxMouseEvent& evt) @@ -225,18 +225,18 @@ void ShapedFrame::OnMouseMove(wxMouseEvent& evt) } } -void ShapedFrame::OnExit(wxMouseEvent& evt) +void ShapedFrame::OnExit(wxMouseEvent& WXUNUSED(evt)) { Close(); } -void ShapedFrame::OnPaint(wxPaintEvent& evt) +void ShapedFrame::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxPaintDC dc(this); dc.DrawBitmap(m_bmp, 0, 0, TRUE); } -void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& evt) +void ShapedFrame::OnWindowCreate(wxWindowCreateEvent& WXUNUSED(evt)) { SetWindowShape(); } diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp index 21ce173386..c989143edc 100644 --- a/samples/taskbar/tbtest.cpp +++ b/samples/taskbar/tbtest.cpp @@ -62,17 +62,17 @@ MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title, Init(); } -void MyDialog::OnOK(wxCommandEvent& event) +void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { Show(FALSE); } -void MyDialog::OnExit(wxCommandEvent& event) +void MyDialog::OnExit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } -void MyDialog::OnCloseWindow(wxCloseEvent& event) +void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { Destroy(); } diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 4071436847..d43dd1d3f2 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -330,7 +330,7 @@ void MyFrame::RecreateToolbar() toolBar->AddTool(wxID_COPY, _T("Copy"), toolBarBitmaps[3], _T("Toggle button 2"), wxITEM_CHECK); toolBar->AddTool(wxID_CUT, _T("Cut"), toolBarBitmaps[4], _T("Toggle/Untoggle help button")); toolBar->AddTool(wxID_PASTE, _T("Paste"), toolBarBitmaps[5], _T("Paste")); - toolBar->AddTool(wxID_PRINT, _T("Print"), toolBarBitmaps[6], _T("Delete this tool")); + toolBar->AddTool(wxID_PRINT, _T("Print"), toolBarBitmaps[6], _T("Delete this tool. This is a very long tooltip to test whether it does the right thing when the tooltip is more than Windows can cope with.")); toolBar->AddSeparator(); toolBar->AddTool(wxID_HELP, _T("Help"), toolBarBitmaps[7], _T("Help button"), wxITEM_CHECK); diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 034ef14ae7..897c30382d 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -435,12 +435,12 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event)) } } -void MyFrame::OnSelect(wxCommandEvent& event) +void MyFrame::OnSelect(wxCommandEvent& WXUNUSED(event)) { m_treeCtrl->SelectItem(m_treeCtrl->GetSelection()); } -void MyFrame::OnUnselect(wxCommandEvent& event) +void MyFrame::OnUnselect(wxCommandEvent& WXUNUSED(event)) { m_treeCtrl->UnselectAll(); } @@ -485,7 +485,7 @@ void MyFrame::OnRecreate(wxCommandEvent& event) m_treeCtrl->AddTestItemsToTree(5, 2); } -void MyFrame::OnSetImageSize(wxCommandEvent& event) +void MyFrame::OnSetImageSize(wxCommandEvent& WXUNUSED(event)) { int size = wxGetNumberFromUser(wxT("Enter the size for the images to use"), wxT("Size: "), @@ -498,7 +498,7 @@ void MyFrame::OnSetImageSize(wxCommandEvent& event) wxGetApp().SetShowImages(TRUE); } -void MyFrame::OnToggleImages(wxCommandEvent& event) +void MyFrame::OnToggleImages(wxCommandEvent& WXUNUSED(event)) { if ( wxGetApp().ShowImages() ) { @@ -512,7 +512,7 @@ void MyFrame::OnToggleImages(wxCommandEvent& event) } } -void MyFrame::OnToggleButtons(wxCommandEvent& event) +void MyFrame::OnToggleButtons(wxCommandEvent& WXUNUSED(event)) { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if ( wxGetApp().ShowButtons() ) @@ -528,12 +528,12 @@ void MyFrame::OnToggleButtons(wxCommandEvent& event) #endif } -void MyFrame::OnCollapseAndReset(wxCommandEvent& event) +void MyFrame::OnCollapseAndReset(wxCommandEvent& WXUNUSED(event)) { m_treeCtrl->CollapseAndReset(m_treeCtrl->GetRootItem()); } -void MyFrame::OnEnsureVisible(wxCommandEvent& event) +void MyFrame::OnEnsureVisible(wxCommandEvent& WXUNUSED(event)) { m_treeCtrl->DoEnsureVisible(); } @@ -667,9 +667,9 @@ void MyTreeCtrl::CreateImageList(int size) AssignImageList(images); } +#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) void MyTreeCtrl::CreateButtonsImageList(int size) { -#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if ( size == -1 ) { SetButtonsImageList(NULL); @@ -701,6 +701,9 @@ void MyTreeCtrl::CreateButtonsImageList(int size) } AssignButtonsImageList(images); +#else +void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size)) +{ #endif } -- 2.47.2