fixed menubar width issue
the width of menubar is not changed when its parent window is resized
This commit is contained in:
parent
977a6c0e86
commit
3ba765ea68
@ -102,12 +102,15 @@ namespace nana
|
||||
: public widget_object<category::widget_tag, drawerbase::menubar::trigger>
|
||||
{
|
||||
public:
|
||||
menubar(); ///< The default constructor delay creation.
|
||||
menubar() = default; ///< The default constructor delay creation.
|
||||
menubar(window); ///< Create a menubar at the top of the specified window.
|
||||
~menubar();
|
||||
void create(window); ///< Create a menubar at the top of the specified window.
|
||||
menu& push_back(const nana::string&); ///< Appends a new (empty) menu.
|
||||
menu& at(size_t index) const; ///< Gets the menu specified by index.
|
||||
std::size_t length() const; ///< Number of menus.
|
||||
private:
|
||||
::nana::event_handle evt_resized_{nullptr};
|
||||
};//end class menubar
|
||||
}//end namespace nana
|
||||
#endif
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user