add scroll_operation_interface

This commit is contained in:
Jinhao
2018-04-21 03:49:15 +08:00
parent 2cf374705f
commit 0c7e8a8ca2
13 changed files with 258 additions and 203 deletions

View File

@@ -297,6 +297,19 @@ that return a corresponding nana::appearance with predefined values.
virtual bool visible() const = 0;
};//end class caret_interface
/// Interface for scroll operations
/**
* This interface provides methods to operate the scrollbars that are contained
* in a specific widget, such as listbox and treebox
*/
class scroll_operation_interface
{
public:
virtual ~scroll_operation_interface() = default;
virtual bool visible(bool vert) const = 0;
};
namespace parameters
{
/// The system-wide parameters for mouse wheel

View File

@@ -1541,6 +1541,7 @@ the nana::detail::basic_window member pointer scheme
nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const override;
drawerbase::listbox::category_t* _m_assoc(std::shared_ptr<nana::detail::key_interface>, bool create_if_not_exists);
void _m_erase_key(nana::detail::key_interface*) noexcept;
std::shared_ptr<scroll_operation_interface> _m_scroll_operation();
};
}//end namespace nana

View File

@@ -1,7 +1,7 @@
/*
* A text editor implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -219,6 +219,8 @@ namespace nana{ namespace widgets
const skeletons::textbase<char_type>& textbase() const;
bool try_refresh();
std::shared_ptr<scroll_operation_interface> scroll_operation() const;
private:
nana::color _m_draw_colored_area(paint::graphics& graph, const std::pair<std::size_t,std::size_t>& row, bool whole_line);
std::vector<upoint> _m_render_text(const ::nana::color& text_color);

View File

@@ -1,7 +1,7 @@
/**
* A Textbox Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -279,6 +279,7 @@ namespace nana
native_string_type _m_caption() const throw() override;
void _m_caption(native_string_type&&) override;
void _m_typeface(const paint::font&) override;
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() const;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>

View File

@@ -1,7 +1,7 @@
/**
* A Tree Box Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
@@ -445,6 +445,9 @@ namespace nana
item_proxy selected() const; ///< returns the selected node
private:
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() const;
};//end class treebox
}//end namespace nana

View File

@@ -1,7 +1,7 @@
/**
* The fundamental widget class implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -83,6 +83,8 @@ namespace nana
void focus();
bool focused() const;
std::shared_ptr<scroll_operation_interface> scroll_operation();
void show(); ///< Sets the window visible.
void hide(); ///< Sets the window invisible.
bool visible() const;
@@ -137,6 +139,7 @@ namespace nana
virtual void _m_close();
virtual bool _m_enabled() const;
virtual void _m_enabled(bool);
virtual std::shared_ptr<scroll_operation_interface> _m_scroll_operation();
virtual bool _m_show(bool);
virtual bool _m_visible() const;
virtual void _m_size(const nana::size&);