fixed menubar width issue

the width of menubar is not changed when its parent window is resized
This commit is contained in:
cnjinhao
2015-01-02 13:55:34 +08:00
parent 977a6c0e86
commit 3ba765ea68
2 changed files with 15 additions and 2 deletions

View File

@@ -574,17 +574,27 @@ namespace nana
//class menubar
menubar::menubar(){}
menubar::menubar(window wd)
{
create(wd);
}
menubar::~menubar()
{
API::umake_event(evt_resized_);
}
void menubar::create(window wd)
{
widget_object<category::widget_tag, drawerbase::menubar::trigger>
::create(wd, rectangle(nana::size(API::window_size(wd).width, 28)));
API::attach_menubar(handle());
evt_resized_ = API::events(wd).resized([this](const ::nana::arg_resized& arg)
{
auto sz = this->size();
sz.width = arg.width;
this->size(sz);
});
}
menu& menubar::push_back(const nana::string& text)