Merge branch 'JamesBremner-hotfix-1.6.2' into hotfix-1.6.2

This commit is contained in:
Jinhao 2019-01-17 07:37:08 +08:00
commit 4fa1618f48
4 changed files with 110 additions and 94 deletions

View File

@ -85,6 +85,9 @@ namespace nana{
/// Determines whether 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;
/// Change typeface of caption label ( does not effect child widgets )
void typeface( const nana::paint::font& font );
group& enable_format_caption(bool format); group& enable_format_caption(bool format);
group& collocate() noexcept; group& collocate() noexcept;

View File

@ -151,7 +151,13 @@ namespace nana
bool vertical() const; bool vertical() const;
void maximum(unsigned); void maximum(unsigned);
unsigned maximum() const; unsigned maximum() const;
void value(unsigned);
/** Set slider value
@param[in] v new value for slider.
v will be clipped to the range 0 to maximum
*/
void value(int );
unsigned value() const; unsigned value() const;
unsigned move_step(bool forward); ///< Increase or decrease the value of slider. unsigned move_step(bool forward); ///< Increase or decrease the value of slider.
unsigned adorn() const; unsigned adorn() const;

View File

@ -27,7 +27,8 @@
if(empty()) \ if(empty()) \
throw std::logic_error("the group is invalid"); throw std::logic_error("the group is invalid");
namespace nana{ namespace nana
{
static const char* field_title = "__nana_group_title__"; static const char* field_title = "__nana_group_title__";
static const char* field_options = "__nana_group_options__"; static const char* field_options = "__nana_group_options__";
@ -143,6 +144,7 @@ namespace nana{
impl_->options.emplace_back(new checkbox(handle())); impl_->options.emplace_back(new checkbox(handle()));
auto & opt = impl_->options.back(); auto & opt = impl_->options.back();
#endif #endif
opt->transparent(true); opt->transparent(true);
opt->caption(std::move(text)); opt->caption(std::move(text));
impl_->place_content[field_options] << *opt; impl_->place_content[field_options] << *opt;
@ -352,5 +354,6 @@ namespace nana{
impl_->update_div(); impl_->update_div();
impl_->place_content.collocate(); impl_->place_content.collocate();
} }
}//end namespace nana }//end namespace nana

View File

@ -844,10 +844,14 @@ namespace nana
return get_drawer_trigger().get_model()->attribute().vmax; return get_drawer_trigger().get_model()->attribute().vmax;
} }
void slider::value(unsigned v) void slider::value(int v)
{ {
if(handle()) if(handle())
{ {
// limit to positive values, vcur expects unsigned
if( v < 0 )
v = 0;
if(get_drawer_trigger().get_model()->vcur(v)) if(get_drawer_trigger().get_model()->vcur(v))
API::refresh_window(handle()); API::refresh_window(handle());
} }