+bool wxSizerXmlHandler::ValidateGridSizerChildren()
+{
+ int rows = GetLong("rows");
+ int cols = GetLong("cols");
+
+ if ( rows && cols )
+ {
+ // fixed number of cells, need to verify children count
+ int children = 0;
+ for ( wxXmlNode *n = m_node->GetChildren(); n; n = n->GetNext() )
+ {
+ if ( n->GetType() == wxXML_ELEMENT_NODE &&
+ (n->GetName() == "object" || n->GetName() == "object_ref") )
+ {
+ children++;
+ }
+ }
+
+ if ( children > rows * cols )
+ {
+ ReportError
+ (
+ wxString::Format
+ (
+ "too many children in grid sizer: %d > %d x %d"
+ " (consider omitting the number of rows or columns)",
+ children,
+ cols,
+ rows
+ )
+ );
+ return false;
+ }
+ }
+
+ return true;
+}