From e72bec2c8f60300570ef3082c0e8881951219669 Mon Sep 17 00:00:00 2001 From: James Bremner Date: Sun, 25 Nov 2018 13:52:00 -0500 Subject: [PATCH 1/2] Add method to check option in group --- include/nana/gui/widgets/group.hpp | 15 +++++++++++---- source/gui/widgets/group.cpp | 12 +++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp index 2e264289..6d20fb83 100644 --- a/include/nana/gui/widgets/group.hpp +++ b/include/nana/gui/widgets/group.hpp @@ -3,8 +3,8 @@ * Nana C++ Library(http://www.nanaro.org) * Copyright(C) 2015 Jinhao(cnjinhao@hotmail.com) * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/gui/widgets/group.hpp @@ -55,9 +55,16 @@ namespace nana{ /// Enables/disables the radio mode which is single selection group& radio_mode(bool); - /// Returns the index of option in radio_mode, it throws a logic_error if radio_mode is false. + /// Returns the index of selected option in radio_mode, it throws a logic_error if radio_mode is false. std::size_t option() const; + /** Set check/unchecked status of specified option + @param[in] pos zero-based index of option to set + @param[in] check status required, defaults to checked + throws an out_of_range if !(pos < number of options) + */ + void option_check( std::size_t pos, bool check = true ); + /// Determines whether a specified option is checked, it throws an out_of_range if !(pos < number of options) bool option_checked(std::size_t pos) const; @@ -66,7 +73,7 @@ namespace nana{ group& collocate() throw(); group& div(const char* div_str) throw(); field_reference operator[](const char* field); - + template Widget* create_child(const char* field, Args && ... args) { diff --git a/source/gui/widgets/group.cpp b/source/gui/widgets/group.cpp index ab8e9e73..d2666383 100644 --- a/source/gui/widgets/group.cpp +++ b/source/gui/widgets/group.cpp @@ -3,8 +3,8 @@ * Nana C++ Library(http://www.nanaro.org) * Copyright(C) 2015-2017 Jinhao(cnjinhao@hotmail.com) * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/gui/widgets/group.cpp @@ -14,7 +14,7 @@ * @brief group is a widget used to visually group and layout other widgets. * * @contributor: - * dankan1890(https://github.com/dankan1890) + * dankan1890(https://github.com/dankan1890) */ @@ -160,6 +160,12 @@ namespace nana{ throw std::logic_error("the radio_mode of the group is disabled"); } + void group::option_check( std::size_t pos, bool check ) + { + _THROW_IF_EMPTY(); + return impl_->options.at(pos)->check( check ); + } + bool group::option_checked(std::size_t pos) const { _THROW_IF_EMPTY(); From a4c9c0ac8ee56d073e03094affeae35b39d7b3c2 Mon Sep 17 00:00:00 2001 From: James Bremner Date: Sun, 25 Nov 2018 15:04:01 -0500 Subject: [PATCH 2/2] Restore some lost lines --- include/nana/gui/widgets/group.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp index 6d20fb83..97f3caf9 100644 --- a/include/nana/gui/widgets/group.hpp +++ b/include/nana/gui/widgets/group.hpp @@ -74,6 +74,10 @@ namespace nana{ group& div(const char* div_str) throw(); field_reference operator[](const char* field); + void field_display(const char* field_name, bool display); /// Widget* create_child(const char* field, Args && ... args) {