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