add new scroll_into_view() for treebox

This commit is contained in:
Jinhao
2018-09-08 18:01:48 +08:00
parent 8d22ff3b51
commit c1b88c430a
2 changed files with 239 additions and 105 deletions

View File

@@ -87,13 +87,15 @@ namespace nana
class trigger
:public drawer_trigger
{
template<typename Renderer>
struct basic_implement;
//template<typename Renderer>
//struct basic_implement; //deprecated
class item_renderer;
class implementation;
//class item_renderer; //deprecated
class item_locator;
typedef basic_implement<item_renderer> implement;
//typedef basic_implement<item_renderer> implement; //deprecated
public:
struct treebox_node_type
{
@@ -116,20 +118,22 @@ namespace nana
trigger();
~trigger();
implement * impl() const;
implementation * impl() const;
void check(node_type*, checkstate);
void renderer(::nana::pat::cloneable<renderer_interface>&&);
const ::nana::pat::cloneable<renderer_interface>& renderer() const;
pat::cloneable<renderer_interface>& renderer() const;
//void renderer(::nana::pat::cloneable<renderer_interface>&&);
//const ::nana::pat::cloneable<renderer_interface>& renderer() const; //deprecated
void placer(::nana::pat::cloneable<compset_placer_interface>&&);
const ::nana::pat::cloneable<compset_placer_interface>& placer() const;
node_type* insert(node_type*, const std::string& key, std::string&&);
node_type* insert(const std::string& path, std::string&&);
node_type * selected() const;
void selected(node_type*);
//node_type * selected() const; //deprecated
//void selected(node_type*);
node_image_tag& icon(const ::std::string&) const;
void icon_erase(const ::std::string&);
@@ -137,6 +141,7 @@ namespace nana
unsigned node_width(const node_type*) const;
bool rename(node_type*, const char* key, const char* name);
private:
//Overrides drawer_trigger methods
void attached(widget_reference, graph_reference) override;
@@ -152,7 +157,7 @@ namespace nana
void key_press(graph_reference, const arg_keyboard&) override;
void key_char(graph_reference, const arg_keyboard&) override;
private:
implement * const impl_;
implementation * const impl_;
}; //end class trigger
@@ -378,7 +383,7 @@ namespace nana
template<typename ItemRenderer>
treebox & renderer(const ItemRenderer & rd) ///< set user-defined node renderer
{
get_drawer_trigger().renderer(::nana::pat::cloneable<renderer_interface>(rd));
get_drawer_trigger().renderer() = ::nana::pat::cloneable<renderer_interface>{rd};
return *this;
}
@@ -445,6 +450,9 @@ namespace nana
item_proxy selected() const; ///< returns the selected node
/// Scrolls a specified item into view
void scroll_into_view(item_proxy item, align_v);
private:
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() override;