]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/gizmos/multicell.cpp
renamed start parameter of wxDC::DrawPolyPolygon() to count (patch 882189)
[wxWidgets.git] / contrib / src / gizmos / multicell.cpp
index c09a203a731545c09166e5dcc7545f1e36fe0c91..d9bf7b136466c68959dc01298d5308773a0317dc 100644 (file)
@@ -38,7 +38,7 @@
 //---------------------------------------------------------------------------
 
 IMPLEMENT_ABSTRACT_CLASS(wxMultiCellSizer, wxSizer);
-IMPLEMENT_ABSTRACT_CLASS(wxMultiCellItemHandle, wxRect);
+IMPLEMENT_ABSTRACT_CLASS(wxMultiCellItemHandle, wxObject);
 
 //---------------------------------------------------------------------------
 // wxMultiCellItemHandle
@@ -186,7 +186,7 @@ wxMultiCellSizer::wxMultiCellSizer( int rows, int cols)
 //---------------------------------------------------------------------------
 wxMultiCellSizer::~wxMultiCellSizer()
 {
-       m_children.DeleteContents(TRUE);
+       WX_CLEAR_LIST(wxSizerItemList, m_children);
 
        free(m_maxHeight);
        free(m_maxWidth);
@@ -296,11 +296,10 @@ void wxMultiCellSizer::RecalcSizes()
        wxPoint c_point;
        wxSize  c_size;
 
-       wxNode *current;
-       current = m_children.GetFirst();
-       while (current != NULL)
+       wxSizerItemList::compatibility_iterator         current = m_children.GetFirst();
+       while (current)
        {
-               wxSizerItem *item = (wxSizerItem*) current->Data();
+               wxSizerItem     *item = current->GetData();
 
                wxMultiCellItemHandle *rect;
                if (item != NULL &&
@@ -321,7 +320,7 @@ void wxMultiCellSizer::RecalcSizes()
                                minSize.SetHeight(wxMax(minSize.GetHeight(), c_size.GetHeight()));
                                minSize.SetWidth(wxMax(minSize.GetWidth(), c_size.GetWidth()));
                        }
-                       if (rect->GetStyle() & wxHORIZENTAL_RESIZABLE ||
+                       if (rect->GetStyle() & wxHORIZONTAL_RESIZABLE ||
                                rect->GetWidth() > 1
                                || m_minSizes[rect->GetColumn()]->GetWidth() < 0)
                        {
@@ -372,7 +371,7 @@ void wxMultiCellSizer::RecalcSizes()
                        }
                        item->SetDimension(c_point, c_size);
                }
-               current = current->Next();
+               current = current->GetNext();
        }
 }
 //---------------------------------------------------------------------------
@@ -381,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 );
 }
 //---------------------------------------------------------------------------
@@ -404,10 +400,10 @@ void wxMultiCellSizer :: GetMinimums()
                m_weights[x]->SetWidth(0);
        }
 
-       wxNode *node = m_children.GetFirst();
+       wxSizerItemList::compatibility_iterator         node = m_children.GetFirst();
        while (node)
        {
-               wxSizerItem *item = (wxSizerItem*) node->Data();
+               wxSizerItem     *item = node->GetData();
                wxMultiCellItemHandle *rect;
                if (item != NULL &&
                        (rect = (wxMultiCellItemHandle *)item->GetUserData()) != NULL)
@@ -489,7 +485,7 @@ void wxMultiCellSizer :: GetMinimums()
                        // For each column, calculate the max width for those fields which are not
                        // resizable in the horizontal pane
 
-                       if (!(rect->GetStyle() & wxHORIZENTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0))
+                       if (!(rect->GetStyle() & wxHORIZONTAL_RESIZABLE || m_minSizes[col]->GetWidth() < 0))
                        {
                                if (m_minSizes[col]->GetWidth())
                                {
@@ -506,7 +502,7 @@ void wxMultiCellSizer :: GetMinimums()
                                m_maxWidth[col] = wxMax(m_maxWidth[col], m_defaultCellSize.GetWidth());
                                m_weights[col]->SetWidth(wxMax(m_weights[col]->GetWidth(), rect->GetWeight().GetWidth()));
                        }
-                       node = node->Next();
+                       node = node->GetNext();
                }
        }
 } // wxMultiCellSizer :: GetMinimums
@@ -633,18 +629,15 @@ wxMultiCellCanvas :: wxMultiCellCanvas(wxWindow *par, int numRows, int numCols)
        m_minCellSize = wxSize(5, 5);
 }
 //---------------------------------------------------------------------------
-wxString itoa(int x)
-{
-       char    bfr[255];
-       sprintf(bfr, "%d", x);
-       return bfr;
-}
-//---------------------------------------------------------------------------
 void wxMultiCellCanvas :: Add(wxWindow *win, unsigned int row, unsigned int col)
 {
-       wxASSERT_MSG(row >= 0 && row < m_maxRows, wxString("Row ") + itoa(row) + " out of bounds (" + itoa(m_maxRows) + ")");
-       wxASSERT_MSG(col >= 0 && col < m_maxCols, wxString("Column ") + itoa(col) + " out of bounds (" + itoa(m_maxCols) + ")");
-       wxASSERT_MSG(m_cells[CELL_LOC(row, col)] == NULL, _("Cell already occupied"));
+  // thanks to unsigned data row and col are always >= 0
+       wxASSERT_MSG( /* row >= 0 && */ row < m_maxRows,
+                 wxString::Format(_T("Row %d out of bounds (0..%d)"), row, m_maxRows) );
+       wxASSERT_MSG( /* col >= 0 && */ col < m_maxCols,
+                 wxString::Format(_T("Column %d out of bounds (0..%d)"), col, m_maxCols) );
+
+       wxASSERT_MSG(m_cells[CELL_LOC(row, col)] == NULL, wxT("Cell already occupied"));
 
        wxCell *newCell = new wxCell(win);
        m_cells[CELL_LOC(row,col)] = newCell;
@@ -660,7 +653,7 @@ void wxMultiCellCanvas :: CalculateConstraints()
                        if (!m_cells[CELL_LOC(row, col)])
                        {
                                // Create an empty static text field as a placeholder
-                               m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, -1, ""));
+                               m_cells[CELL_LOC(row, col)] = new wxCell(new wxStaticText(m_parent, -1, wxT("")));
                        }
                        wxFlexGridSizer::Add(m_cells[CELL_LOC(row, col)]->m_window);
                }
@@ -668,3 +661,4 @@ void wxMultiCellCanvas :: CalculateConstraints()
 }
 
 /*** End of File ***/
+