Remove no-op uses of wxNO_FULL_REPAINT_ON_RESIZE
This behaviour has been the default and this constant 0 since
e441e1f4e8 which was over 16 years ago.
Closes https://github.com/wxWidgets/wxWidgets/pull/1601
			
			
This commit is contained in:
		
				
					committed by
					
						 Vadim Zeitlin
						Vadim Zeitlin
					
				
			
			
				
	
			
			
			
						parent
						
							bf4640f1d8
						
					
				
				
					commit
					18e05aeeee
				
			| @@ -115,8 +115,7 @@ MyFrame::MyFrame(wxWindow *parent, | ||||
|                  const wxPoint& pos, | ||||
|                  const wxSize& size, | ||||
|                  const long style) | ||||
|        : wxFrame(parent, id, title, pos, size, | ||||
|                           style | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|        : wxFrame(parent, id, title, pos, size, style) | ||||
| { | ||||
|     SetIcon(wxICON(sample)); | ||||
|  | ||||
|   | ||||
| @@ -172,8 +172,7 @@ wxEND_EVENT_TABLE() | ||||
| // My frame constructor | ||||
| MyFrame::MyFrame() | ||||
|        : wxFrame(NULL, wxID_ANY, "wxCollapsiblePane sample", | ||||
|                  wxDefaultPosition, wxSize(420, 300), | ||||
|                  wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|                  wxDefaultPosition, wxSize(420, 300)) | ||||
| { | ||||
|     SetIcon(wxICON(sample)); | ||||
|  | ||||
|   | ||||
| @@ -524,7 +524,7 @@ wxEND_EVENT_TABLE() | ||||
|  | ||||
| MyCanvas::MyCanvas(MyFrame *parent) | ||||
|         : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, | ||||
|                            wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|                            wxHSCROLL | wxVSCROLL) | ||||
| { | ||||
|     m_owner = parent; | ||||
|     m_show = File_ShowDefault; | ||||
| @@ -2162,8 +2162,7 @@ wxEND_EVENT_TABLE() | ||||
|  | ||||
| // frame constructor | ||||
| MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) | ||||
|        : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size, | ||||
|                  wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|        : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) | ||||
| { | ||||
|     // set the frame icon | ||||
|     SetIcon(wxICON(sample)); | ||||
|   | ||||
| @@ -363,9 +363,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar) | ||||
| // Define a constructor for my canvas | ||||
| MyCanvas::MyCanvas(wxFrame *parent, const wxPoint& pos, const wxSize& size) | ||||
|         : wxScrolledWindow(parent, wxID_ANY, pos, size, | ||||
|                            wxSUNKEN_BORDER | | ||||
|                            wxNO_FULL_REPAINT_ON_RESIZE | | ||||
|                            wxVSCROLL | wxHSCROLL), | ||||
|                            wxSUNKEN_BORDER | wxVSCROLL | wxHSCROLL), | ||||
|           MenuEventLogger("canvas", parent) | ||||
|  | ||||
| { | ||||
|   | ||||
| @@ -954,15 +954,10 @@ static const wxString _fs_windowstyle_labels[] = { | ||||
|     "wxTRANSPARENT_WINDOW", | ||||
|     "wxTAB_TRAVERSAL", | ||||
|     "wxWANTS_CHARS", | ||||
| #if wxNO_FULL_REPAINT_ON_RESIZE | ||||
|     "wxNO_FULL_REPAINT_ON_RESIZE", | ||||
| #endif | ||||
|     "wxVSCROLL", | ||||
|     "wxALWAYS_SHOW_SB", | ||||
|     "wxCLIP_CHILDREN", | ||||
| #if wxFULL_REPAINT_ON_RESIZE | ||||
|     "wxFULL_REPAINT_ON_RESIZE", | ||||
| #endif | ||||
|     }; | ||||
|  | ||||
| static const long _fs_windowstyle_values[] = { | ||||
| @@ -974,15 +969,10 @@ static const long _fs_windowstyle_values[] = { | ||||
|     wxTRANSPARENT_WINDOW, | ||||
|     wxTAB_TRAVERSAL, | ||||
|     wxWANTS_CHARS, | ||||
| #if wxNO_FULL_REPAINT_ON_RESIZE | ||||
|     wxNO_FULL_REPAINT_ON_RESIZE, | ||||
| #endif | ||||
|     wxVSCROLL, | ||||
|     wxALWAYS_SHOW_SB, | ||||
|     wxCLIP_CHILDREN, | ||||
| #if wxFULL_REPAINT_ON_RESIZE | ||||
|     wxFULL_REPAINT_ON_RESIZE | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| static const wxString _fs_framestyle_labels[] = { | ||||
| @@ -1982,7 +1972,7 @@ void FormMain::CreateGrid( int style, int extraStyle ) | ||||
| FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size) : | ||||
|            wxFrame((wxFrame *)NULL, -1, title, pos, size, | ||||
|                (wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION| | ||||
|                 wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) ) | ||||
|                 wxTAB_TRAVERSAL|wxCLOSE_BOX) ) | ||||
| { | ||||
|     SetIcon(wxICON(sample)); | ||||
|  | ||||
|   | ||||
| @@ -46,7 +46,6 @@ bool MyApp::OnInit(void) | ||||
|  | ||||
|   frame = new MyFrame(NULL, wxID_ANY, "Sash Demo", wxPoint(0, 0), wxSize(500, 400), | ||||
|                       wxDEFAULT_FRAME_STYLE | | ||||
|                       wxNO_FULL_REPAINT_ON_RESIZE | | ||||
|                       wxHSCROLL | wxVSCROLL); | ||||
|  | ||||
|   // Give it an icon (this is ignored in MDI mode: uses resources) | ||||
| @@ -223,9 +222,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) | ||||
| { | ||||
|       // Make another frame, containing a canvas | ||||
|       MyChild *subframe = new MyChild(frame, "Canvas Frame", | ||||
|                                       wxPoint(10, 10), wxSize(300, 300), | ||||
|                                       wxDEFAULT_FRAME_STYLE | | ||||
|                                       wxNO_FULL_REPAINT_ON_RESIZE); | ||||
|                                       wxPoint(10, 10), wxSize(300, 300)); | ||||
|  | ||||
|       subframe->SetTitle(wxString::Format("Canvas Frame %d", winNumber)); | ||||
|       winNumber ++; | ||||
| @@ -282,8 +279,7 @@ wxEND_EVENT_TABLE() | ||||
|  | ||||
| // Define a constructor for my canvas | ||||
| MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) | ||||
|         : wxScrolledWindow(parent, wxID_ANY, pos, size, | ||||
|                            wxSUNKEN_BORDER | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|         : wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER) | ||||
| { | ||||
|     SetBackgroundColour(* wxWHITE); | ||||
| } | ||||
| @@ -350,9 +346,8 @@ wxBEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame) | ||||
|   EVT_MENU(SASHTEST_CHILD_QUIT, MyChild::OnQuit) | ||||
| wxEND_EVENT_TABLE() | ||||
|  | ||||
| MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, | ||||
| const long style): | ||||
|   wxMDIChildFrame(parent, wxID_ANY, title, pos, size, style) | ||||
| MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size): | ||||
|   wxMDIChildFrame(parent, wxID_ANY, title, pos, size) | ||||
| { | ||||
|   canvas = NULL; | ||||
|   my_children.Append(this); | ||||
|   | ||||
| @@ -54,7 +54,7 @@ class MyChild: public wxMDIChildFrame | ||||
| { | ||||
|   public: | ||||
|     MyCanvas *canvas; | ||||
|     MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); | ||||
|     MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size); | ||||
|     ~MyChild(void); | ||||
|     void OnActivate(wxActivateEvent& event); | ||||
|     void OnQuit(wxCommandEvent& event); | ||||
|   | ||||
| @@ -214,8 +214,7 @@ wxEND_EVENT_TABLE() | ||||
| // My frame constructor | ||||
| MyFrame::MyFrame() | ||||
|        : wxFrame(NULL, wxID_ANY, "wxSplitterWindow sample", | ||||
|                  wxDefaultPosition, wxSize(420, 300), | ||||
|                  wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|                  wxDefaultPosition, wxSize(420, 300)) | ||||
| { | ||||
|     SetIcon(wxICON(sample)); | ||||
|  | ||||
| @@ -551,7 +550,7 @@ void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event) | ||||
|  | ||||
| MyCanvas::MyCanvas(wxWindow* parent, bool mirror) | ||||
|         : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, | ||||
|                            wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|                            wxHSCROLL | wxVSCROLL) | ||||
| { | ||||
|     m_mirror = mirror; | ||||
|     SetScrollbars(20, 20, 5, 5); | ||||
|   | ||||
| @@ -291,8 +291,7 @@ wxBEGIN_EVENT_TABLE (AppFrame, wxFrame) | ||||
| wxEND_EVENT_TABLE () | ||||
|  | ||||
| AppFrame::AppFrame (const wxString &title) | ||||
|         : wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550), | ||||
|                     wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) | ||||
|         : wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550)) | ||||
| { | ||||
|     SetIcon(wxICON(sample)); | ||||
|  | ||||
|   | ||||
| @@ -98,7 +98,7 @@ public: | ||||
|             const wxString& title = "wxToolBar Sample", | ||||
|             const wxPoint& pos = wxDefaultPosition, | ||||
|             const wxSize& size = wxDefaultSize, | ||||
|             long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE); | ||||
|             long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN); | ||||
|     virtual ~MyFrame(); | ||||
|  | ||||
|     void PopulateToolbar(wxToolBarBase* toolBar); | ||||
|   | ||||
| @@ -1311,7 +1311,6 @@ WidgetsPage::WidgetsPage(WidgetsBookCtrl *book, | ||||
|                          const char *const icon[]) | ||||
|            : wxPanel(book, wxID_ANY, | ||||
|                      wxDefaultPosition, wxDefaultSize, | ||||
|                      wxNO_FULL_REPAINT_ON_RESIZE | | ||||
|                      wxCLIP_CHILDREN | | ||||
|                      wxTAB_TRAVERSAL) | ||||
| { | ||||
|   | ||||
| @@ -9400,47 +9400,65 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) | ||||
|     wxCoord w, h; | ||||
|     dc.SetFont( GetLabelFont() ); | ||||
|  | ||||
|     bool noContent = (extentMax == 0); | ||||
|     bool addMargin = true; | ||||
|  | ||||
|     if ( column ) | ||||
|     { | ||||
|         if ( m_useNativeHeader ) | ||||
|         { | ||||
|             w = GetGridColHeader()->GetColumnTitleWidth(colOrRow); | ||||
|             wxHeaderCtrl* header = GetGridColHeader(); | ||||
|             w = header->GetColumnTitleWidth(colOrRow); | ||||
|  | ||||
|             // GetColumnTitleWidth already adds margins internally. | ||||
|             addMargin = false; | ||||
|             h = 0; | ||||
|  | ||||
|             // GetColumnTitleWidth uses GetTextExtent and not | ||||
|             // GetMultiLineTextExtent so use the same funtion. | ||||
|             if ( header->GetTextExtent(GetColLabelValue(colOrRow)).x > 0 ) | ||||
|                 noContent = false; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             dc.GetMultiLineTextExtent( GetColLabelValue(colOrRow), &w, &h ); | ||||
|             if ( GetColLabelTextOrientation() == wxVERTICAL ) | ||||
|                 w = h; | ||||
|  | ||||
|             noContent = noContent && (w == 0); | ||||
|         } | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         dc.GetMultiLineTextExtent( GetRowLabelValue(colOrRow), &w, &h ); | ||||
|         noContent = noContent && (h == 0); | ||||
|     } | ||||
|  | ||||
|     extent = column ? w : h; | ||||
|     if ( extent > extentMax ) | ||||
|         extentMax = extent; | ||||
|  | ||||
|     if ( !extentMax ) | ||||
|     if ( noContent ) | ||||
|     { | ||||
|         // empty column - give default extent (notice that if extentMax is less | ||||
|         // than default extent but != 0, it's OK) | ||||
|         extentMax = column ? m_defaultColWidth : m_defaultRowHeight; | ||||
|     } | ||||
|     else if ( addMargin ) | ||||
|     { | ||||
|         // leave some space around text | ||||
|         if ( column ) | ||||
|             extentMax += 10; | ||||
|     else | ||||
|             extentMax += 6; | ||||
|     { | ||||
|         const int margin = column ? 10 : 6; | ||||
|  | ||||
|         // The current extentMax is the max extent of columns/rows values | ||||
|         // so always add margin. | ||||
|         extentMax += margin; | ||||
|  | ||||
|         // The current extent is the extent of the column/row title. | ||||
|         extent = column ? w : h; | ||||
|  | ||||
|         // Add the margin to the current extent only if needed. | ||||
|         if ( addMargin ) | ||||
|             extent += margin; | ||||
|  | ||||
|         // Find out the final max extent when the margin affected to the max extent | ||||
|         // and the current extent. | ||||
|         if ( extent > extentMax ) | ||||
|             extentMax = extent; | ||||
|     } | ||||
|  | ||||
|     if ( column ) | ||||
|   | ||||
| @@ -505,7 +505,6 @@ void wxPropertyGridManager::Init1() | ||||
|  | ||||
| // These flags are always used in wxPropertyGrid integrated in wxPropertyGridManager. | ||||
| #define wxPG_MAN_PROPGRID_FORCED_FLAGS (  wxBORDER_THEME | \ | ||||
|                                           wxNO_FULL_REPAINT_ON_RESIZE| \ | ||||
|                                           wxCLIP_CHILDREN) | ||||
|  | ||||
| // Which flags can be passed to underlying wxPropertyGrid. | ||||
|   | ||||
| @@ -16,9 +16,11 @@ | ||||
|  | ||||
| #ifndef WX_PRECOMP | ||||
|     #include "wx/app.h" | ||||
|     #include "wx/dcclient.h" | ||||
| #endif // WX_PRECOMP | ||||
|  | ||||
| #include "wx/grid.h" | ||||
| #include "wx/headerctrl.h" | ||||
| #include "testableframe.h" | ||||
| #include "asserthelper.h" | ||||
| #include "wx/uiaction.h" | ||||
| @@ -70,18 +72,21 @@ private: | ||||
|         WXUISIM_TEST( ReadOnly ); | ||||
|         WXUISIM_TEST( ResizeScrolledHeader ); | ||||
|         WXUISIM_TEST( ColumnMinWidth ); | ||||
|         WXUISIM_TEST( AutoSizeColumn ); | ||||
|         CPPUNIT_TEST( PseudoTest_NativeHeader ); | ||||
|         NONGTK_TEST( LabelClick ); | ||||
|         NONGTK_TEST( SortClick ); | ||||
|         CPPUNIT_TEST( ColumnOrder ); | ||||
|         WXUISIM_TEST( ResizeScrolledHeader ); | ||||
|         WXUISIM_TEST( ColumnMinWidth ); | ||||
|         WXUISIM_TEST( AutoSizeColumn ); | ||||
|         CPPUNIT_TEST( DeleteAndAddRowCol ); | ||||
|         CPPUNIT_TEST( PseudoTest_NativeLabels ); | ||||
|         NONGTK_TEST( LabelClick ); | ||||
|         NONGTK_TEST( SortClick ); | ||||
|         CPPUNIT_TEST( ColumnOrder ); | ||||
|         WXUISIM_TEST( WindowAsEditorControl ); | ||||
|         WXUISIM_TEST( AutoSizeColumn ); | ||||
|     CPPUNIT_TEST_SUITE_END(); | ||||
|  | ||||
|     void CellEdit(); | ||||
| @@ -108,10 +113,23 @@ private: | ||||
|     void WindowAsEditorControl(); | ||||
|     void ResizeScrolledHeader(); | ||||
|     void ColumnMinWidth(); | ||||
|     void AutoSizeColumn(); | ||||
|     void PseudoTest_NativeHeader() { ms_nativeheader = true; } | ||||
|     void PseudoTest_NativeLabels() { ms_nativeheader = false; | ||||
|                                      ms_nativelabels = true; } | ||||
|  | ||||
|     // The helper function to determine the width of the column label depending | ||||
|     // on whether the native column is used. | ||||
|     int GetColumnLabelWidth(wxClientDC& dc, int col, int margin) const | ||||
|     { | ||||
|         if (ms_nativeheader) | ||||
|             return m_grid->GetGridColHeader()->GetColumnTitleWidth(col); | ||||
|  | ||||
|         int w, h; | ||||
|         dc.GetMultiLineTextExtent(m_grid->GetColLabelValue(col), &w, &h); | ||||
|         return w + margin; | ||||
|     } | ||||
|  | ||||
|     static bool ms_nativeheader; | ||||
|     static bool ms_nativelabels; | ||||
|  | ||||
| @@ -950,4 +968,91 @@ void GridTestCase::ColumnMinWidth() | ||||
| #endif | ||||
| } | ||||
|  | ||||
| void GridTestCase::AutoSizeColumn() | ||||
| { | ||||
|     // Hardcoded margin for columns. | ||||
|     const int margin = 10; | ||||
|     int maxWidth; | ||||
|  | ||||
|     wxGridCellAttr *attr = m_grid->GetOrCreateCellAttr(0, 0); | ||||
|     wxGridCellRenderer *renderer = attr->GetRenderer(m_grid, 0, 0); | ||||
|     REQUIRE(renderer != NULL); | ||||
|  | ||||
|     wxClientDC dcCell(m_grid->GetGridWindow()); | ||||
|  | ||||
|     wxClientDC dcLabel(m_grid->GetGridWindow()); | ||||
|     dcLabel.SetFont(m_grid->GetLabelFont()); | ||||
|  | ||||
|     const wxString shortStr     = "W"; | ||||
|     const wxString mediumStr    = "WWWW"; | ||||
|     const wxString longStr      = "WWWWWWWW"; | ||||
|     const wxString multilineStr = mediumStr + "\n" + longStr; | ||||
|  | ||||
|     SECTION("Empty column") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, wxEmptyString); | ||||
|         maxWidth = m_grid->GetDefaultColSize(); | ||||
|     } | ||||
|  | ||||
|     SECTION("Autosize by the title") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, mediumStr); | ||||
|         maxWidth = GetColumnLabelWidth(dcLabel, 0, margin); | ||||
|     } | ||||
|  | ||||
|     SECTION("Autosize by cells") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, wxEmptyString); | ||||
|         m_grid->SetCellValue(0, 0, mediumStr); | ||||
|         m_grid->SetCellValue(1, 0, shortStr); | ||||
|         m_grid->SetCellValue(3, 0, longStr); | ||||
|         maxWidth = renderer->GetBestWidth(*m_grid, *attr, dcCell, 3, 0, | ||||
|                                           m_grid->GetRowHeight(3)) | ||||
|                    + margin; | ||||
|     } | ||||
|  | ||||
|     SECTION("Autosize with the longest title") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, multilineStr); | ||||
|         m_grid->SetCellValue(0, 0, mediumStr); | ||||
|         m_grid->SetCellValue(1, 0, shortStr); | ||||
|         maxWidth = GetColumnLabelWidth(dcLabel, 0, margin); | ||||
|     } | ||||
|  | ||||
|     SECTION("Autosize with the longest cell") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, mediumStr); | ||||
|         m_grid->SetCellValue(0, 0, mediumStr); | ||||
|         m_grid->SetCellValue(1, 0, shortStr); | ||||
|         m_grid->SetCellValue(3, 0, multilineStr); | ||||
|         maxWidth = renderer->GetBestWidth(*m_grid, *attr, dcCell, 3, 0, | ||||
|                                           m_grid->GetRowHeight(3)) | ||||
|                    + margin; | ||||
|     } | ||||
|  | ||||
|     SECTION("Autosize with the same values") | ||||
|     { | ||||
|         m_grid->SetColLabelValue(0, mediumStr); | ||||
|         m_grid->SetCellValue(0, 0, mediumStr); | ||||
|         m_grid->SetCellValue(1, 0, mediumStr); | ||||
|         m_grid->SetCellValue(3, 0, mediumStr); | ||||
|  | ||||
|         const int labelWidth = GetColumnLabelWidth(dcLabel, 0, margin); | ||||
|  | ||||
|         const int cellWidth = | ||||
|             renderer->GetBestWidth(*m_grid, *attr, dcCell, 3, 0, | ||||
|                                    m_grid->GetRowHeight(3)) | ||||
|             + margin; | ||||
|  | ||||
|         // We can't be sure which size will be greater because of different fonts | ||||
|         // so just calculate the maximum width. | ||||
|         maxWidth = wxMax(labelWidth, cellWidth); | ||||
|     } | ||||
|  | ||||
|     m_grid->AutoSizeColumn(0); | ||||
|  | ||||
|     wxYield(); | ||||
|     CHECK(m_grid->GetColSize(0) == maxWidth); | ||||
| } | ||||
|  | ||||
| #endif //wxUSE_GRID | ||||
|   | ||||
		Reference in New Issue
	
	Block a user