X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33ac7e6f01acbac1cff0ad400d8ea7f0bfd0a62f..5a224901b8ede55e1db9980f0fcaf7d2cb49285f:/src/common/resource.cpp diff --git a/src/common/resource.cpp b/src/common/resource.cpp index bef7bdb0e4..782e63157c 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -53,6 +53,9 @@ #include "wx/intl.h" #endif +#include "wx/treebase.h" +#include "wx/listctrl.h" + #if wxUSE_RADIOBTN #include "wx/radiobut.h" #endif @@ -227,11 +230,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename) { wxExprDatabase db; -#if defined(__WXMAC__) && !defined(__UNIX__) - FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); -#else FILE *fd = wxFopen(filename, _T("r")); -#endif if (!fd) return FALSE; bool eof = FALSE; @@ -1485,8 +1484,8 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr) if (faceNameExpr) faceName = faceNameExpr->StringValue(); - wxFont font(point, family, style, weight, (underline != 0), faceName); - return font; + return *wxTheFontList->FindOrCreateFont(point, family, style, weight, + (underline != 0), faceName); } // Separate file for the remainder of this, for BC++/Win16 @@ -2050,7 +2049,7 @@ wxChar* wxResourceParseWord(wxChar*s, int *i) struct wxResourceBitListStruct { - wxChar *word; + const wxChar *word; long bits; }; @@ -2468,7 +2467,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table } case wxBITMAP_TYPE_XPM_DATA: { -#if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -2476,10 +2474,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table return wxNullBitmap; } return wxBitmap((char **)item->GetValue1()); -#else - wxLogWarning(_("No XPM facility available!")); - break; -#endif } default: { @@ -2625,7 +2619,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) { // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** /* - #if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -2635,9 +2628,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) return NULL; } return wxIcon((char **)item->GetValue1()); - #else - wxLogWarning(_("No XPM facility available!")); - #endif */ wxLogWarning(_("No XPM icon facility available!")); break; @@ -2661,6 +2651,8 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) } } +#if wxUSE_MENUS + wxMenu *wxResourceCreateMenu(wxItemResource *item) { wxMenu *menu = new wxMenu; @@ -2721,6 +2713,8 @@ wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table) return (wxMenu *) NULL; } +#endif // wxUSE_MENUS + // Global equivalents (so don't have to refer to default table explicitly) bool wxResourceParseData(const wxString& resource, wxResourceTable *table) { @@ -3151,33 +3145,37 @@ bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceNa int height = resource->GetHeight(); wxString name = resource->GetName(); - if (IsKindOf(CLASSINFO(wxDialog))) + // this is used for loading wxWizard pages from WXR + if ( parent != this ) { - wxDialog *dialogBox = (wxDialog *)this; - long modalStyle = isModal ? wxDIALOG_MODAL : 0; - if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) - return FALSE; + if (IsKindOf(CLASSINFO(wxDialog))) + { + wxDialog *dialogBox = (wxDialog *)this; + long modalStyle = isModal ? wxDIALOG_MODAL : 0; + if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) + return FALSE; - // Only reset the client size if we know we're not going to do it again below. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) - dialogBox->SetClientSize(width, height); - } - else if (IsKindOf(CLASSINFO(wxPanel))) - { - wxPanel* panel = (wxPanel *)this; - if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) - return FALSE; - } - else - { - if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) - return FALSE; + // Only reset the client size if we know we're not going to do it again below. + if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) + dialogBox->SetClientSize(width, height); + } + else if (IsKindOf(CLASSINFO(wxPanel))) + { + wxPanel* panel = (wxPanel *)this; + if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) + return FALSE; + } + else + { + if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) + return FALSE; + } } if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) { // No need to do this since it's done in wxPanel or wxDialog constructor. - // SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + // SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); } else { @@ -3189,9 +3187,9 @@ bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceNa // Should have some kind of font at this point if (!GetFont().Ok()) - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); if (!GetBackgroundColour().Ok()) - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); // Only when we've created the window and set the font can we set the correct size, // if based on dialog units.