X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/06cfab17389f4bbd38560dd86ee39931e979bb1e..a0d8a3052817fef6eef27e9a6ab8802495a39db8:/src/common/resource.cpp diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 19f87a2b4a..ac44cbc882 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -22,7 +22,7 @@ #if wxUSE_WX_RESOURCES -#ifdef _MSC_VER +#ifdef __VISUALC__ #pragma warning(disable:4706) // assignment within conditional expression #endif // VC++ @@ -39,12 +39,14 @@ #include "wx/button.h" #include "wx/bmpbuttn.h" #include "wx/radiobox.h" +#include "wx/radiobut.h" #include "wx/listbox.h" #include "wx/choice.h" #include "wx/checkbox.h" #include "wx/settings.h" #include "wx/slider.h" #include "wx/statbox.h" +#include "wx/statbmp.h" #if wxUSE_GAUGE #include "wx/gauge.h" #endif @@ -557,17 +559,33 @@ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db) return TRUE; } -static char *g_ValidControlClasses[] = { "wxButton", "wxBitmapButton", "wxMessage", - "wxStaticText", "wxStaticBitmap", "wxText", "wxTextCtrl", "wxMultiText", - "wxListBox", "wxRadioBox", "wxRadioButton", "wxCheckBox", "wxBitmapCheckBox", - "wxGroupBox", "wxStaticBox", "wxSlider", "wxGauge", "wxScrollBar", - "wxChoice", "wxComboBox" } ; -static int g_ValidControlClassesCount = sizeof(g_ValidControlClasses) / sizeof(char *) ; +static const char *g_ValidControlClasses[] = +{ + "wxButton", + "wxBitmapButton", + "wxMessage", + "wxStaticText", + "wxStaticBitmap", + "wxText", + "wxTextCtrl", + "wxMultiText", + "wxListBox", + "wxRadioBox", + "wxRadioButton", + "wxCheckBox", + "wxBitmapCheckBox", + "wxGroupBox", + "wxStaticBox", + "wxSlider", + "wxGauge", + "wxScrollBar", + "wxChoice", + "wxComboBox" +}; static bool wxIsValidControlClass(const wxString& c) { - int i; - for ( i = 0; i < g_ValidControlClassesCount; i++) + for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ ) { if ( c == g_ValidControlClasses[i] ) return TRUE; @@ -806,9 +824,13 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) { wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); count ++; - controlItem->SetType("wxBitmapButton"); + + if (str != "") + { + controlItem->SetValue4(str); + controlItem->SetType("wxBitmapButton"); + } } if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); @@ -1321,18 +1343,18 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx wxExpr *coloursExpr = listExpr->Nth(3); wxExpr *xresExpr = listExpr->Nth(4); wxExpr *yresExpr = listExpr->Nth(5); - if (nameExpr && nameExpr->StringValue()) + if (nameExpr && nameExpr->StringValue() != "") { bitmapSpec->SetName(nameExpr->StringValue()); } - if (typeExpr && typeExpr->StringValue()) + if (typeExpr && typeExpr->StringValue() != "") { bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); } else bitmapSpec->SetValue1(0); - if (platformExpr && platformExpr->StringValue()) + if (platformExpr && platformExpr->StringValue() != "") { wxString plat(platformExpr->StringValue()); if (plat == "windows" || plat == "WINDOWS") @@ -1429,7 +1451,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr) // Separate file for the remainder of this, for BC++/Win16 -#if !(defined(__BORLANDC__) && defined(__WIN16__)) +#if !((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__)) /* * (Re)allocate buffer for reading in from resource file */ @@ -2034,7 +2056,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table wxItemResource *item = table->FindResource(resource); if (item) { - if (!item->GetType() || strcmp(item->GetType(), "wxBitmap") != 0) + if ((item->GetType() == "") || (item->GetType() != "wxBitmap")) { wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource); return wxNullBitmap; @@ -2155,7 +2177,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table "Forgot to use wxResourceLoadBitmapData?"), (const char*) name); return wxNullBitmap; } - return wxBitmap(item->GetValue1()); + return wxBitmap((char **)item->GetValue1()); #else wxLogWarning(_("No XPM facility available!")); #endif @@ -2812,8 +2834,8 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, wxItemResource *resource = table->FindResource((const char *)resourceName); // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) - if (!resource || !resource->GetType() || - ! ((strcmp(resource->GetType(), "wxDialog") == 0) || (strcmp(resource->GetType(), "wxPanel") == 0))) + if (!resource || (resource->GetType() == "") || + ! ((resource->GetType() == "wxDialog") || (resource->GetType() == "wxPanel"))) return FALSE; wxString title(resource->GetTitle()); @@ -2898,7 +2920,7 @@ wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemReso return table->CreateItem((wxWindow *)this, resource, parentResource); } -#ifdef _MSC_VER +#ifdef __VISUALC__ #pragma warning(default:4706) // assignment within conditional expression #endif // VC++