X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3d05544e4e71e7ff10984dae5a9b8a07d92f42a6..399b60a0ad232265cd74ce8bf6a53a1f2cc57ff2:/src/common/resource.cpp diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 436565d0ed..27305db69a 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,23 +39,21 @@ #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/icon.h" #include "wx/statbox.h" #include "wx/statbmp.h" -#if wxUSE_GAUGE #include "wx/gauge.h" -#endif #include "wx/textctrl.h" #include "wx/msgdlg.h" #include "wx/intl.h" #endif -#if wxUSE_RADIOBUTTON +#if wxUSE_RADIOBTN #include "wx/radiobut.h" #endif @@ -81,6 +79,7 @@ #include "wx/wxexpr.h" #include "wx/settings.h" +#include "wx/stream.h" // Forward (private) declarations bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db); @@ -95,6 +94,7 @@ wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr); wxFont wxResourceInterpretFontSpec(wxExpr *expr); bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table = (wxResourceTable *) NULL); +bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) ; bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table = (wxResourceTable *) NULL); wxResourceTable *wxDefaultResourceTable = (wxResourceTable *) NULL; @@ -121,10 +121,8 @@ void wxLogWarning(char *msg) wxMessageBox(msg, _("Warning"), wxOK); } -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) -#endif wxItemResource::wxItemResource() { @@ -166,17 +164,17 @@ wxResourceTable::~wxResourceTable() wxItemResource *wxResourceTable::FindResource(const wxString& name) const { - wxItemResource *item = (wxItemResource *)Get((char *)(const char *)name); + wxItemResource *item = (wxItemResource *)Get(WXSTRINGCAST name); return item; } void wxResourceTable::AddResource(wxItemResource *item) { wxString name = item->GetName(); - if (name == "") + if (name == wxT("")) name = item->GetTitle(); - if (name == "") - name = "no name"; + if (name == wxT("")) + name = wxT("no name"); // Delete existing resource, if any. Delete(name); @@ -186,14 +184,15 @@ void wxResourceTable::AddResource(wxItemResource *item) bool wxResourceTable::DeleteResource(const wxString& name) { - wxItemResource *item = (wxItemResource *)Delete((char *)(const char *)name); + wxItemResource *item = (wxItemResource *)Delete(WXSTRINGCAST name); if (item) { // See if any resource has this as its child; if so, delete from // parent's child list. BeginFind(); wxNode *node = (wxNode *) NULL; - while ((node = Next())) + node = Next(); + while (node != NULL) { wxItemResource *parent = (wxItemResource *)node->Data(); if (parent->GetChildren().Member(item)) @@ -201,6 +200,7 @@ bool wxResourceTable::DeleteResource(const wxString& name) parent->GetChildren().DeleteObject(item); break; } + node = Next(); } delete item; @@ -210,11 +210,28 @@ bool wxResourceTable::DeleteResource(const wxString& name) return FALSE; } +bool wxResourceTable::ParseResourceFile( wxInputStream *is ) +{ + wxExprDatabase db; + int len = is->StreamSize() ; + + bool eof = FALSE; + while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF + { + wxResourceReadOneResource(is, db, &eof, this) ; + } + return wxResourceInterpretResources(*this, db); +} + bool wxResourceTable::ParseResourceFile(const wxString& filename) { wxExprDatabase db; - FILE *fd = fopen((const char*) filename, "r"); +#ifdef __WXMAC__ + FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); +#else + FILE *fd = fopen(filename.fn_str(), "r"); +#endif if (!fd) return FALSE; bool eof = FALSE; @@ -243,7 +260,7 @@ bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char bits // Register pre-loaded bitmap data wxItemResource *item = new wxItemResource; // item->SetType(wxRESOURCE_TYPE_XBM_DATA); - item->SetType("wxXBMData"); + item->SetType(wxT("wxXBMData")); item->SetName(name); item->SetValue1((long)bits); item->SetValue2((long)width); @@ -257,7 +274,7 @@ bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char **da // Register pre-loaded bitmap data wxItemResource *item = new wxItemResource; // item->SetType(wxRESOURCE_TYPE_XPM_DATA); - item->SetType("wxXPMData"); + item->SetType(wxT("wxXPMData")); item->SetName(name); item->SetValue1((long)data); AddResource(item); @@ -307,9 +324,9 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c size = wxSize(childResource->GetWidth(), childResource->GetHeight()); } - if (itemType == wxString("wxButton") || itemType == wxString("wxBitmapButton")) + if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton"))) { - if (childResource->GetValue4() != "") + if (childResource->GetValue4() != wxT("")) { // Bitmap button wxBitmap bitmap = childResource->GetBitmap(); @@ -320,17 +337,17 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c } if (bitmap.Ok()) control = new wxBitmapButton(parent, id, bitmap, pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); + childResource->GetStyle() | wxBU_AUTODRAW, wxDefaultValidator, childResource->GetName()); } else // Normal, text button control = new wxButton(parent, id, childResource->GetTitle(), pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); } - else if (itemType == wxString("wxMessage") || itemType == wxString("wxStaticText") || - itemType == wxString("wxStaticBitmap")) + else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) || + itemType == wxString(wxT("wxStaticBitmap"))) { - if (childResource->GetValue4() != "") + if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) ) { // Bitmap message wxBitmap bitmap = childResource->GetBitmap(); @@ -340,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()); @@ -351,12 +374,12 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c childResource->GetStyle(), childResource->GetName()); } } - else if (itemType == wxString("wxText") || itemType == wxString("wxTextCtrl") || itemType == wxString("wxMultiText")) + else if (itemType == wxString(wxT("wxText")) || itemType == wxString(wxT("wxTextCtrl")) || itemType == wxString(wxT("wxMultiText"))) { control = new wxTextCtrl(parent, id, childResource->GetValue4(), pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); } - else if (itemType == wxString("wxCheckBox")) + else if (itemType == wxString(wxT("wxCheckBox"))) { control = new wxCheckBox(parent, id, childResource->GetTitle(), pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); @@ -364,7 +387,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c ((wxCheckBox *)control)->SetValue((childResource->GetValue1() != 0)); } #if wxUSE_GAUGE - else if (itemType == wxString("wxGauge")) + else if (itemType == wxString(wxT("wxGauge"))) { control = new wxGauge(parent, id, (int)childResource->GetValue2(), pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); @@ -372,8 +395,8 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c ((wxGauge *)control)->SetValue((int)childResource->GetValue1()); } #endif -#if wxUSE_RADIOBUTTON - else if (itemType == wxString("wxRadioButton")) +#if wxUSE_RADIOBTN + else if (itemType == wxString(wxT("wxRadioButton"))) { control = new wxRadioButton(parent, id, childResource->GetTitle(), // (int)childResource->GetValue1(), pos, size, @@ -381,7 +404,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c } #endif #if wxUSE_SCROLLBAR - else if (itemType == wxString("wxScrollBar")) + else if (itemType == wxString(wxT("wxScrollBar"))) { control = new wxScrollBar(parent, id, pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); @@ -396,18 +419,18 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c } #endif - else if (itemType == wxString("wxSlider")) + else if (itemType == wxString(wxT("wxSlider"))) { control = new wxSlider(parent, id, (int)childResource->GetValue1(), (int)childResource->GetValue2(), (int)childResource->GetValue3(), pos, size, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); } - else if (itemType == wxString("wxGroupBox") || itemType == wxString("wxStaticBox")) + else if (itemType == wxString(wxT("wxGroupBox")) || itemType == wxString(wxT("wxStaticBox"))) { control = new wxStaticBox(parent, id, childResource->GetTitle(), pos, size, childResource->GetStyle(), childResource->GetName()); } - else if (itemType == wxString("wxListBox")) + else if (itemType == wxString(wxT("wxListBox"))) { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; @@ -420,7 +443,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c int i = 0; while (node) { - strings[i] = (char *)node->Data(); + strings[i] = (wxChar *)node->Data(); i ++; node = node->Next(); } @@ -431,7 +454,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c if (strings) delete[] strings; } - else if (itemType == wxString("wxChoice")) + else if (itemType == wxString(wxT("wxChoice"))) { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; @@ -444,7 +467,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c int i = 0; while (node) { - strings[i] = (char *)node->Data(); + strings[i] = (wxChar *)node->Data(); i ++; node = node->Next(); } @@ -456,7 +479,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c delete[] strings; } #if wxUSE_COMBOBOX - else if (itemType == wxString("wxComboBox")) + else if (itemType == wxString(wxT("wxComboBox"))) { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; @@ -469,7 +492,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c int i = 0; while (node) { - strings[i] = (char *)node->Data(); + strings[i] = (wxChar *)node->Data(); i ++; node = node->Next(); } @@ -481,7 +504,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c delete[] strings; } #endif - else if (itemType == wxString("wxRadioBox")) + else if (itemType == wxString(wxT("wxRadioBox"))) { wxStringList& stringList = childResource->GetStringValues(); wxString *strings = (wxString *) NULL; @@ -494,7 +517,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c int i = 0; while (node) { - strings[i] = (char *)node->Data(); + strings[i] = (wxChar *)node->Data(); i ++; node = node->Next(); } @@ -514,7 +537,17 @@ 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))) + { + control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); + } +#endif + } } return control; } @@ -532,25 +565,25 @@ bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db) wxString functor(clause->Functor()); wxItemResource *item = (wxItemResource *) NULL; - if (functor == "dialog") + if (functor == wxT("dialog")) item = wxResourceInterpretDialog(table, clause); - else if (functor == "panel") + else if (functor == wxT("panel")) item = wxResourceInterpretDialog(table, clause, TRUE); - else if (functor == "menubar") + else if (functor == wxT("menubar")) item = wxResourceInterpretMenuBar(table, clause); - else if (functor == "menu") + else if (functor == wxT("menu")) item = wxResourceInterpretMenu(table, clause); - else if (functor == "string") + else if (functor == wxT("string")) item = wxResourceInterpretString(table, clause); - else if (functor == "bitmap") + else if (functor == wxT("bitmap")) item = wxResourceInterpretBitmap(table, clause); - else if (functor == "icon") + else if (functor == wxT("icon")) item = wxResourceInterpretIcon(table, clause); if (item) { // Remove any existing resource of same name - if (item->GetName() != "") + if (item->GetName() != wxT("")) table.DeleteResource(item->GetName()); table.AddResource(item); } @@ -559,17 +592,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 wxChar *g_ValidControlClasses[] = +{ + wxT("wxButton"), + wxT("wxBitmapButton"), + wxT("wxMessage"), + wxT("wxStaticText"), + wxT("wxStaticBitmap"), + wxT("wxText"), + wxT("wxTextCtrl"), + wxT("wxMultiText"), + wxT("wxListBox"), + wxT("wxRadioBox"), + wxT("wxRadioButton"), + wxT("wxCheckBox"), + wxT("wxBitmapCheckBox"), + wxT("wxGroupBox"), + wxT("wxStaticBox"), + wxT("wxSlider"), + wxT("wxGauge"), + wxT("wxScrollBar"), + wxT("wxChoice"), + wxT("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; @@ -581,15 +630,15 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, { wxItemResource *dialogItem = new wxItemResource; if (isPanel) - dialogItem->SetType("wxPanel"); + dialogItem->SetType(wxT("wxPanel")); else - dialogItem->SetType("wxDialog"); - wxString style = ""; - wxString title = ""; - wxString name = ""; - wxString backColourHex = ""; - wxString labelColourHex = ""; - wxString buttonColourHex = ""; + dialogItem->SetType(wxT("wxDialog")); + wxString style = wxT(""); + wxString title = wxT(""); + wxString name = wxT(""); + wxString backColourHex = wxT(""); + wxString labelColourHex = wxT(""); + wxString buttonColourHex = wxT(""); long windowStyle = wxDEFAULT_DIALOG_STYLE; if (isPanel) @@ -600,46 +649,49 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, wxExpr *labelFontExpr = (wxExpr *) NULL; wxExpr *buttonFontExpr = (wxExpr *) NULL; wxExpr *fontExpr = (wxExpr *) NULL; - expr->GetAttributeValue("style", style); - expr->GetAttributeValue("name", name); - expr->GetAttributeValue("title", title); - expr->GetAttributeValue("x", x); - expr->GetAttributeValue("y", y); - expr->GetAttributeValue("width", width); - expr->GetAttributeValue("height", height); - expr->GetAttributeValue("modal", isModal); - expr->GetAttributeValue("label_font", &labelFontExpr); - expr->GetAttributeValue("button_font", &buttonFontExpr); - expr->GetAttributeValue("font", &fontExpr); - expr->GetAttributeValue("background_colour", backColourHex); - expr->GetAttributeValue("label_colour", labelColourHex); - expr->GetAttributeValue("button_colour", buttonColourHex); + expr->GetAttributeValue(wxT("style"), style); + expr->GetAttributeValue(wxT("name"), name); + expr->GetAttributeValue(wxT("title"), title); + expr->GetAttributeValue(wxT("x"), x); + expr->GetAttributeValue(wxT("y"), y); + expr->GetAttributeValue(wxT("width"), width); + expr->GetAttributeValue(wxT("height"), height); + expr->GetAttributeValue(wxT("modal"), isModal); + expr->GetAttributeValue(wxT("label_font"), &labelFontExpr); + expr->GetAttributeValue(wxT("button_font"), &buttonFontExpr); + expr->GetAttributeValue(wxT("font"), &fontExpr); + expr->GetAttributeValue(wxT("background_colour"), backColourHex); + expr->GetAttributeValue(wxT("label_colour"), labelColourHex); + expr->GetAttributeValue(wxT("button_colour"), buttonColourHex); int useDialogUnits = 0; - expr->GetAttributeValue("use_dialog_units", useDialogUnits); + expr->GetAttributeValue(wxT("use_dialog_units"), useDialogUnits); if (useDialogUnits != 0) dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_DIALOG_UNITS); int useDefaults = 0; - expr->GetAttributeValue("use_system_defaults", useDefaults); + expr->GetAttributeValue(wxT("use_system_defaults"), useDefaults); if (useDefaults != 0) dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS); - long id = 0; - expr->GetAttributeValue("id", id); + int id = 0; + expr->GetAttributeValue(wxT("id"), id); dialogItem->SetId(id); - if (style != "") + if (style != wxT("")) { windowStyle = wxParseWindowStyle(style); } dialogItem->SetStyle(windowStyle); dialogItem->SetValue1(isModal); + if (windowStyle & wxDIALOG_MODAL) // Uses style in wxWin 2 + dialogItem->SetValue1(TRUE); + dialogItem->SetName(name); dialogItem->SetTitle(title); dialogItem->SetSize(x, y, width, height); - if (backColourHex != "") + if (backColourHex != wxT("")) { int r = 0; int g = 0; @@ -649,7 +701,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, b = wxHexToDec(backColourHex.Mid(4, 2)); dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); } - if (labelColourHex != "") + if (labelColourHex != wxT("")) { int r = 0; int g = 0; @@ -659,7 +711,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, b = wxHexToDec(labelColourHex.Mid(4, 2)); dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); } - if (buttonColourHex != "") + if (buttonColourHex != wxT("")) { int r = 0; int g = 0; @@ -684,7 +736,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, if (controlExpr->Number() == 3) { wxString controlKeyword(controlExpr->Nth(1)->StringValue()); - if (controlKeyword != "" && controlKeyword == "control") + if (controlKeyword != wxT("") && controlKeyword == wxT("control")) { // The value part: always a list. wxExpr *listExpr = controlExpr->Nth(2); @@ -737,7 +789,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) wxLogWarning(_("Could not resolve control class or id '%s'. " "Use (non-zero) integer instead\n or provide #define " "(see manual for caveats)"), - (const char*) expr1->StringValue()); + (const wxChar*) expr1->StringValue()); delete controlItem; return (wxItemResource *) NULL; } @@ -802,20 +854,24 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) controlItem->SetType(controlType); controlItem->SetId(id); - if (controlType == "wxButton") + if (controlType == wxT("wxButton")) { // Check for bitmap resource name (in case loading old-style resource file) 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 != wxT("")) + { + controlItem->SetValue4(str); + controlItem->SetType(wxT("wxBitmapButton")); + } } if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } - else if (controlType == "wxBitmapButton") + else if (controlType == wxT("wxBitmapButton")) { // Check for bitmap resource name if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) @@ -827,7 +883,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } } - else if (controlType == "wxCheckBox") + else if (controlType == wxT("wxCheckBox")) { // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) @@ -838,8 +894,8 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } } -#if wxUSE_RADIOBUTTON - else if (controlType == "wxRadioButton") +#if wxUSE_RADIOBTN + else if (controlType == wxT("wxRadioButton")) { // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) @@ -851,7 +907,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) } } #endif - else if (controlType == "wxText" || controlType == "wxTextCtrl" || controlType == "wxMultiText") + else if (controlType == wxT("wxText") || controlType == wxT("wxTextCtrl") || controlType == wxT("wxMultiText")) { // Check for default value if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) @@ -862,15 +918,15 @@ 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))); } } } - else if (controlType == "wxMessage" || controlType == "wxStaticText") + else if (controlType == wxT("wxMessage") || controlType == wxT("wxStaticText")) { // Check for bitmap resource name (in case it's an old-style .wxr file) if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) @@ -878,12 +934,12 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) wxString str(expr->Nth(count)->StringValue()); controlItem->SetValue4(str); count ++; - controlItem->SetType("wxStaticText"); + controlItem->SetType(wxT("wxStaticText")); } if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } - else if (controlType == "wxStaticBitmap") + else if (controlType == wxT("wxStaticBitmap")) { // Check for bitmap resource name if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) @@ -895,12 +951,12 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } - else if (controlType == "wxGroupBox" || controlType == "wxStaticBox") + else if (controlType == wxT("wxGroupBox") || controlType == wxT("wxStaticBox")) { if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } - else if (controlType == "wxGauge") + else if (controlType == wxT("wxGauge")) { // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) @@ -916,17 +972,15 @@ 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))); } } } } - else if (controlType == "wxSlider") + else if (controlType == wxT("wxSlider")) { // Check for default value if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) @@ -959,7 +1013,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) } } } - else if (controlType == "wxScrollBar") + else if (controlType == wxT("wxScrollBar")) { // DEFAULT VALUE if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) @@ -986,7 +1040,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) } } } - else if (controlType == "wxListBox") + else if (controlType == wxT("wxListBox")) { wxExpr *valueList = (wxExpr *) NULL; @@ -1021,14 +1075,14 @@ 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))); } } } - else if (controlType == "wxChoice") + else if (controlType == wxT("wxChoice")) { wxExpr *valueList = (wxExpr *) NULL; // Check for default value list @@ -1047,16 +1101,15 @@ 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))); } } } #if wxUSE_COMBOBOX - else if (controlType == "wxComboBox") + else if (controlType == wxT("wxComboBox")) { wxExpr *textValue = expr->Nth(count); if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord)) @@ -1083,18 +1136,17 @@ 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))); } } } } #endif #if 1 - else if (controlType == "wxRadioBox") + else if (controlType == wxT("wxRadioBox")) { wxExpr *valueList = (wxExpr *) NULL; // Check for default value list @@ -1121,11 +1173,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))); } } } @@ -1158,13 +1209,13 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr if (expr->Number() == 0) { // item->SetType(wxRESOURCE_TYPE_SEPARATOR); - item->SetType("wxMenuSeparator"); + item->SetType(wxT("wxMenuSeparator")); return item; } else { // item->SetType(wxTYPE_MENU); // Well, menu item, but doesn't matter. - item->SetType("wxMenu"); // Well, menu item, but doesn't matter. + item->SetType(wxT("wxMenu")); // Well, menu item, but doesn't matter. if (labelExpr) { wxString str(labelExpr->StringValue()); @@ -1183,7 +1234,7 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr wxLogWarning(_("Could not resolve menu id '%s'. " "Use (non-zero) integer instead\n" "or provide #define (see manual for caveats)"), - (const char*) idExpr->StringValue()); + (const wxChar*) idExpr->StringValue()); } } else if (idExpr->Type() == PrologInteger) @@ -1237,7 +1288,7 @@ wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr) wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr) { wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue("menu", &listExpr); + expr->GetAttributeValue(wxT("menu"), &listExpr); if (!listExpr) return (wxItemResource *) NULL; @@ -1247,7 +1298,7 @@ wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr) return (wxItemResource *) NULL; wxString name; - if (expr->GetAttributeValue("name", name)) + if (expr->GetAttributeValue(wxT("name"), name)) { menuResource->SetName(name); } @@ -1258,12 +1309,12 @@ wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr) wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr) { wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue("menu", &listExpr); + expr->GetAttributeValue(wxT("menu"), &listExpr); if (!listExpr) return (wxItemResource *) NULL; wxItemResource *resource = new wxItemResource; - resource->SetType("wxMenu"); + resource->SetType(wxT("wxMenu")); // resource->SetType(wxTYPE_MENU); wxExpr *element = listExpr->GetFirst(); @@ -1275,7 +1326,7 @@ wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr) } wxString name; - if (expr->GetAttributeValue("name", name)) + if (expr->GetAttributeValue(wxT("name"), name)) { resource->SetName(name); } @@ -1292,9 +1343,9 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx { wxItemResource *bitmapItem = new wxItemResource; // bitmapItem->SetType(wxTYPE_BITMAP); - bitmapItem->SetType("wxBitmap"); + bitmapItem->SetType(wxT("wxBitmap")); wxString name; - if (expr->GetAttributeValue("name", name)) + if (expr->GetAttributeValue(wxT("name"), name)) { bitmapItem->SetName(name); } @@ -1305,7 +1356,7 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx if (bitmapExpr->Number() == 3) { wxString bitmapKeyword(bitmapExpr->Nth(1)->StringValue()); - if (bitmapKeyword == "bitmap" || bitmapKeyword == "icon") + if (bitmapKeyword == wxT("bitmap") || bitmapKeyword == wxT("icon")) { // The value part: always a list. wxExpr *listExpr = bitmapExpr->Nth(2); @@ -1313,7 +1364,7 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx { wxItemResource *bitmapSpec = new wxItemResource; // bitmapSpec->SetType(wxTYPE_BITMAP); - bitmapSpec->SetType("wxBitmap"); + bitmapSpec->SetType(wxT("wxBitmap")); // List is of form: [filename, bitmaptype, platform, colours, xresolution, yresolution] // where everything after 'filename' is optional. @@ -1323,25 +1374,25 @@ 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() != wxT("")) { bitmapSpec->SetName(nameExpr->StringValue()); } - if (typeExpr && typeExpr->StringValue() != "") + if (typeExpr && typeExpr->StringValue() != wxT("")) { bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); } else bitmapSpec->SetValue1(0); - if (platformExpr && platformExpr->StringValue() != "") + if (platformExpr && platformExpr->StringValue() != wxT("")) { wxString plat(platformExpr->StringValue()); - if (plat == "windows" || plat == "WINDOWS") + if (plat == wxT("windows") || plat == wxT("WINDOWS")) bitmapSpec->SetValue2(RESOURCE_PLATFORM_WINDOWS); - else if (plat == "x" || plat == "X") + else if (plat == wxT("x") || plat == wxT("X")) bitmapSpec->SetValue2(RESOURCE_PLATFORM_X); - else if (plat == "mac" || plat == "MAC") + else if (plat == wxT("mac") || plat == wxT("MAC")) bitmapSpec->SetValue2(RESOURCE_PLATFORM_MAC); else bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); @@ -1375,7 +1426,7 @@ wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr) if (item) { // item->SetType(wxTYPE_ICON); - item->SetType("wxIcon"); + item->SetType(wxT("wxIcon")); return item; } else @@ -1393,7 +1444,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr) int style = wxNORMAL; int weight = wxNORMAL; int underline = 0; - wxString faceName(""); + wxString faceName(wxT("")); wxExpr *pointExpr = expr->Nth(0); wxExpr *familyExpr = expr->Nth(1); @@ -1458,36 +1509,92 @@ bool wxReallocateResourceBuffer() static bool wxEatWhiteSpace(FILE *fd) { - int ch = getc(fd); + int ch = 0; + + while ((ch = getc(fd)) != EOF) + { + switch (ch) + { + case ' ': + case 0x0a: + case 0x0d: + case 0x09: + break; + case '/': + { + int prev_ch = ch; + ch = getc(fd); + if (ch == EOF) + { + ungetc(prev_ch, fd); + return TRUE; + } + + if (ch == '*') + { + // Eat C comment + prev_ch = 0; + while ((ch = getc(fd)) != EOF) + { + if (ch == '/' && prev_ch == '*') + break; + prev_ch = ch; + } + } + else if (ch == '/') + { + // Eat C++ comment + static char buffer[255]; + fgets(buffer, 255, fd); + } + else + { + ungetc(prev_ch, fd); + ungetc(ch, fd); + return TRUE; + } + } + break; + default: + ungetc(ch, fd); + return TRUE; + + } + } + return FALSE; +} +static bool wxEatWhiteSpace(wxInputStream *is) +{ + int ch = is->GetC() ; if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) { - ungetc(ch, fd); + is->Ungetch(ch); return TRUE; } // Eat whitespace while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = getc(fd); + ch = is->GetC(); // Check for comment if (ch == '/') { - ch = getc(fd); + ch = is->GetC(); if (ch == '*') { bool finished = FALSE; while (!finished) { - ch = getc(fd); + ch = is->GetC(); if (ch == EOF) return FALSE; if (ch == '*') { - int newCh = getc(fd); + int newCh = is->GetC(); if (newCh == '/') finished = TRUE; else { - ungetc(newCh, fd); + is->Ungetch(ch); } } } @@ -1496,8 +1603,8 @@ static bool wxEatWhiteSpace(FILE *fd) return FALSE; } else - ungetc(ch, fd); - return wxEatWhiteSpace(fd); + is->Ungetch(ch); + return wxEatWhiteSpace(is); } bool wxGetResourceToken(FILE *fd) @@ -1563,6 +1670,71 @@ bool wxGetResourceToken(FILE *fd) return TRUE; } +bool wxGetResourceToken(wxInputStream *is) +{ + if (!wxResourceBuffer) + wxReallocateResourceBuffer(); + wxResourceBuffer[0] = 0; + wxEatWhiteSpace(is); + + int ch = is->GetC() ; + if (ch == '"') + { + // Get string + wxResourceBufferCount = 0; + ch = is->GetC(); + while (ch != '"') + { + int actualCh = ch; + if (ch == EOF) + { + wxResourceBuffer[wxResourceBufferCount] = 0; + return FALSE; + } + // Escaped characters + else if (ch == '\\') + { + int newCh = is->GetC(); + if (newCh == '"') + actualCh = '"'; + else if (newCh == 10) + actualCh = 10; + else if (newCh == 13) // mac + actualCh = 10; + else + { + is->Ungetch(newCh); + } + } + + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; + wxResourceBufferCount ++; + ch = is->GetC(); + } + wxResourceBuffer[wxResourceBufferCount] = 0; + } + else + { + wxResourceBufferCount = 0; + // Any other token + while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) + { + if (wxResourceBufferCount >= wxResourceBufferSize-1) + wxReallocateResourceBuffer(); + wxResourceBuffer[wxResourceBufferCount] = (char)ch; + wxResourceBufferCount ++; + + ch = is->GetC(); + } + wxResourceBuffer[wxResourceBufferCount] = 0; + if (ch == EOF) + return FALSE; + } + return TRUE; +} + /* * Files are in form: static char *name = "...."; @@ -1581,6 +1753,136 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour return FALSE; } + if (strcmp(wxResourceBuffer, "#define") == 0) + { + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxGetResourceToken(fd); + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) + { + int val = (int)wxAtol(value); + wxResourceAddIdentifier(name, val, table); + } + else + { + wxLogWarning(_("#define %s must be an integer."), name); + delete[] name; + delete[] value; + return FALSE; + } + delete[] name; + delete[] value; + + return TRUE; + } + else if (strcmp(wxResourceBuffer, "#include") == 0) + { + wxGetResourceToken(fd); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + wxChar *actualName = name; + if (name[0] == wxT('"')) + actualName = name + 1; + int len = wxStrlen(name); + if ((len > 0) && (name[len-1] == wxT('"'))) + name[len-1] = 0; + if (!wxResourceParseIncludeFile(actualName, table)) + { + wxLogWarning(_("Could not find resource include file %s."), actualName); + } + delete[] name; + return TRUE; + } + else if (strcmp(wxResourceBuffer, "static") != 0) + { + wxChar buf[300]; + wxStrcpy(buf, _("Found ")); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); + wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); + wxLogWarning(buf); + return FALSE; + } + + // char + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "char") != 0) + { + wxLogWarning(_("Expected 'char' whilst parsing resource.")); + return FALSE; + } + + // *name + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (wxResourceBuffer[0] != '*') + { + wxLogWarning(_("Expected '*' whilst parsing resource.")); + return FALSE; + } + wxChar nameBuf[100]; + wxMB2WX(nameBuf, wxResourceBuffer+1, 99); + nameBuf[99] = 0; + + // = + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + + if (strcmp(wxResourceBuffer, "=") != 0) + { + wxLogWarning(_("Expected '=' whilst parsing resource.")); + return FALSE; + } + + // String + if (!wxGetResourceToken(fd)) + { + wxLogWarning(_("Unexpected end of file whilst parsing resource.")); + *eof = TRUE; + return FALSE; + } + else + { + if (!db.ReadPrologFromString(wxResourceBuffer)) + { + wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); + return FALSE; + } + } + // Semicolon + if (!wxGetResourceToken(fd)) + { + *eof = TRUE; + } + return TRUE; +} + +bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) +{ + if (!table) + table = wxDefaultResourceTable; + + // static or #define + if (!wxGetResourceToken(fd)) + { + *eof = TRUE; + return FALSE; + } + if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceToken(fd); @@ -1707,16 +2009,16 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour * "wxSYSTEM_MENU | wxBORDER" -> integer */ -char* wxResourceParseWord(char*s, int *i) +wxChar* wxResourceParseWord(wxChar*s, int *i) { if (!s) - return (char*) NULL; + return (wxChar*) NULL; - static char buf[150]; - int len = strlen(s); + static wxChar buf[150]; + int len = wxStrlen(s); int j = 0; int ii = *i; - while ((ii < len) && (isalpha(s[ii]) || (s[ii] == '_'))) + while ((ii < len) && (wxIsalpha(s[ii]) || (s[ii] == wxT('_')))) { buf[j] = s[ii]; j ++; @@ -1726,274 +2028,279 @@ char* wxResourceParseWord(char*s, int *i) // Eat whitespace and conjunction characters while ((ii < len) && - ((s[ii] == ' ') || (s[ii] == '|') || (s[ii] == ','))) + ((s[ii] == wxT(' ')) || (s[ii] == wxT('|')) || (s[ii] == wxT(',')))) { ii ++; } *i = ii; if (j == 0) - return (char*) NULL; + return (wxChar*) NULL; else return buf; } struct wxResourceBitListStruct { - char *word; + wxChar *word; long bits; }; static wxResourceBitListStruct wxResourceBitListTable[] = { /* wxListBox */ - { "wxSINGLE", wxLB_SINGLE }, - { "wxMULTIPLE", wxLB_MULTIPLE }, - { "wxEXTENDED", wxLB_EXTENDED }, - { "wxLB_SINGLE", wxLB_SINGLE }, - { "wxLB_MULTIPLE", wxLB_MULTIPLE }, - { "wxLB_EXTENDED", wxLB_EXTENDED }, - { "wxLB_NEEDED_SB", wxLB_NEEDED_SB }, - { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB }, - { "wxLB_SORT", wxLB_SORT }, - { "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, - { "wxLB_HSCROLL", wxLB_HSCROLL }, + { wxT("wxSINGLE"), wxLB_SINGLE }, + { wxT("wxMULTIPLE"), wxLB_MULTIPLE }, + { wxT("wxEXTENDED"), wxLB_EXTENDED }, + { wxT("wxLB_SINGLE"), wxLB_SINGLE }, + { wxT("wxLB_MULTIPLE"), wxLB_MULTIPLE }, + { wxT("wxLB_EXTENDED"), wxLB_EXTENDED }, + { wxT("wxLB_NEEDED_SB"), wxLB_NEEDED_SB }, + { wxT("wxLB_ALWAYS_SB"), wxLB_ALWAYS_SB }, + { wxT("wxLB_SORT"), wxLB_SORT }, + { wxT("wxLB_OWNERDRAW"), wxLB_OWNERDRAW }, + { wxT("wxLB_HSCROLL"), wxLB_HSCROLL }, /* wxComboxBox */ - { "wxCB_SIMPLE", wxCB_SIMPLE }, - { "wxCB_DROPDOWN", wxCB_DROPDOWN }, - { "wxCB_READONLY", wxCB_READONLY }, - { "wxCB_SORT", wxCB_SORT }, + { wxT("wxCB_SIMPLE"), wxCB_SIMPLE }, + { wxT("wxCB_DROPDOWN"), wxCB_DROPDOWN }, + { wxT("wxCB_READONLY"), wxCB_READONLY }, + { wxT("wxCB_SORT"), wxCB_SORT }, /* wxGauge */ - { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, - { "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, - { "wxGA_VERTICAL", wxGA_VERTICAL }, + { wxT("wxGA_PROGRESSBAR"), wxGA_PROGRESSBAR }, + { wxT("wxGA_HORIZONTAL"), wxGA_HORIZONTAL }, + { wxT("wxGA_VERTICAL"), wxGA_VERTICAL }, /* wxTextCtrl */ - { "wxPASSWORD", wxPASSWORD}, - { "wxPROCESS_ENTER", wxPROCESS_ENTER}, - { "wxTE_PASSWORD", wxTE_PASSWORD}, - { "wxTE_READONLY", wxTE_READONLY}, - { "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER}, - { "wxTE_MULTILINE", wxTE_MULTILINE}, + { wxT("wxPASSWORD"), wxPASSWORD}, + { wxT("wxPROCESS_ENTER"), wxPROCESS_ENTER}, + { wxT("wxTE_PASSWORD"), wxTE_PASSWORD}, + { wxT("wxTE_READONLY"), wxTE_READONLY}, + { wxT("wxTE_PROCESS_ENTER"), wxTE_PROCESS_ENTER}, + { wxT("wxTE_MULTILINE"), wxTE_MULTILINE}, + { wxT("wxTE_NO_VSCROLL"), wxTE_NO_VSCROLL}, /* wxRadioBox/wxRadioButton */ - { "wxRB_GROUP", wxRB_GROUP }, - { "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS }, - { "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }, - { "wxRA_HORIZONTAL", wxRA_HORIZONTAL }, - { "wxRA_VERTICAL", wxRA_VERTICAL }, + { wxT("wxRB_GROUP"), wxRB_GROUP }, + { wxT("wxRA_SPECIFY_COLS"), wxRA_SPECIFY_COLS }, + { wxT("wxRA_SPECIFY_ROWS"), wxRA_SPECIFY_ROWS }, + { wxT("wxRA_HORIZONTAL"), wxRA_HORIZONTAL }, + { wxT("wxRA_VERTICAL"), wxRA_VERTICAL }, /* wxSlider */ - { "wxSL_HORIZONTAL", wxSL_HORIZONTAL }, - { "wxSL_VERTICAL", wxSL_VERTICAL }, - { "wxSL_AUTOTICKS", wxSL_AUTOTICKS }, - { "wxSL_LABELS", wxSL_LABELS }, - { "wxSL_LEFT", wxSL_LEFT }, - { "wxSL_TOP", wxSL_TOP }, - { "wxSL_RIGHT", wxSL_RIGHT }, - { "wxSL_BOTTOM", wxSL_BOTTOM }, - { "wxSL_BOTH", wxSL_BOTH }, - { "wxSL_SELRANGE", wxSL_SELRANGE }, + { wxT("wxSL_HORIZONTAL"), wxSL_HORIZONTAL }, + { wxT("wxSL_VERTICAL"), wxSL_VERTICAL }, + { wxT("wxSL_AUTOTICKS"), wxSL_AUTOTICKS }, + { wxT("wxSL_LABELS"), wxSL_LABELS }, + { wxT("wxSL_LEFT"), wxSL_LEFT }, + { wxT("wxSL_TOP"), wxSL_TOP }, + { wxT("wxSL_RIGHT"), wxSL_RIGHT }, + { wxT("wxSL_BOTTOM"), wxSL_BOTTOM }, + { wxT("wxSL_BOTH"), wxSL_BOTH }, + { wxT("wxSL_SELRANGE"), wxSL_SELRANGE }, /* wxScrollBar */ - { "wxSB_HORIZONTAL", wxSB_HORIZONTAL }, - { "wxSB_VERTICAL", wxSB_VERTICAL }, + { wxT("wxSB_HORIZONTAL"), wxSB_HORIZONTAL }, + { wxT("wxSB_VERTICAL"), wxSB_VERTICAL }, /* wxButton */ - { "wxBU_AUTODRAW", wxBU_AUTODRAW }, - { "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }, + { wxT("wxBU_AUTODRAW"), wxBU_AUTODRAW }, + { wxT("wxBU_NOAUTODRAW"), wxBU_NOAUTODRAW }, /* wxTreeCtrl */ - { "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS }, - { "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS }, - { "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT }, + { wxT("wxTR_HAS_BUTTONS"), wxTR_HAS_BUTTONS }, + { wxT("wxTR_EDIT_LABELS"), wxTR_EDIT_LABELS }, + { wxT("wxTR_LINES_AT_ROOT"), wxTR_LINES_AT_ROOT }, /* wxListCtrl */ - { "wxLC_ICON", wxLC_ICON }, - { "wxLC_SMALL_ICON", wxLC_SMALL_ICON }, - { "wxLC_LIST", wxLC_LIST }, - { "wxLC_REPORT", wxLC_REPORT }, - { "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP }, - { "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT }, - { "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE }, - { "wxLC_USER_TEXT", wxLC_USER_TEXT }, - { "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS }, - { "wxLC_NO_HEADER", wxLC_NO_HEADER }, - { "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER }, - { "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL }, - { "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING }, - { "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING }, + { wxT("wxLC_ICON"), wxLC_ICON }, + { wxT("wxLC_SMALL_ICON"), wxLC_SMALL_ICON }, + { wxT("wxLC_LIST"), wxLC_LIST }, + { wxT("wxLC_REPORT"), wxLC_REPORT }, + { wxT("wxLC_ALIGN_TOP"), wxLC_ALIGN_TOP }, + { wxT("wxLC_ALIGN_LEFT"), wxLC_ALIGN_LEFT }, + { wxT("wxLC_AUTOARRANGE"), wxLC_AUTOARRANGE }, + { wxT("wxLC_USER_TEXT"), wxLC_USER_TEXT }, + { wxT("wxLC_EDIT_LABELS"), wxLC_EDIT_LABELS }, + { wxT("wxLC_NO_HEADER"), wxLC_NO_HEADER }, + { wxT("wxLC_NO_SORT_HEADER"), wxLC_NO_SORT_HEADER }, + { wxT("wxLC_SINGLE_SEL"), wxLC_SINGLE_SEL }, + { wxT("wxLC_SORT_ASCENDING"), wxLC_SORT_ASCENDING }, + { wxT("wxLC_SORT_DESCENDING"), wxLC_SORT_DESCENDING }, /* wxSpinButton */ - { "wxSP_VERTICAL", wxSP_VERTICAL}, - { "wxSP_HORIZONTAL", wxSP_HORIZONTAL}, - { "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS}, - { "wxSP_WRAP", wxSP_WRAP}, + { wxT("wxSP_VERTICAL"), wxSP_VERTICAL}, + { wxT("wxSP_HORIZONTAL"), wxSP_HORIZONTAL}, + { wxT("wxSP_ARROW_KEYS"), wxSP_ARROW_KEYS}, + { wxT("wxSP_WRAP"), wxSP_WRAP}, /* wxSplitterWnd */ - { "wxSP_NOBORDER", wxSP_NOBORDER}, - { "wxSP_3D", wxSP_3D}, - { "wxSP_BORDER", wxSP_BORDER}, + { wxT("wxSP_NOBORDER"), wxSP_NOBORDER}, + { wxT("wxSP_3D"), wxSP_3D}, + { wxT("wxSP_BORDER"), wxSP_BORDER}, /* wxTabCtrl */ - { "wxTC_MULTILINE", wxTC_MULTILINE}, - { "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY}, - { "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH}, - { "wxTC_OWNERDRAW", wxTC_OWNERDRAW}, + { wxT("wxTC_MULTILINE"), wxTC_MULTILINE}, + { wxT("wxTC_RIGHTJUSTIFY"), wxTC_RIGHTJUSTIFY}, + { wxT("wxTC_FIXEDWIDTH"), wxTC_FIXEDWIDTH}, + { wxT("wxTC_OWNERDRAW"), wxTC_OWNERDRAW}, /* wxStatusBar95 */ - { "wxST_SIZEGRIP", wxST_SIZEGRIP}, + { wxT("wxST_SIZEGRIP"), wxST_SIZEGRIP}, /* wxControl */ - { "wxFIXED_LENGTH", wxFIXED_LENGTH}, - { "wxALIGN_LEFT", wxALIGN_LEFT}, - { "wxALIGN_CENTER", wxALIGN_CENTER}, - { "wxALIGN_CENTRE", wxALIGN_CENTRE}, - { "wxALIGN_RIGHT", wxALIGN_RIGHT}, - { "wxCOLOURED", wxCOLOURED}, + { wxT("wxFIXED_LENGTH"), wxFIXED_LENGTH}, + { wxT("wxALIGN_LEFT"), wxALIGN_LEFT}, + { wxT("wxALIGN_CENTER"), wxALIGN_CENTER}, + { wxT("wxALIGN_CENTRE"), wxALIGN_CENTRE}, + { wxT("wxALIGN_RIGHT"), wxALIGN_RIGHT}, + { wxT("wxCOLOURED"), wxCOLOURED}, /* wxToolBar */ - { "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, - { "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, - { "wxTB_VERTICAL", wxTB_VERTICAL}, - { "wxTB_FLAT", wxTB_FLAT}, + { wxT("wxTB_3DBUTTONS"), wxTB_3DBUTTONS}, + { wxT("wxTB_HORIZONTAL"), wxTB_HORIZONTAL}, + { wxT("wxTB_VERTICAL"), wxTB_VERTICAL}, + { wxT("wxTB_FLAT"), wxTB_FLAT}, + + /* wxDialog */ + { wxT("wxDIALOG_MODAL"), wxDIALOG_MODAL }, /* Generic */ - { "wxVSCROLL", wxVSCROLL }, - { "wxHSCROLL", wxHSCROLL }, - { "wxCAPTION", wxCAPTION }, - { "wxSTAY_ON_TOP", wxSTAY_ON_TOP}, - { "wxICONIZE", wxICONIZE}, - { "wxMINIMIZE", wxICONIZE}, - { "wxMAXIMIZE", wxMAXIMIZE}, - { "wxSDI", 0}, - { "wxMDI_PARENT", 0}, - { "wxMDI_CHILD", 0}, - { "wxTHICK_FRAME", wxTHICK_FRAME}, - { "wxRESIZE_BORDER", wxRESIZE_BORDER}, - { "wxSYSTEM_MENU", wxSYSTEM_MENU}, - { "wxMINIMIZE_BOX", wxMINIMIZE_BOX}, - { "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX}, - { "wxRESIZE_BOX", wxRESIZE_BOX}, - { "wxDEFAULT_FRAME_STYLE", wxDEFAULT_FRAME_STYLE}, - { "wxDEFAULT_FRAME", wxDEFAULT_FRAME_STYLE}, - { "wxDEFAULT_DIALOG_STYLE", wxDEFAULT_DIALOG_STYLE}, - { "wxBORDER", wxBORDER}, - { "wxRETAINED", wxRETAINED}, - { "wxNATIVE_IMPL", 0}, - { "wxEXTENDED_IMPL", 0}, - { "wxBACKINGSTORE", wxBACKINGSTORE}, -// { "wxFLAT", wxFLAT}, -// { "wxMOTIF_RESIZE", wxMOTIF_RESIZE}, - { "wxFIXED_LENGTH", 0}, - { "wxDOUBLE_BORDER", wxDOUBLE_BORDER}, - { "wxSUNKEN_BORDER", wxSUNKEN_BORDER}, - { "wxRAISED_BORDER", wxRAISED_BORDER}, - { "wxSIMPLE_BORDER", wxSIMPLE_BORDER}, - { "wxSTATIC_BORDER", wxSTATIC_BORDER}, - { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW}, - { "wxNO_BORDER", wxNO_BORDER}, - { "wxCLIP_CHILDREN", wxCLIP_CHILDREN}, - - { "wxTINY_CAPTION_HORIZ", wxTINY_CAPTION_HORIZ}, - { "wxTINY_CAPTION_VERT", wxTINY_CAPTION_VERT}, + { wxT("wxVSCROLL"), wxVSCROLL }, + { wxT("wxHSCROLL"), wxHSCROLL }, + { wxT("wxCAPTION"), wxCAPTION }, + { wxT("wxSTAY_ON_TOP"), wxSTAY_ON_TOP}, + { wxT("wxICONIZE"), wxICONIZE}, + { wxT("wxMINIMIZE"), wxICONIZE}, + { wxT("wxMAXIMIZE"), wxMAXIMIZE}, + { wxT("wxSDI"), 0}, + { wxT("wxMDI_PARENT"), 0}, + { wxT("wxMDI_CHILD"), 0}, + { wxT("wxTHICK_FRAME"), wxTHICK_FRAME}, + { wxT("wxRESIZE_BORDER"), wxRESIZE_BORDER}, + { wxT("wxSYSTEM_MENU"), wxSYSTEM_MENU}, + { wxT("wxMINIMIZE_BOX"), wxMINIMIZE_BOX}, + { wxT("wxMAXIMIZE_BOX"), wxMAXIMIZE_BOX}, + { wxT("wxRESIZE_BOX"), wxRESIZE_BOX}, + { wxT("wxDEFAULT_FRAME_STYLE"), wxDEFAULT_FRAME_STYLE}, + { wxT("wxDEFAULT_FRAME"), wxDEFAULT_FRAME_STYLE}, + { wxT("wxDEFAULT_DIALOG_STYLE"), wxDEFAULT_DIALOG_STYLE}, + { wxT("wxBORDER"), wxBORDER}, + { wxT("wxRETAINED"), wxRETAINED}, + { wxT("wxNATIVE_IMPL"), 0}, + { wxT("wxEXTENDED_IMPL"), 0}, + { wxT("wxBACKINGSTORE"), wxBACKINGSTORE}, +// { wxT("wxFLAT"), wxFLAT}, +// { wxT("wxMOTIF_RESIZE"), wxMOTIF_RESIZE}, + { wxT("wxFIXED_LENGTH"), 0}, + { wxT("wxDOUBLE_BORDER"), wxDOUBLE_BORDER}, + { wxT("wxSUNKEN_BORDER"), wxSUNKEN_BORDER}, + { wxT("wxRAISED_BORDER"), wxRAISED_BORDER}, + { wxT("wxSIMPLE_BORDER"), wxSIMPLE_BORDER}, + { wxT("wxSTATIC_BORDER"), wxSTATIC_BORDER}, + { wxT("wxTRANSPARENT_WINDOW"), wxTRANSPARENT_WINDOW}, + { wxT("wxNO_BORDER"), wxNO_BORDER}, + { wxT("wxCLIP_CHILDREN"), wxCLIP_CHILDREN}, + { wxT("wxTAB_TRAVERSAL"), 0}, // Compatibility only + + { wxT("wxTINY_CAPTION_HORIZ"), wxTINY_CAPTION_HORIZ}, + { wxT("wxTINY_CAPTION_VERT"), wxTINY_CAPTION_VERT}, // Text font families - { "wxDEFAULT", wxDEFAULT}, - { "wxDECORATIVE", wxDECORATIVE}, - { "wxROMAN", wxROMAN}, - { "wxSCRIPT", wxSCRIPT}, - { "wxSWISS", wxSWISS}, - { "wxMODERN", wxMODERN}, - { "wxTELETYPE", wxTELETYPE}, - { "wxVARIABLE", wxVARIABLE}, - { "wxFIXED", wxFIXED}, - { "wxNORMAL", wxNORMAL}, - { "wxLIGHT", wxLIGHT}, - { "wxBOLD", wxBOLD}, - { "wxITALIC", wxITALIC}, - { "wxSLANT", wxSLANT}, - { "wxSOLID", wxSOLID}, - { "wxDOT", wxDOT}, - { "wxLONG_DASH", wxLONG_DASH}, - { "wxSHORT_DASH", wxSHORT_DASH}, - { "wxDOT_DASH", wxDOT_DASH}, - { "wxUSER_DASH", wxUSER_DASH}, - { "wxTRANSPARENT", wxTRANSPARENT}, - { "wxSTIPPLE", wxSTIPPLE}, - { "wxBDIAGONAL_HATCH", wxBDIAGONAL_HATCH}, - { "wxCROSSDIAG_HATCH", wxCROSSDIAG_HATCH}, - { "wxFDIAGONAL_HATCH", wxFDIAGONAL_HATCH}, - { "wxCROSS_HATCH", wxCROSS_HATCH}, - { "wxHORIZONTAL_HATCH", wxHORIZONTAL_HATCH}, - { "wxVERTICAL_HATCH", wxVERTICAL_HATCH}, - { "wxJOIN_BEVEL", wxJOIN_BEVEL}, - { "wxJOIN_MITER", wxJOIN_MITER}, - { "wxJOIN_ROUND", wxJOIN_ROUND}, - { "wxCAP_ROUND", wxCAP_ROUND}, - { "wxCAP_PROJECTING", wxCAP_PROJECTING}, - { "wxCAP_BUTT", wxCAP_BUTT}, + { wxT("wxDEFAULT"), wxDEFAULT}, + { wxT("wxDECORATIVE"), wxDECORATIVE}, + { wxT("wxROMAN"), wxROMAN}, + { wxT("wxSCRIPT"), wxSCRIPT}, + { wxT("wxSWISS"), wxSWISS}, + { wxT("wxMODERN"), wxMODERN}, + { wxT("wxTELETYPE"), wxTELETYPE}, + { wxT("wxVARIABLE"), wxVARIABLE}, + { wxT("wxFIXED"), wxFIXED}, + { wxT("wxNORMAL"), wxNORMAL}, + { wxT("wxLIGHT"), wxLIGHT}, + { wxT("wxBOLD"), wxBOLD}, + { wxT("wxITALIC"), wxITALIC}, + { wxT("wxSLANT"), wxSLANT}, + { wxT("wxSOLID"), wxSOLID}, + { wxT("wxDOT"), wxDOT}, + { wxT("wxLONG_DASH"), wxLONG_DASH}, + { wxT("wxSHORT_DASH"), wxSHORT_DASH}, + { wxT("wxDOT_DASH"), wxDOT_DASH}, + { wxT("wxUSER_DASH"), wxUSER_DASH}, + { wxT("wxTRANSPARENT"), wxTRANSPARENT}, + { wxT("wxSTIPPLE"), wxSTIPPLE}, + { wxT("wxBDIAGONAL_HATCH"), wxBDIAGONAL_HATCH}, + { wxT("wxCROSSDIAG_HATCH"), wxCROSSDIAG_HATCH}, + { wxT("wxFDIAGONAL_HATCH"), wxFDIAGONAL_HATCH}, + { wxT("wxCROSS_HATCH"), wxCROSS_HATCH}, + { wxT("wxHORIZONTAL_HATCH"), wxHORIZONTAL_HATCH}, + { wxT("wxVERTICAL_HATCH"), wxVERTICAL_HATCH}, + { wxT("wxJOIN_BEVEL"), wxJOIN_BEVEL}, + { wxT("wxJOIN_MITER"), wxJOIN_MITER}, + { wxT("wxJOIN_ROUND"), wxJOIN_ROUND}, + { wxT("wxCAP_ROUND"), wxCAP_ROUND}, + { wxT("wxCAP_PROJECTING"), wxCAP_PROJECTING}, + { wxT("wxCAP_BUTT"), wxCAP_BUTT}, // Logical ops - { "wxCLEAR", wxCLEAR}, - { "wxXOR", wxXOR}, - { "wxINVERT", wxINVERT}, - { "wxOR_REVERSE", wxOR_REVERSE}, - { "wxAND_REVERSE", wxAND_REVERSE}, - { "wxCOPY", wxCOPY}, - { "wxAND", wxAND}, - { "wxAND_INVERT", wxAND_INVERT}, - { "wxNO_OP", wxNO_OP}, - { "wxNOR", wxNOR}, - { "wxEQUIV", wxEQUIV}, - { "wxSRC_INVERT", wxSRC_INVERT}, - { "wxOR_INVERT", wxOR_INVERT}, - { "wxNAND", wxNAND}, - { "wxOR", wxOR}, - { "wxSET", wxSET}, - - { "wxFLOOD_SURFACE", wxFLOOD_SURFACE}, - { "wxFLOOD_BORDER", wxFLOOD_BORDER}, - { "wxODDEVEN_RULE", wxODDEVEN_RULE}, - { "wxWINDING_RULE", wxWINDING_RULE}, - { "wxHORIZONTAL", wxHORIZONTAL}, - { "wxVERTICAL", wxVERTICAL}, - { "wxBOTH", wxBOTH}, - { "wxCENTER_FRAME", wxCENTER_FRAME}, - { "wxOK", wxOK}, - { "wxYES_NO", wxYES_NO}, - { "wxCANCEL", wxCANCEL}, - { "wxYES", wxYES}, - { "wxNO", wxNO}, - { "wxICON_EXCLAMATION", wxICON_EXCLAMATION}, - { "wxICON_HAND", wxICON_HAND}, - { "wxICON_QUESTION", wxICON_QUESTION}, - { "wxICON_INFORMATION", wxICON_INFORMATION}, - { "wxICON_STOP", wxICON_STOP}, - { "wxICON_ASTERISK", wxICON_ASTERISK}, - { "wxICON_MASK", wxICON_MASK}, - { "wxCENTRE", wxCENTRE}, - { "wxCENTER", wxCENTRE}, - { "wxUSER_COLOURS", wxUSER_COLOURS}, - { "wxVERTICAL_LABEL", 0}, - { "wxHORIZONTAL_LABEL", 0}, + { wxT("wxCLEAR"), wxCLEAR}, + { wxT("wxXOR"), wxXOR}, + { wxT("wxINVERT"), wxINVERT}, + { wxT("wxOR_REVERSE"), wxOR_REVERSE}, + { wxT("wxAND_REVERSE"), wxAND_REVERSE}, + { wxT("wxCOPY"), wxCOPY}, + { wxT("wxAND"), wxAND}, + { wxT("wxAND_INVERT"), wxAND_INVERT}, + { wxT("wxNO_OP"), wxNO_OP}, + { wxT("wxNOR"), wxNOR}, + { wxT("wxEQUIV"), wxEQUIV}, + { wxT("wxSRC_INVERT"), wxSRC_INVERT}, + { wxT("wxOR_INVERT"), wxOR_INVERT}, + { wxT("wxNAND"), wxNAND}, + { wxT("wxOR"), wxOR}, + { wxT("wxSET"), wxSET}, + + { wxT("wxFLOOD_SURFACE"), wxFLOOD_SURFACE}, + { wxT("wxFLOOD_BORDER"), wxFLOOD_BORDER}, + { wxT("wxODDEVEN_RULE"), wxODDEVEN_RULE}, + { wxT("wxWINDING_RULE"), wxWINDING_RULE}, + { wxT("wxHORIZONTAL"), wxHORIZONTAL}, + { wxT("wxVERTICAL"), wxVERTICAL}, + { wxT("wxBOTH"), wxBOTH}, + { wxT("wxCENTER_FRAME"), wxCENTER_FRAME}, + { wxT("wxOK"), wxOK}, + { wxT("wxYES_NO"), wxYES_NO}, + { wxT("wxCANCEL"), wxCANCEL}, + { wxT("wxYES"), wxYES}, + { wxT("wxNO"), wxNO}, + { wxT("wxICON_EXCLAMATION"), wxICON_EXCLAMATION}, + { wxT("wxICON_HAND"), wxICON_HAND}, + { wxT("wxICON_QUESTION"), wxICON_QUESTION}, + { wxT("wxICON_INFORMATION"), wxICON_INFORMATION}, + { wxT("wxICON_STOP"), wxICON_STOP}, + { wxT("wxICON_ASTERISK"), wxICON_ASTERISK}, + { wxT("wxICON_MASK"), wxICON_MASK}, + { wxT("wxCENTRE"), wxCENTRE}, + { wxT("wxCENTER"), wxCENTRE}, + { wxT("wxUSER_COLOURS"), wxUSER_COLOURS}, + { wxT("wxVERTICAL_LABEL"), 0}, + { wxT("wxHORIZONTAL_LABEL"), 0}, // Bitmap types (not strictly styles) - { "wxBITMAP_TYPE_XPM", wxBITMAP_TYPE_XPM}, - { "wxBITMAP_TYPE_XBM", wxBITMAP_TYPE_XBM}, - { "wxBITMAP_TYPE_BMP", wxBITMAP_TYPE_BMP}, - { "wxBITMAP_TYPE_RESOURCE", wxBITMAP_TYPE_BMP_RESOURCE}, - { "wxBITMAP_TYPE_BMP_RESOURCE", wxBITMAP_TYPE_BMP_RESOURCE}, - { "wxBITMAP_TYPE_GIF", wxBITMAP_TYPE_GIF}, - { "wxBITMAP_TYPE_TIF", wxBITMAP_TYPE_TIF}, - { "wxBITMAP_TYPE_ICO", wxBITMAP_TYPE_ICO}, - { "wxBITMAP_TYPE_ICO_RESOURCE", wxBITMAP_TYPE_ICO_RESOURCE}, - { "wxBITMAP_TYPE_CUR", wxBITMAP_TYPE_CUR}, - { "wxBITMAP_TYPE_CUR_RESOURCE", wxBITMAP_TYPE_CUR_RESOURCE}, - { "wxBITMAP_TYPE_XBM_DATA", wxBITMAP_TYPE_XBM_DATA}, - { "wxBITMAP_TYPE_XPM_DATA", wxBITMAP_TYPE_XPM_DATA}, - { "wxBITMAP_TYPE_ANY", wxBITMAP_TYPE_ANY} + { wxT("wxBITMAP_TYPE_XPM"), wxBITMAP_TYPE_XPM}, + { wxT("wxBITMAP_TYPE_XBM"), wxBITMAP_TYPE_XBM}, + { wxT("wxBITMAP_TYPE_BMP"), wxBITMAP_TYPE_BMP}, + { wxT("wxBITMAP_TYPE_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, + { wxT("wxBITMAP_TYPE_BMP_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, + { wxT("wxBITMAP_TYPE_GIF"), wxBITMAP_TYPE_GIF}, + { wxT("wxBITMAP_TYPE_TIF"), wxBITMAP_TYPE_TIF}, + { wxT("wxBITMAP_TYPE_ICO"), wxBITMAP_TYPE_ICO}, + { wxT("wxBITMAP_TYPE_ICO_RESOURCE"), wxBITMAP_TYPE_ICO_RESOURCE}, + { wxT("wxBITMAP_TYPE_CUR"), wxBITMAP_TYPE_CUR}, + { wxT("wxBITMAP_TYPE_CUR_RESOURCE"), wxBITMAP_TYPE_CUR_RESOURCE}, + { wxT("wxBITMAP_TYPE_XBM_DATA"), wxBITMAP_TYPE_XBM_DATA}, + { wxT("wxBITMAP_TYPE_XPM_DATA"), wxBITMAP_TYPE_XPM_DATA}, + { wxT("wxBITMAP_TYPE_ANY"), wxBITMAP_TYPE_ANY} }; static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxResourceBitListStruct)); @@ -2001,14 +2308,15 @@ static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxRes long wxParseWindowStyle(const wxString& bitListString) { int i = 0; - char *word; + wxChar *word; long bitList = 0; - while ((word = wxResourceParseWord((char*) (const char*) bitListString, &i))) + word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); + while (word != NULL) { bool found = FALSE; int j; for (j = 0; j < wxResourceBitListCount; j++) - if (strcmp(wxResourceBitListTable[j].word, word) == 0) + if (wxStrcmp(wxResourceBitListTable[j].word, word) == 0) { bitList |= wxResourceBitListTable[j].bits; found = TRUE; @@ -2019,6 +2327,7 @@ long wxParseWindowStyle(const wxString& bitListString) wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word); return 0; } + word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); } return bitList; } @@ -2036,9 +2345,9 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table wxItemResource *item = table->FindResource(resource); if (item) { - if ((item->GetType() == "") || (item->GetType() != "wxBitmap")) + if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap"))) { - wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource); + wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource); return wxNullBitmap; } int thisDepth = wxDisplayDepth(); @@ -2138,14 +2447,14 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table if (!item) { wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const char*) name); + "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); return wxNullBitmap; } return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; #else wxLogWarning(_("No XBM facility available!")); -#endif break; +#endif } case wxBITMAP_TYPE_XPM_DATA: { @@ -2154,26 +2463,27 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table if (!item) { wxLogWarning(_("Failed to find XPM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const char*) name); + "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); return wxNullBitmap; } - return wxBitmap(item->GetValue1()); + return wxBitmap((char **)item->GetValue1()); #else wxLogWarning(_("No XPM facility available!")); -#endif break; +#endif } default: { return wxBitmap(name, bitmapType); - break; } } - return wxNullBitmap; +#ifndef __WXGTK__ + return wxNullBitmap; +#endif } else { - wxLogWarning(_("Bitmap resource specification %s not found."), (const char*) resource); + wxLogWarning(_("Bitmap resource specification %s not found."), (const wxChar*) resource); return wxNullBitmap; } } @@ -2191,9 +2501,9 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) wxItemResource *item = table->FindResource(resource); if (item) { - if ((item->GetType() == "") || strcmp(item->GetType(), "wxIcon") != 0) + if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0) { - wxLogWarning(_("%s not an icon resource specification."), (const char*) resource); + wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource); return wxNullIcon; } int thisDepth = wxDisplayDepth(); @@ -2293,14 +2603,14 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) if (!item) { wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadIconData?"), (const char*) name); + "Forgot to use wxResourceLoadIconData?"), (const wxChar*) name); return wxNullIcon; } return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); #else wxLogWarning(_("No XBM facility available!")); -#endif break; +#endif } case wxBITMAP_TYPE_XPM_DATA: { @@ -2326,7 +2636,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) default: { #ifdef __WXGTK__ - wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource); + wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); #else return wxIcon(name, bitmapType); #endif @@ -2337,7 +2647,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) } else { - wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource); + wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); return wxNullIcon; } } @@ -2349,7 +2659,7 @@ wxMenu *wxResourceCreateMenu(wxItemResource *item) while (node) { wxItemResource *child = (wxItemResource *)node->Data(); - if ((child->GetType() != "") && (child->GetType() == "wxMenuSeparator")) + if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator"))) menu->AppendSeparator(); else if (child->GetChildren().Number() > 0) { @@ -2372,7 +2682,7 @@ wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *ta table = wxDefaultResourceTable; wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) + if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) { if (!menuBar) menuBar = new wxMenuBar; @@ -2396,7 +2706,7 @@ wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table) table = wxDefaultResourceTable; wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) + if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) // if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) return wxResourceCreateMenu(menuResource); return (wxMenu *) NULL; @@ -2453,7 +2763,7 @@ bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *t if (!table) table = wxDefaultResourceTable; - table->identifiers.Put(name, (wxObject *)value); + table->identifiers.Put(name, (wxObject *)(long)value); return TRUE; } @@ -2462,7 +2772,7 @@ int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table) if (!table) table = wxDefaultResourceTable; - return (int)table->identifiers.Get(name); + return (int)(long)table->identifiers.Get(name); } /* @@ -2474,7 +2784,7 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) if (!table) table = wxDefaultResourceTable; - FILE *fd = fopen(f, "r"); + FILE *fd = fopen(f.fn_str(), "r"); if (!fd) { return FALSE; @@ -2484,12 +2794,12 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxGetResourceToken(fd); - char *value = copystring(wxResourceBuffer); - if (isdigit(value[0])) + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) { - int val = (int)atol(value); + int val = (int)wxAtol(value); wxResourceAddIdentifier(name, val, table); } delete[] name; @@ -2524,49 +2834,53 @@ static int ungetc_string() bool wxEatWhiteSpaceString(char *s) { - int ch = getc_string(s); - if (ch == EOF) - return TRUE; + int ch = 0; - if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) - { - ungetc_string(); - return TRUE; - } - - // Eat whitespace - while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = getc_string(s); - // Check for comment - if (ch == '/') - { - ch = getc_string(s); - if (ch == '*') - { - bool finished = FALSE; - while (!finished) + while ((ch = getc_string(s)) != EOF) { - ch = getc_string(s); - if (ch == EOF) - return FALSE; - if (ch == '*') - { - int newCh = getc_string(s); - if (newCh == '/') - finished = TRUE; - else - { + switch (ch) + { + case ' ': + case 0x0a: + case 0x0d: + case 0x09: + break; + case '/': + { + int prev_ch = ch; + ch = getc_string(s); + if (ch == EOF) + { + ungetc_string(); + return TRUE; + } + + if (ch == '*') + { + // Eat C comment + prev_ch = 0; + while ((ch = getc_string(s)) != EOF) + { + if (ch == '/' && prev_ch == '*') + break; + prev_ch = ch; + } + } + else + { + ungetc_string(); + ungetc_string(); + return TRUE; + } + } + break; + default: ungetc_string(); - } - } + return TRUE; + + } } - } - else // False alarm - return FALSE; - } - else if (ch != EOF) - ungetc_string(); - return wxEatWhiteSpaceString(s); + return FALSE; } bool wxGetResourceTokenString(char *s) @@ -2653,12 +2967,12 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR if (strcmp(wxResourceBuffer, "#define") == 0) { wxGetResourceTokenString(s); - char *name = copystring(wxResourceBuffer); + wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); wxGetResourceTokenString(s); - char *value = copystring(wxResourceBuffer); - if (isalpha(value[0])) + wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); + if (wxIsdigit(value[0])) { - int val = (int)atol(value); + int val = (int)wxAtol(value); wxResourceAddIdentifier(name, val, table); } else @@ -2696,10 +3010,10 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR */ else if (strcmp(wxResourceBuffer, "static") != 0) { - char buf[300]; - strcpy(buf, _("Found ")); - strncat(buf, wxResourceBuffer, 30); - strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); + wxChar buf[300]; + wxStrcpy(buf, _("Found ")); + wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); + wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); wxLogWarning(buf); return FALSE; } @@ -2731,8 +3045,9 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR wxLogWarning(_("Expected '*' whilst parsing resource.")); return FALSE; } - char nameBuf[100]; - strncpy(nameBuf, wxResourceBuffer+1, 99); + wxChar nameBuf[100]; + wxMB2WX(nameBuf, wxResourceBuffer+1, 99); + nameBuf[99] = 0; // = if (!wxGetResourceTokenString(s)) @@ -2807,15 +3122,15 @@ bool wxResourceParseString(char *s, wxResourceTable *table) * resource loading facility */ -bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table) +bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table) { if (!table) table = wxDefaultResourceTable; - wxItemResource *resource = table->FindResource((const char *)resourceName); + wxItemResource *resource = table->FindResource((const wxChar *)resourceName); // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) - if (!resource || (resource->GetType() == "") || - ! ((resource->GetType() == "wxDialog") || (resource->GetType() == "wxPanel"))) + if (!resource || (resource->GetType() == wxT("")) || + ! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel")))) return FALSE; wxString title(resource->GetTitle()); @@ -2841,12 +3156,12 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, else if (IsKindOf(CLASSINFO(wxPanel))) { wxPanel* panel = (wxPanel *)this; - if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) + if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) return FALSE; } else { - if (!this->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) + if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) return FALSE; } @@ -2893,14 +3208,14 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, return TRUE; } -wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table) +wxControl *wxWindowBase::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table) { if (!table) table = wxDefaultResourceTable; return table->CreateItem((wxWindow *)this, resource, parentResource); } -#ifdef _MSC_VER +#ifdef __VISUALC__ #pragma warning(default:4706) // assignment within conditional expression #endif // VC++