Partial implementation of missing nana::typeface()
This commit is contained in:
parent
e7bc1405ec
commit
1d2c7f85f4
@ -77,6 +77,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;
|
||||||
|
|||||||
@ -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__";
|
||||||
@ -203,6 +204,20 @@ namespace nana{
|
|||||||
return impl_->options.at(pos)->checked();
|
return impl_->options.at(pos)->checked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void group::typeface( const nana::paint::font& font )
|
||||||
|
{
|
||||||
|
// change typeface of caption label
|
||||||
|
impl_->caption.typeface( font );
|
||||||
|
|
||||||
|
/* change size of caption label
|
||||||
|
|
||||||
|
The caption may be changed AFTER this call
|
||||||
|
so the neccessary label size is unknown
|
||||||
|
set it to 80% of the current widget width and 50 pixels
|
||||||
|
*/
|
||||||
|
impl_->caption.move( rectangle(0,0,size().width * 0.8,50));
|
||||||
|
}
|
||||||
|
|
||||||
group& group::enable_format_caption(bool format)
|
group& group::enable_format_caption(bool format)
|
||||||
{
|
{
|
||||||
impl_->caption.format(format);
|
impl_->caption.format(format);
|
||||||
@ -271,7 +286,8 @@ namespace nana{
|
|||||||
//When the group is resized, the drawing is called before moving the caption, but
|
//When the group is resized, the drawing is called before moving the caption, but
|
||||||
//the drawing of group requires the lastest position of caption for gradual rectangle.
|
//the drawing of group requires the lastest position of caption for gradual rectangle.
|
||||||
//For the requirement, a move event handler is required for listning the change of caption's position.
|
//For the requirement, a move event handler is required for listning the change of caption's position.
|
||||||
impl_->caption.events().move([this](const arg_move&){
|
impl_->caption.events().move([this](const arg_move&)
|
||||||
|
{
|
||||||
if (align::left != impl_->caption_align)
|
if (align::left != impl_->caption_align)
|
||||||
API::refresh_window(*this);
|
API::refresh_window(*this);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user