// Assign the given value to the specified entry or add a new value with this
// name.
-static void XRCID_Assign(const char *str_id, int value);
+static void XRCID_Assign(const wxString& str_id, int value);
class wxXmlResourceDataRecord
{
XRC_ADD_STYLE(wxRAISED_BORDER); XRC_ADD_STYLE(wxBORDER_RAISED);
XRC_ADD_STYLE(wxSTATIC_BORDER); XRC_ADD_STYLE(wxBORDER_STATIC);
XRC_ADD_STYLE(wxNO_BORDER); XRC_ADD_STYLE(wxBORDER_NONE);
+ XRC_ADD_STYLE(wxBORDER_DEFAULT);
XRC_ADD_STYLE(wxTRANSPARENT_WINDOW);
XRC_ADD_STYLE(wxWANTS_CHARS);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxNO_FULL_REPAINT_ON_RESIZE);
XRC_ADD_STYLE(wxFULL_REPAINT_ON_RESIZE);
+ XRC_ADD_STYLE(wxVSCROLL);
+ XRC_ADD_STYLE(wxHSCROLL);
XRC_ADD_STYLE(wxALWAYS_SHOW_SB);
+
XRC_ADD_STYLE(wxWS_EX_BLOCK_EVENTS);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
+ XRC_ADD_STYLE(wxWS_EX_TRANSIENT);
+ XRC_ADD_STYLE(wxWS_EX_CONTEXTHELP);
+ XRC_ADD_STYLE(wxWS_EX_PROCESS_IDLE);
+ XRC_ADD_STYLE(wxWS_EX_PROCESS_UI_UPDATES);
}
// like "&File..." -- this is illegal in XML, so we use "_File..."):
if ( *dt == amp_char )
{
- if ( *(++dt) == amp_char )
+ if ( dt+1 == str1.end() || *(++dt) == amp_char )
str2 << amp_char;
else
str2 << wxT('&') << *dt;
long wxXmlResourceHandler::GetLong(const wxString& param, long defaultv)
{
- long value;
+ long value = defaultv;
wxString str1 = GetParamValue(param);
- if (!str1.ToLong(&value))
- value = defaultv;
+ if (!str1.empty())
+ {
+ if (!str1.ToLong(&value))
+ {
+ ReportParamError
+ (
+ param,
+ wxString::Format("invalid long specification \"%s\"", str1)
+ );
+ }
+ }
return value;
}
// strings in XRC always use C locale so make sure to use the
// locale-independent wxString::ToCDouble() and not ToDouble() which uses
// the current locale with a potentially different decimal point character
- double value;
- if (!str.ToCDouble(&value))
- value = defaultv;
+ double value = defaultv;
+ if (!str.empty())
+ {
+ if (!str.ToCDouble(&value))
+ {
+ ReportParamError
+ (
+ param,
+ wxString::Format("invalid float specification \"%s\"", str)
+ );
+ }
+ }
return wx_truncate_cast(float, value);
}
return wxNullFont;
}
-wxFont wxXmlResourceHandler::GetFont(const wxString& param)
+wxFont wxXmlResourceHandler::GetFont(const wxString& param, wxWindow* parent)
{
wxXmlNode *font_node = GetParamNode(param);
if (font_node == NULL)
istyle = wxITALIC;
else if (style == wxT("slant"))
istyle = wxSLANT;
+ else if (style != wxT("normal"))
+ {
+ ReportParamError
+ (
+ param,
+ wxString::Format("unknown font style \"%s\"", style)
+ );
+ }
}
// weight
iweight = wxBOLD;
else if (weight == wxT("light"))
iweight = wxLIGHT;
+ else if (weight != wxT("normal"))
+ {
+ ReportParamError
+ (
+ param,
+ wxString::Format("unknown font weight \"%s\"", weight)
+ );
+ }
}
// underline
else if (family == wxT("swiss")) ifamily = wxSWISS;
else if (family == wxT("modern")) ifamily = wxMODERN;
else if (family == wxT("teletype")) ifamily = wxTELETYPE;
+ else
+ {
+ ReportParamError
+ (
+ param,
+ wxString::Format("unknown font family \"%s\"", family)
+ );
+ }
}
}
#endif // wxUSE_FONTMAP
+ wxFont font;
+
// is this font based on a system font?
- wxFont font = GetSystemFont(GetParamValue(wxT("sysfont")));
+ if (HasParam(wxT("sysfont")))
+ {
+ font = GetSystemFont(GetParamValue(wxT("sysfont")));
+ if (HasParam(wxT("inherit")))
+ {
+ ReportParamError
+ (
+ param,
+ "double specification of \"sysfont\" and \"inherit\""
+ );
+ }
+ }
+ // or should the font of the widget be used?
+ else if (GetBool(wxT("inherit"), false))
+ {
+ if (parent)
+ font = parent->GetFont();
+ else
+ {
+ ReportParamError
+ (
+ param,
+ "no parent window specified to derive the font from"
+ );
+ }
+ }
if (font.IsOk())
{
if (hasSize && isize != -1)
+ {
font.SetPointSize(isize);
+ if (HasParam(wxT("relativesize")))
+ {
+ ReportParamError
+ (
+ param,
+ "double specification of \"size\" and \"relativesize\""
+ );
+ }
+ }
else if (HasParam(wxT("relativesize")))
font.SetPointSize(int(font.GetPointSize() *
GetFloat(wxT("relativesize"))));
wnd->SetToolTip(GetText(wxT("tooltip")));
#endif
if (HasParam(wxT("font")))
- wnd->SetFont(GetFont(wxT("font")));
+ wnd->SetFont(GetFont(wxT("font"), wnd));
if (HasParam(wxT("ownfont")))
- wnd->SetOwnFont(GetFont(wxT("ownfont")));
+ wnd->SetOwnFont(GetFont(wxT("ownfont"), wnd));
if (HasParam(wxT("help")))
wnd->SetHelpText(GetText(wxT("help")));
}
return index;
}
-static void XRCID_Assign(const char *str_id, int value)
+static void XRCID_Assign(const wxString& str_id, int value)
{
- const unsigned index = XRCIdHash(str_id);
+ const wxCharBuffer buf_id(str_id.mb_str());
+ const unsigned index = XRCIdHash(buf_id);
XRCID_record *oldrec = NULL;
for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
{
- if (wxStrcmp(rec->key, str_id) == 0)
+ if (wxStrcmp(rec->key, buf_id) == 0)
{
rec->id = value;
return;
stdID(wxID_PREVIEW);
stdID(wxID_ABOUT);
stdID(wxID_HELP_CONTENTS);
+ stdID(wxID_HELP_INDEX),
+ stdID(wxID_HELP_SEARCH),
stdID(wxID_HELP_COMMANDS);
stdID(wxID_HELP_PROCEDURES);
stdID(wxID_HELP_CONTEXT);
stdID(wxID_CLOSE_ALL);
stdID(wxID_PREFERENCES);
+
stdID(wxID_EDIT);
stdID(wxID_CUT);
stdID(wxID_COPY);
stdID(wxID_REPLACE);
stdID(wxID_REPLACE_ALL);
stdID(wxID_PROPERTIES);
+
stdID(wxID_VIEW_DETAILS);
stdID(wxID_VIEW_LARGEICONS);
stdID(wxID_VIEW_SMALLICONS);
stdID(wxID_VIEW_SORTNAME);
stdID(wxID_VIEW_SORTSIZE);
stdID(wxID_VIEW_SORTTYPE);
+
+
stdID(wxID_FILE1);
stdID(wxID_FILE2);
stdID(wxID_FILE3);
stdID(wxID_FILE7);
stdID(wxID_FILE8);
stdID(wxID_FILE9);
+
+
stdID(wxID_OK);
stdID(wxID_CANCEL);
stdID(wxID_APPLY);
stdID(wxID_IGNORE);
stdID(wxID_ADD);
stdID(wxID_REMOVE);
+
stdID(wxID_UP);
stdID(wxID_DOWN);
stdID(wxID_HOME);
stdID(wxID_REFRESH);
stdID(wxID_STOP);
stdID(wxID_INDEX);
+
stdID(wxID_BOLD);
stdID(wxID_ITALIC);
stdID(wxID_JUSTIFY_CENTER);
stdID(wxID_ZOOM_OUT);
stdID(wxID_UNDELETE);
stdID(wxID_REVERT_TO_SAVED);
- stdID(wxID_SYSTEM_MENU);
- stdID(wxID_CLOSE_FRAME);
- stdID(wxID_MOVE_FRAME);
- stdID(wxID_RESIZE_FRAME);
- stdID(wxID_MAXIMIZE_FRAME);
- stdID(wxID_ICONIZE_FRAME);
- stdID(wxID_RESTORE_FRAME);
stdID(wxID_CDROM);
stdID(wxID_CONVERT);
stdID(wxID_EXECUTE);
stdID(wxID_SPELL_CHECK);
stdID(wxID_STRIKETHROUGH);
+
+ stdID(wxID_SYSTEM_MENU);
+ stdID(wxID_CLOSE_FRAME);
+ stdID(wxID_MOVE_FRAME);
+ stdID(wxID_RESIZE_FRAME);
+ stdID(wxID_MAXIMIZE_FRAME);
+ stdID(wxID_ICONIZE_FRAME);
+ stdID(wxID_RESTORE_FRAME);
+
+
+
+ stdID(wxID_MDI_WINDOW_CASCADE);
+ stdID(wxID_MDI_WINDOW_TILE_HORZ);
+ stdID(wxID_MDI_WINDOW_TILE_VERT);
+ stdID(wxID_MDI_WINDOW_ARRANGE_ICONS);
+ stdID(wxID_MDI_WINDOW_PREV);
+ stdID(wxID_MDI_WINDOW_NEXT);
#undef stdID
}