Merge branch 'hotfixes' of https://github.com/qPCR4vir/nana into qPCR4vir-hotfixes

This commit is contained in:
Jinhao
2015-05-02 03:10:54 +08:00
4 changed files with 276 additions and 135 deletions

View File

@@ -96,7 +96,8 @@ namespace nana
//System Code for OS
os_pageup = 0x21, os_pagedown,
os_arrow_left = 0x25, os_arrow_up, os_arrow_right, os_arrow_down,
os_insert = 0x2D, os_del
os_insert = 0x2D, os_del ,
os_end = 0x23 , os_home //Pos 1
};
};

View File

@@ -17,6 +17,7 @@
#include "widget.hpp"
#include <nana/concepts.hpp>
#include <nana/key_type.hpp>
//#include <nana/paint/graphics.hpp>
#include <functional>
#include <initializer_list>
@@ -28,7 +29,7 @@ namespace nana
{
namespace listbox
{
typedef std::size_t size_type;
using size_type = std::size_t ;
struct cell
{
@@ -36,7 +37,7 @@ namespace nana
{
::nana::color bgcolor;
::nana::color fgcolor;
/// ::nana::paint::font font; \todo
format() = default;
format(const ::nana::color& bgcolor, const ::nana::color& fgcolor);
};
@@ -195,6 +196,7 @@ namespace nana
void dbl_click(graph_reference, const arg_mouse&) override;
void resized(graph_reference, const arg_resized&) override;
void key_press(graph_reference, const arg_keyboard&) override;
void key_char(graph_reference, const arg_keyboard&) override;
private:
essence_t * essence_;
drawer_header_impl *drawer_header_;
@@ -429,7 +431,19 @@ namespace nana
category_t* cat_{nullptr};
size_type pos_{0}; ///< Absolute position, not relative to display, and dont change during sort()
};
}
struct export_options
{
nana::string sep = nana::string {STR("\t" )},
endl= nana::string {STR("\n")} ;
bool only_selected_items{true},
only_checked_items {false},
only_visible_columns{true};
using columns_indexs = std::vector<size_type>;
columns_indexs columns_order;
};
}
}//end namespace drawerbase
struct arg_listbox
@@ -482,7 +496,9 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
using selection = drawerbase::listbox::selection; ///<A container type for items.
using iresolver = drawerbase::listbox::iresolver;
using oresolver = drawerbase::listbox::oresolver;
using cell = drawerbase::listbox::cell;
using cell = drawerbase::listbox::cell;
using export_options= drawerbase::listbox::export_options;
using columns_indexs= drawerbase::listbox::size_type;
public:
listbox() = default;
listbox(window, bool visible);
@@ -498,8 +514,11 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
void append(std::initializer_list<nana::string>); ///<Appends categories at the end
cat_proxy insert(cat_proxy, nana::string);
cat_proxy at(size_type pos) const;
/// add categories in order when use a key?
listbox& ordered_categories(bool);
/// return a proxy to tha cat with the key or create a new one in the right order
template<typename Key>
cat_proxy operator[](const Key & ck)
{
@@ -580,6 +599,7 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
void enable_single(bool for_selection, bool category_limited);
void disable_single(bool for_selection);
export_options& def_export_options();
private:
drawerbase::listbox::essence_t & _m_ess() const;
nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const;

View File

@@ -22,10 +22,10 @@ namespace nana
virtual ~key_interface(){}
virtual bool same_type(const key_interface*) const = 0;
virtual bool compare(const key_interface*) const = 0;
virtual bool compare(const key_interface*) const = 0; ///< is this key less than right key? [call it less(rk), less_than(rk) or compare_less(rk)?: if (lk.less_than(rk )) ]
}; //end class key_interface
//Use less compare for equal compare
//Use less compare for equal compare [call it equal_by_less()?]
inline bool pred_equal_by_less(const key_interface * left, const key_interface* right)
{
return (left->compare(right) == false) && (right->compare(left) == false);