From 96d714660aeb1e57757af8523164933b9b7f3a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 3 Aug 2014 17:10:49 +0000 Subject: [PATCH] Add window variant support to XRC. Fixes #16247. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + docs/doxygen/overviews/xrc_format.h | 2 ++ misc/schema/xrc_schema.rnc | 3 +++ samples/xrc/rc/derivdlg.xrc | 1 + src/xrc/xmlres.cpp | 25 +++++++++++++++++++++++++ 5 files changed, 32 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 66c6f99fcf..e6f88718d8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -588,6 +588,7 @@ All (GUI): - Add wxGenericListCtrl::EndEditLabel() (Tim Kosse). - Implement bounding box computation in wxGCDC (Toni Ruža). - Fix saving GIF animations with 2.5s+ delays between frames (elvissteinjr). +- Add "variant" property to windows in XRC. wxGTK: diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index e70c12b671..62c8e1e0bc 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -519,6 +519,8 @@ from properties lists below. If set to 1, the control is created hidden (default: 0).} @row3col{tooltip, @ref overview_xrcformat_type_text, Tooltip to use for the control (default: not set).} +@row3col{variant, @ref overview_xrcformat_type_string, + Window variant (see wxWindow::SetWindowVariant()), one of "normal", "small", "mini" or "large" (default: "normal") (new since wxWidgets 3.0.2).} @row3col{font, @ref overview_xrcformat_type_font, Font to use for the control (default: window's default).} @row3col{ownfont, @ref overview_xrcformat_type_font, diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index 5752b623a2..27b975414c 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -392,6 +392,7 @@ stdWindowProperties = [xrc:p="o"] element focused {_, t_bool }* & [xrc:p="o"] element hidden {_, t_bool }* & [xrc:p="o"] element tooltip {_, t_text }* & + [xrc:p="o"] element variant {_, t_variant }* & [xrc:p="o"] element font {_, t_font }* & [xrc:p="o"] element ownfont {_, t_font }* & [xrc:p="o"] element help {_, t_text }* @@ -447,6 +448,8 @@ t_font = ( [xrc:p="o"] element relativesize {_, t_float }* ) +t_variant = "normal" | "small" | "mini" | "large" + t_imagelist = ( [xrc:p="o"] element mask {_, t_bool }* & [xrc:p="o"] element size {_, t_size }* & diff --git a/samples/xrc/rc/derivdlg.xrc b/samples/xrc/rc/derivdlg.xrc index b1df3f0880..26bea4f7c6 100644 --- a/samples/xrc/rc/derivdlg.xrc +++ b/samples/xrc/rc/derivdlg.xrc @@ -27,6 +27,7 @@ 5 + small diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 862eabdbab..d1cc96e219 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -2401,6 +2401,31 @@ void wxXmlResourceHandlerImpl::SetupWindow(wxWindow *wnd) { //FIXME : add cursor + const wxString variant = GetParamValue(wxS("variant")); + if (!variant.empty()) + { + if (variant == wxS("normal")) + wnd->SetWindowVariant(wxWINDOW_VARIANT_NORMAL); + else if (variant == wxS("small")) + wnd->SetWindowVariant(wxWINDOW_VARIANT_SMALL); + else if (variant == wxS("mini")) + wnd->SetWindowVariant(wxWINDOW_VARIANT_MINI); + else if (variant == wxS("large")) + wnd->SetWindowVariant(wxWINDOW_VARIANT_LARGE); + else + { + ReportParamError + ( + wxS("variant"), + wxString::Format + ( + "Invalid window variant \"%s\": must be one of " + "normal|small|mini|large.", + variant + ) + ); + } + } if (HasParam(wxT("exstyle"))) // Have to OR it with existing style, since // some implementations (e.g. wxGTK) use the extra style