]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/resource.cpp
Corrected font calculation (use screen resolution now); and check for mask in m_image.cpp
[wxWidgets.git] / src / common / resource.cpp
index cd930265e039c8438845ed9e4079cd11af4262e7..b0945819f76b4dd35f9d187b77baebf90ff1cb89 100644 (file)
@@ -347,7 +347,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
    else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) ||
          itemType == wxString(wxT("wxStaticBitmap")))
       {
-        if (childResource->GetValue4() != wxT(""))
+        if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) )
         {
           // Bitmap message
           wxBitmap bitmap = childResource->GetBitmap();
@@ -357,6 +357,12 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
             ((wxItemResource*) childResource)->SetBitmap(bitmap);
           }
 #if wxUSE_BITMAP_MESSAGE
+#ifdef __WXMSW__
+          // Use a default bitmap
+          if (!bitmap.Ok())
+             bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE);
+#endif
+
           if (bitmap.Ok())
            control = new wxStaticBitmap(parent, id, bitmap, pos, size,
              childResource->GetStyle(), childResource->GetName());
@@ -531,7 +537,18 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
   else
   {
     if (control && childResource->GetFont().Ok())
+    {
       control->SetFont(childResource->GetFont());
+
+#ifdef __WXMSW__
+      // Force the layout algorithm since the size changes the layout
+      if (control->IsKindOf(CLASSINFO(wxRadioBox)))
+      {
+        wxSize sz = control->GetSize();
+        control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
+      }
+#endif
+    }
   }
   return control;
 }
@@ -902,11 +919,11 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
 
       if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
      {
-        // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-       // Do nothing - no label font any more
-      count ++;
-        if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-          controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+       // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+       // Skip past the obsolete label font spec if there are two consecutive specs
+       if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+         count ++;
+       controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
      }
    }
   }
@@ -956,12 +973,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
 
         if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
         {
-         // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-        // Do nothing
-         count ++;
-
-          if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-            controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+         // Skip past the obsolete label font spec if there are two consecutive specs
+         if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+           count ++;
+         controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
        }
      }
    }
@@ -1061,10 +1076,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
       }
       if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
       {
-         // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-         count ++;
-         if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-           controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+         // Skip past the obsolete label font spec if there are two consecutive specs
+         if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+           count ++;
+         controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
       }
    }
   }
@@ -1087,11 +1102,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
 
       if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
      {
-        // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-      count ++;
-
-        if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-          controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+         // Skip past the obsolete label font spec if there are two consecutive specs
+         if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+           count ++;
+         controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
      }
    }
   }
@@ -1123,11 +1137,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
 
         if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
        {
-          // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-        count ++;
-
-          if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-            controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+         // Skip past the obsolete label font spec if there are two consecutive specs
+         if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+           count ++;
+         controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
        }
      }
    }
@@ -1161,11 +1174,10 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
 
       if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
      {
-        // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count)));
-      count ++;
-
-        if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList)
-          controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
+         // Skip past the obsolete label font spec if there are two consecutive specs
+         if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList)
+           count ++;
+         controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count)));
      }
    }
   }