From 7a13979f5af969f39986582c118f5463757afb76 Mon Sep 17 00:00:00 2001 From: Alexander Koshelev Date: Fri, 31 Dec 2021 14:05:59 +0300 Subject: [PATCH] XRC: ability to create wxButton with wxBitmapBundle --- docs/doxygen/overviews/xrc_format.h | 4 +++- misc/schema/xrc_schema.rnc | 5 ++++- src/xrc/xh_bttn.cpp | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 7024ccadd2..344571ac17 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -912,7 +912,9 @@ Example: @row3col{label, @ref overview_xrcformat_type_text, Label to display on the button (may be omitted if only the bitmap or stock ID is used).} @row3col{bitmap, @ref overview_xrcformat_type_bitmap, - Bitmap to display in the button (optional).} + Bitmap to display in the button (optional). Mutually exclusive with @c bitmaps.} +@row3col{bitmaps, @ref overview_xrcformat_type_bitmaps, + BitmapBundle to display in the button (optional). Mutually exclusive with @c bitmap.} @row3col{bitmapposition, @c wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, Position of the bitmap in the button, see wxButton::SetBitmapPosition() (default: wxLEFT).} @row3col{default, @ref overview_xrcformat_type_bool, diff --git a/misc/schema/xrc_schema.rnc b/misc/schema/xrc_schema.rnc index f65a6deb9a..d738459d5d 100644 --- a/misc/schema/xrc_schema.rnc +++ b/misc/schema/xrc_schema.rnc @@ -742,7 +742,10 @@ wxButton = stdObjectNodeAttributes & stdWindowProperties & [xrc:p="o"] element label {_, t_text }* & - [xrc:p="o"] element bitmap {_, t_bitmap }* & + [xrc:p="o"]( + element bitmap {_, t_bitmap } | + element bitmaps {_, t_bitmaps } + )* & [xrc:p="o"] element bitmapposition {_, t_direction }* & [xrc:p="o"] element default {_, t_bool }* } diff --git a/src/xrc/xh_bttn.cpp b/src/xrc/xh_bttn.cpp index 5fa3b8867d..328866d7a3 100644 --- a/src/xrc/xh_bttn.cpp +++ b/src/xrc/xh_bttn.cpp @@ -47,10 +47,10 @@ wxObject *wxButtonXmlHandler::DoCreateResource() if (GetBool(wxT("default"), 0)) button->SetDefault(); - if ( GetParamNode("bitmap") ) + wxBitmapBundle bb = GetBitmapOrBitmaps("bitmap", "bitmaps", wxART_BUTTON); + if ( bb.IsOk() ) { - button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON), - GetDirection("bitmapposition")); + button->SetBitmap(bb); } SetupWindow(button);