diff --git a/docs/changes.txt b/docs/changes.txt index 8693868a00..82e9bf1155 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -487,6 +487,7 @@ All (GUI): - Allow converting to and from wxGraphicsBitmap and wxImage directly. - Allow wxGraphicsFont creation without passing by wxFont. - Added wxDataViewCustomRenderer::ActivateCell(). +- Add "checked" property for toolbar tool elements in XRC. OSX: diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 71325a6ebb..bd7f0e659b 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -1654,6 +1654,8 @@ properties: Help text shown in statusbar when the mouse is on the tool (default: none).} @row3col{disabled, @ref overview_xrcformat_type_bool, Is the tool initially disabled (default: 0)?} +@row3col{checked, @ref overview_xrcformat_type_bool, + Is the tool initially checked (default: 0)? (only available since wxWidgets 2.9.3)} @endTable The presence of a @c dropdown property indicates that the tool is of type diff --git a/src/xrc/xh_toolb.cpp b/src/xrc/xh_toolb.cpp index 041c8d8b66..c6e75a3615 100644 --- a/src/xrc/xh_toolb.cpp +++ b/src/xrc/xh_toolb.cpp @@ -78,6 +78,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() kind = wxITEM_CHECK; } + #if wxUSE_MENUS // check whether we have dropdown tag inside wxMenu *menu = NULL; // menu for drop down items @@ -137,6 +138,23 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if ( GetBool(wxT("disabled")) ) m_toolbar->EnableTool(GetID(), false); + + if ( GetBool(wxS("checked")) ) + { + if ( kind == wxITEM_NORMAL ) + { + ReportParamError + ( + "checked", + "only nor tools can be checked" + ); + } + else + { + m_toolbar->ToggleTool(GetID(), true); + } + } + #if wxUSE_MENUS if ( menu ) tool->SetDropdownMenu(menu);