78 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  *	A Content View Implementation
 | |
|  *	Nana C++ Library(http://www.nanapro.org)
 | |
|  *	Copyright(C) 2017 Jinhao(cnjinhao@hotmail.com)
 | |
|  *
 | |
|  *	Distributed under the Boost Software License, Version 1.0.
 | |
|  *	(See accompanying file LICENSE_1_0.txt or copy at
 | |
|  *	http://www.boost.org/LICENSE_1_0.txt)
 | |
|  *
 | |
|  *	@file: nana/gui/widgets/skeletons/content_view.hpp
 | |
|  *	@author: Jinhao
 | |
|  */
 | |
| 
 | |
| #ifndef NANA_WIDGETS_SKELETONS_CONTENT_VIEW_INCLUDED
 | |
| #define NANA_WIDGETS_SKELETONS_CONTENT_VIEW_INCLUDED
 | |
| 
 | |
| #include <nana/gui/basis.hpp>
 | |
| #include <functional>
 | |
| 
 | |
| namespace nana { namespace widgets {
 | |
| namespace skeletons
 | |
| {
 | |
| 	class content_view
 | |
| 	{
 | |
| 		struct implementation;
 | |
| 
 | |
| 		content_view(const content_view&) = delete;
 | |
| 		content_view& operator=(const content_view&) = delete;
 | |
| 
 | |
| 		content_view(content_view&&) = delete;
 | |
| 		content_view& operator=(content_view&&) = delete;
 | |
| 	public:
 | |
| 		struct events_type
 | |
| 		{
 | |
| 			std::function<void(const point&)> hover_outside;
 | |
| 		};
 | |
| 
 | |
| 		content_view(window handle);
 | |
| 		~content_view();
 | |
| 
 | |
| 		events_type& events();
 | |
| 
 | |
| 		void step(unsigned step_value, bool horz);
 | |
| 		bool scroll(bool forwards, bool horz);
 | |
| 		bool turn_page(bool forwards, bool horz);
 | |
| 
 | |
| 		void disp_area(const rectangle& da, const point& skew_horz, const point& skew_vert, const size& extra_px, bool try_update = true);
 | |
| 
 | |
| 		void content_size(const size& sz, bool try_update = true);
 | |
| 		const point& origin() const;
 | |
| 		rectangle corner() const;
 | |
| 
 | |
| 		rectangle view_area() const;
 | |
| 
 | |
| 		unsigned extra_space(bool horz) const;
 | |
| 
 | |
| 		void change_position(int pos, bool aligned, bool horz);
 | |
| 
 | |
| 		void move_origin(const point& skew);
 | |
| 
 | |
| 		void sync(bool try_update);
 | |
| 
 | |
| 		void pursue(const point& cursor);
 | |
| 
 | |
| 		void set_wheel_speed(std::function<unsigned()> fn);
 | |
| 	private:
 | |
| 		static constexpr unsigned _m_extra_px()
 | |
| 		{
 | |
| 			return 16;
 | |
| 		}
 | |
| 	private:
 | |
| 		implementation * const impl_;
 | |
| 	};
 | |
| }
 | |
| }
 | |
| }
 | |
| 
 | |
| #endif | 
