Merge remote-tracking branch 'cnjinhao/develop-1.7' into cmake-dev

This commit is contained in:
qPCR4vir
2018-10-01 11:39:04 +02:00
11 changed files with 441 additions and 185 deletions

View File

@@ -211,10 +211,10 @@
#undef _nana_std_optional
#if ((defined(_MSC_VER) && (_MSC_VER >= 1912) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201703))) || \
((__cplusplus < 201703L) || \
#if ((defined(_MSC_VER) && ((!defined(_MSVC_LANG)) || _MSVC_LANG < 201703))) || \
((!defined(_MSC_VER)) && ((__cplusplus < 201703L) || \
(defined(__clang__) && (__clang_major__ * 100 + __clang_minor__ < 400)) || \
(!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 701)) \
(!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 701))) \
)
# define _nana_std_optional
#endif

View File

@@ -1,7 +1,7 @@
/*
* An Animation Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 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
@@ -49,24 +49,18 @@ namespace nana
struct impl;
class performance_manager;
/// Non-copyable
animation(const animation&) = delete;
animation& operator=(const animation&) = delete;
public:
animation(std::size_t fps = 23);
~animation();
void push_back(frameset frms);
/*
void branch(const std::string& name, const frameset& frms)
{
impl_->branches[name].frames = frms;
}
animation(animation&&);
animation& operator=(animation&&);
void branch(const std::string& name, const frameset& frms, std::function<std::size_t(const std::string&, std::size_t, std::size_t&)> condition)
{
auto & br = impl_->branches[name];
br.frames = frms;
br.condition = condition;
}
*/
void push_back(frameset frms);
void looped(bool enable); ///< Enables or disables the animation repeating playback.

View File

@@ -1,7 +1,7 @@
/*
* A Menubar implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2009-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2009-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -34,26 +34,6 @@ namespace nana
color_proxy border_highlight{ colors::highlight };
};
class item_renderer
{
public:
enum class state
{
normal, highlighted, selected
};
using graph_reference = paint::graphics&;
using scheme = ::nana::drawerbase::menubar::scheme;
item_renderer(window, graph_reference);
virtual void background(const point&, const ::nana::size&, state);
virtual void caption(const point&, const native_string_type&);
scheme *scheme_ptr() const { return scheme_ptr_; };
private:
graph_reference graph_;
scheme *scheme_ptr_;
};
class trigger
: public drawer_trigger
{

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,27 +118,30 @@ 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;
node_image_tag& icon(const ::std::string&);
void icon_erase(const ::std::string&);
void node_icon(node_type*, const ::std::string& id);
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
@@ -171,11 +176,11 @@ namespace nana
/// Append a child with a specified value (user object.).
template<typename T>
item_proxy append(const ::std::string& key, ::std::string name, const T&t)
item_proxy append(const ::std::string& key, ::std::string name, T&& t)
{
item_proxy ip = append(key, std::move(name));
if(false == ip.empty())
ip.value(t);
ip.value(std::forward<T>(t));
return ip;
}
@@ -291,17 +296,19 @@ namespace nana
return *p;
}
/*
template<typename T>
item_proxy & value(const T& t)
item_proxy & value(const T& t) //deprecated
{
_m_value() = t;
return *this;
}
*/
template<typename T>
item_proxy & value(T&& t)
{
_m_value() = std::move(t);
_m_value() = std::forward<T>(t);
return *this;
}
@@ -378,7 +385,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;
}
@@ -403,6 +410,23 @@ namespace nana
/// @param enable bool whether to enable.
void auto_draw(bool enable);
/// Prevents drawing during execution.
template<typename Function>
void avoid_drawing(Function fn)
{
this->auto_draw(false);
try
{
fn();
}
catch (...)
{
this->auto_draw(true);
throw;
}
this->auto_draw(true);
}
/// \brief Enable the checkboxs for each item of the widget.
/// @param enable bool indicates whether to show or hide the checkboxs.
treebox & checkable(bool enable);
@@ -419,8 +443,9 @@ namespace nana
/// These states are 'normal', 'hovered' and 'expanded'.
/// If 'hovered' or 'expanded' are not set, it uses 'normal' state image for these 2 states.
/// See also in [documentation](http://nanapro.org/en-us/help/widgets/treebox.htm)
node_image_type& icon(const ::std::string& id ///< the name of an icon scheme. If the name is not existing, it creates a new scheme for the name.
) const;
/// @param id The name of an icon scheme. If the name is not existing, it creates a new scheme for the name.
/// @return The reference of node image scheme correspending with the specified id.
node_image_type& icon(const ::std::string& id);
void icon_erase(const ::std::string& id);
@@ -445,6 +470,19 @@ namespace nana
item_proxy selected() const; ///< returns the selected node
/// Scrolls a specified item into view.
/**
* @param item An item to be requested.
* @param bearing The position where the item to be positioned in the view.
*/
void scroll_into_view(item_proxy item, align_v bearing);
/// Scrolls a specified item into view.
/**
* @param item An item to be requested.
*/
void scroll_into_view(item_proxy item);
private:
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() override;