Make wxr resources work in Unicode mode.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-02-03 22:39:02 +00:00
parent 94311eef78
commit bf60426831
5 changed files with 51 additions and 25 deletions

View File

@@ -119,23 +119,25 @@ void wxCleanUpResourceSystem()
delete[] wxResourceBuffer;
}
#if 0
void wxLogWarning(char *msg)
{
wxMessageBox(msg, _("Warning"), wxOK);
}
#endif
IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
wxItemResource::wxItemResource()
{
m_itemType = "";
m_title = "";
m_name = "";
m_itemType = wxT("");
m_title = wxT("");
m_name = wxT("");
m_windowStyle = 0;
m_x = m_y = m_width = m_height = 0;
m_value1 = m_value2 = m_value3 = m_value5 = 0;
m_value4 = "";
m_value4 = wxT("");
m_windowId = 0;
m_exStyle = 0;
}
@@ -230,7 +232,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename)
{
wxExprDatabase db;
FILE *fd = wxFopen(filename, _T("r"));
FILE *fd = wxFopen(filename, wxT("r"));
if (!fd)
return FALSE;
bool eof = FALSE;
@@ -341,7 +343,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
//
bitmap.LoadFile(wxCROSS_BITMAP, wxBITMAP_TYPE_BMP_RESOURCE);
#else
bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE);
bitmap.LoadFile(wxT("cross_bmp"), wxBITMAP_TYPE_BMP_RESOURCE);
#endif
control = new wxBitmapButton(parent, id, bitmap, pos, size,
childResource->GetStyle() | wxBU_AUTODRAW, wxDefaultValidator, childResource->GetName());
@@ -367,7 +369,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c
#ifdef __WXMSW__
// Use a default bitmap
if (!bitmap.Ok())
bitmap.LoadFile("cross_bmp", wxBITMAP_TYPE_BMP_RESOURCE);
bitmap.LoadFile(wxT("cross_bmp"), wxBITMAP_TYPE_BMP_RESOURCE);
#endif
if (bitmap.Ok())
@@ -2735,6 +2737,15 @@ bool wxResourceParseData(const wxString& resource, wxResourceTable *table)
return table->ParseResourceData(resource);
}
bool wxResourceParseData(const char* resource, wxResourceTable *table)
{
wxString str(resource, wxConvLibc);
if (!table)
table = wxDefaultResourceTable;
return table->ParseResourceData(str);
}
bool wxResourceParseFile(const wxString& filename, wxResourceTable *table)
{
if (!table)
@@ -2798,7 +2809,7 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table)
if (!table)
table = wxDefaultResourceTable;
FILE *fd = wxFopen(f, _T("r"));
FILE *fd = wxFopen(f, wxT("r"));
if (!fd)
{
return FALSE;
@@ -3100,6 +3111,15 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR
return TRUE;
}
bool wxResourceParseString(const wxString& s, wxResourceTable *table)
{
#if wxUSE_UNICODE
return wxResourceParseString( (char*)s.mb_str().data() );
#else
return wxResourceParseString( (char*)s.c_str() );
#endif
}
bool wxResourceParseString(char *s, wxResourceTable *table)
{
if (!table)