improve group widget
This commit is contained in:
parent
51f9e87979
commit
ac9137c1b3
@ -49,24 +49,21 @@ namespace nana{
|
|||||||
~group();
|
~group();
|
||||||
|
|
||||||
/// Adds an option for user selection
|
/// Adds an option for user selection
|
||||||
void add_option(::nana::string);
|
group& add_option(::nana::string);
|
||||||
|
|
||||||
/// Enables/disables the radio mode which is single selection
|
/// Enables/disables the radio mode which is single selection
|
||||||
void radio_mode(bool);
|
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 option in radio_mode, it throws a logic_error if radio_mode is false.
|
||||||
std::size_t option() const;
|
std::size_t option() const;
|
||||||
|
|
||||||
/// Determines a specified option is checked, it throws an out_of_range if !(pos < number of options)
|
/// 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;
|
bool option_checked(std::size_t pos) const;
|
||||||
|
|
||||||
group& enable_format_caption(bool format);
|
group& enable_format_caption(bool format);
|
||||||
|
|
||||||
|
group& collocate() throw();
|
||||||
place& get_place();
|
group& div(const char* div_str) throw();
|
||||||
|
|
||||||
void collocate();
|
|
||||||
void div(const char* div_str);
|
|
||||||
field_reference operator[](const char* field);
|
field_reference operator[](const char* field);
|
||||||
|
|
||||||
template<typename Widget, typename ...Args>
|
template<typename Widget, typename ...Args>
|
||||||
|
|||||||
@ -53,6 +53,9 @@ namespace nana{
|
|||||||
caption.create(pnl);
|
caption.create(pnl);
|
||||||
caption.caption(STR(""));
|
caption.caption(STR(""));
|
||||||
place_content.bind(pnl);
|
place_content.bind(pnl);
|
||||||
|
|
||||||
|
if (!radio_logic)
|
||||||
|
radio_logic = new radio_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_div()
|
void update_div()
|
||||||
@ -100,7 +103,7 @@ namespace nana{
|
|||||||
delete impl_->radio_logic;
|
delete impl_->radio_logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void group::add_option(::nana::string text)
|
group& group::add_option(::nana::string text)
|
||||||
{
|
{
|
||||||
_THROW_IF_EMPTY()
|
_THROW_IF_EMPTY()
|
||||||
|
|
||||||
@ -112,9 +115,13 @@ namespace nana{
|
|||||||
impl_->place_content.field_display(field_options, true);
|
impl_->place_content.field_display(field_options, true);
|
||||||
impl_->place_content.collocate();
|
impl_->place_content.collocate();
|
||||||
|
|
||||||
|
if (impl_->radio_logic)
|
||||||
|
impl_->radio_logic->add(*opt);
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void group::radio_mode(bool enable)
|
group& group::radio_mode(bool enable)
|
||||||
{
|
{
|
||||||
_THROW_IF_EMPTY()
|
_THROW_IF_EMPTY()
|
||||||
|
|
||||||
@ -133,6 +140,7 @@ namespace nana{
|
|||||||
delete impl_->radio_logic;
|
delete impl_->radio_logic;
|
||||||
impl_->radio_logic = nullptr;
|
impl_->radio_logic = nullptr;
|
||||||
}
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t group::option() const
|
std::size_t group::option() const
|
||||||
@ -157,26 +165,21 @@ namespace nana{
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
place& group::get_place()
|
group& group::collocate()
|
||||||
{
|
|
||||||
return impl_->place_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
void group::collocate()
|
|
||||||
{
|
{
|
||||||
impl_->place_content.collocate();
|
impl_->place_content.collocate();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void group::div(const char* div_str)
|
group& group::div(const char* div_str)
|
||||||
{
|
{
|
||||||
::nana::size sz = impl_->caption.measure(1000);
|
|
||||||
|
|
||||||
if (div_str)
|
if (div_str)
|
||||||
impl_->usr_div_str = div_str;
|
impl_->usr_div_str = div_str;
|
||||||
else
|
else
|
||||||
impl_->usr_div_str.clear();
|
impl_->usr_div_str.clear();
|
||||||
|
|
||||||
impl_->update_div();
|
impl_->update_div();
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
group::field_reference group::operator[](const char* field)
|
group::field_reference group::operator[](const char* field)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user