Merge branch 'feature-toolbar-proxy' of https://github.com/5cript/nana into 5cript-feature-toolbar-proxy
This commit is contained in:
commit
33afb37b1a
@ -33,6 +33,14 @@ namespace nana
|
||||
{
|
||||
namespace toolbar
|
||||
{
|
||||
struct item_proxy
|
||||
{
|
||||
nana::toolbar& widget;
|
||||
std::size_t button;
|
||||
|
||||
void enable(bool enable_state);
|
||||
};
|
||||
|
||||
struct toolbar_events
|
||||
: public general_events
|
||||
{
|
||||
@ -88,8 +96,8 @@ namespace nana
|
||||
toolbar(window, const rectangle& = rectangle(), bool visible = true, bool detached = false);
|
||||
|
||||
void separate(); ///< Adds a separator.
|
||||
void append(const ::std::string& text, const nana::paint::image& img); ///< Adds a control button.
|
||||
void append(const ::std::string& text); ///< Adds a control button.
|
||||
drawerbase::toolbar::item_proxy append(const ::std::string& text, const nana::paint::image& img); ///< Adds a control button.
|
||||
drawerbase::toolbar::item_proxy append(const ::std::string& text); ///< Adds a control button.
|
||||
bool enable(size_type index) const;
|
||||
void enable(size_type index, bool enable_state);
|
||||
void scale(unsigned s); ///< Sets the scale of control button.
|
||||
|
@ -47,8 +47,6 @@ namespace nana
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class item_container
|
||||
{
|
||||
public:
|
||||
@ -421,6 +419,12 @@ namespace nana
|
||||
}
|
||||
}
|
||||
//class drawer
|
||||
|
||||
// Item Proxy
|
||||
void item_proxy::enable(bool enable_state)
|
||||
{
|
||||
widget.enable(button, enable_state);
|
||||
}
|
||||
}//end namespace toolbar
|
||||
}//end namespace drawerbase
|
||||
|
||||
@ -449,16 +453,18 @@ namespace nana
|
||||
API::refresh_window(handle());
|
||||
}
|
||||
|
||||
void toolbar::append(const std::string& text, const nana::paint::image& img)
|
||||
drawerbase::toolbar::item_proxy toolbar::append(const std::string& text, const nana::paint::image& img)
|
||||
{
|
||||
get_drawer_trigger().items().push_back(text, img);
|
||||
API::refresh_window(handle());
|
||||
return {*this, get_drawer_trigger().items().size() - 1u};
|
||||
}
|
||||
|
||||
void toolbar::append(const std::string& text)
|
||||
drawerbase::toolbar::item_proxy toolbar::append(const std::string& text)
|
||||
{
|
||||
get_drawer_trigger().items().push_back(text, {});
|
||||
API::refresh_window(this->handle());
|
||||
return {*this, get_drawer_trigger().items().size() - 1u};
|
||||
}
|
||||
|
||||
bool toolbar::enable(size_type pos) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user