The construction that creates the widget and set the title or caption

This commit is contained in:
qPCR4vir 2015-07-19 02:42:22 +02:00
parent cfcec75b54
commit ec4a510878
2 changed files with 45 additions and 5 deletions

View File

@ -34,6 +34,17 @@ namespace nana{
/// The construction that creates the widget
group(window parent, const rectangle& = {}, bool visible = true);
/// The construction that creates the widget and set the titel or caption
group(window parent, ///<
string titel_ /*= { STR("") }*/, ///<
bool format = false, ///< Use a formated label?
unsigned gap = 2, ///< betwen the content and the external limit
rectangle r = {} , ///<
bool visible = true
);
/// The destruction
~group();
@ -60,6 +71,7 @@ namespace nana{
void _m_complete_creation() override;
::nana::string _m_caption() const override;
void _m_caption(::nana::string&&) override;
void init();
private:
std::unique_ptr<implement> impl_;
};

View File

@ -33,6 +33,14 @@ namespace nana{
caption.create(pnl);
place_content.bind(pnl);
}
implement() = default;
implement(window grp_panel, string titel, bool format, unsigned gap=2)
: caption (grp_panel, std::move(titel), format),
place_content{grp_panel},
gap{gap}
{
}
};
group::group()
@ -46,6 +54,20 @@ namespace nana{
create(parent, r, vsb);
}
group::group( window parent, ///<
string titel_ /*={}*/, ///<
bool format /*=false*/, ///<
unsigned gap /*=2*/, ///<
rectangle r /*={} */, ///<
bool vsb /*= true */ ///<
)
: panel(parent, r, vsb),
impl_(new implement(*this, std::move(titel_), vsb))
{
impl_->caption.format(format);
init();
}
group::~group()
{
@ -91,12 +113,8 @@ namespace nana{
impl_->place_content[field] << wdg->handle();
}
void group::_m_complete_creation()
void group::init()
{
panel::_m_complete_creation();
impl_->create(handle());
this->div(nullptr);
auto & outter = impl_->place_content;
@ -127,6 +145,16 @@ namespace nana{
});
}
void group::_m_complete_creation()
{
panel::_m_complete_creation();
impl_->create(handle());
init();
}
::nana::string group::_m_caption() const
{
return impl_->caption.caption();