X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d0c2e79c27e46a238cf44562fb98c99e65d79b4..c0b0635cf69537ca32377bad5650b39402cb21b6:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index ac9b77b5e0..9d0e0a9f69 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -206,7 +206,7 @@ public: wxGridRowLabelWindow *rowLblWin, wxGridColLabelWindow *colLblWin, wxWindowID id, const wxPoint &pos, const wxSize &size ); - ~wxGridWindow(); + ~wxGridWindow(){} void ScrollWindow( int dx, int dy, const wxRect *rect ); @@ -413,6 +413,7 @@ static const size_t GRID_SCROLL_LINE_Y = GRID_SCROLL_LINE_X; // in these hash tables is the number of rows/columns) static const int GRID_HASH_SIZE = 100; +#if 0 // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -426,6 +427,7 @@ static inline int GetScrollY(int y) { return (y + GRID_SCROLL_LINE_Y - 1) / GRID_SCROLL_LINE_Y; } +#endif // ============================================================================ // implementation @@ -500,9 +502,11 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr) m_colBgOld = m_control->GetBackgroundColour(); m_control->SetBackgroundColour(attr->GetBackgroundColour()); + // Workaround for GTK+1 font setting problem on some platforms +#if !defined(__WXGTK__) || defined(__WXGTK20__) m_fontOld = m_control->GetFont(); m_control->SetFont(attr->GetFont()); - +#endif // can't do anything more in the base class version, the other // attributes may only be used by the derived classes } @@ -521,12 +525,14 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr) m_control->SetBackgroundColour(m_colBgOld); m_colBgOld = wxNullColour; } - + // Workaround for GTK+1 font setting problem on some platforms +#if !defined(__WXGTK__) || defined(__WXGTK20__) if ( m_fontOld.Ok() ) { m_control->SetFont(m_fontOld); m_fontOld = wxNullFont; } +#endif } } @@ -1072,7 +1078,8 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event) char tmpbuf[2]; tmpbuf[0] = (char) keycode; tmpbuf[1] = '\0'; - bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) == + wxString strbuf(tmpbuf, *wxConvCurrent); + bool is_decimal_point = ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) ); if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-' || is_decimal_point @@ -1180,10 +1187,10 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) char tmpbuf[2]; tmpbuf[0] = (char) keycode; tmpbuf[1] = '\0'; - bool is_decimal_point = - ( wxString(tmpbuf, *wxConvCurrent) == - wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, - wxLOCALE_CAT_NUMBER) ); + wxString strbuf(tmpbuf, *wxConvCurrent); + bool is_decimal_point = + ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, + wxLOCALE_CAT_NUMBER) ); if ( (keycode < 128) && (wxIsdigit(keycode) || tolower(keycode) == 'e' || is_decimal_point || keycode == '+' || keycode == '-') ) @@ -3697,11 +3704,6 @@ wxGridWindow::wxGridWindow( wxGrid *parent, } -wxGridWindow::~wxGridWindow() -{ -} - - void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); @@ -4170,6 +4172,9 @@ void wxGrid::Init() m_extraWidth = m_extraHeight = 0; + + m_scrollLineX = GRID_SCROLL_LINE_X; + m_scrollLineY = GRID_SCROLL_LINE_Y; } // ---------------------------------------------------------------------------- @@ -8909,7 +8914,7 @@ void wxGrid::SetDefaultEditor(wxGridCellEditor *editor) { RegisterDataType(wxGRID_VALUE_STRING, GetDefaultRendererForType(wxGRID_VALUE_STRING), - editor); + editor); } // ---------------------------------------------------------------------------- @@ -9540,26 +9545,30 @@ void wxGrid::SetColSize( int col, int width ) void wxGrid::SetColMinimalWidth( int col, int width ) { if (width > GetColMinimalAcceptableWidth()) { - m_colMinWidths[col] = width; + wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col; + m_colMinWidths[key] = width; } } void wxGrid::SetRowMinimalHeight( int row, int width ) { if (width > GetRowMinimalAcceptableHeight()) { - m_rowMinHeights[row] = width; + wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row; + m_rowMinHeights[key] = width; } } int wxGrid::GetColMinimalWidth(int col) const { - wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(col); + wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col; + wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(key); return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth; } int wxGrid::GetRowMinimalHeight(int row) const { - wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(row); + wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row; + wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(key); return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight; } @@ -9891,7 +9900,7 @@ wxSize wxGrid::DoGetBestSize() const if (!width) width=100; if (!height) height=80; - + // Round up to a multiple the scroll rate NOTE: this still doesn't get rid // of the scrollbars, is there any magic incantaion for that? int xpu, ypu; @@ -9900,16 +9909,16 @@ wxSize wxGrid::DoGetBestSize() const width += 1 + xpu - (width % xpu); if (ypu) height += 1 + ypu - (height % ypu); - + // limit to 1/4 of the screen size int maxwidth, maxheight; wxDisplaySize( & maxwidth, & maxheight ); maxwidth /= 2; - maxheight /= 2; + maxheight /= 2; if ( width > maxwidth ) width = maxwidth; if ( height > maxheight ) height = maxheight; - + wxSize best(width, height); // NOTE: This size should be cached, but first we need to add calls to // InvalidateBestSize everywhere that could change the results of this