Merge branch 'hotfix-1.4.1' into feature-listbox

This commit is contained in:
Jinhao
2016-12-13 08:58:31 +08:00
18 changed files with 1688 additions and 1479 deletions

View File

@@ -39,6 +39,9 @@ namespace nana
{
namespace listbox
{
using size_type = std::size_t;
using native_string_type = ::nana::detail::native_string_type;
/// An interface of column operations
class column_interface
{
@@ -62,6 +65,22 @@ namespace nana
*/
virtual void width(unsigned minimum, unsigned maximum) = 0;
/// Returns the position of the column
/**
* @param disp_order Indicates whether the display position or absolute position to be returned
* @return the position of the column.
*/
virtual size_type position(bool disp_order) const noexcept = 0;
/// Returns the caption of column
virtual std::string text() const noexcept = 0;
/// Sets the caption of column
/**
* @param text_utf8 A UTF-8 string for the caption.
*/
virtual void text(std::string text_utf8) = 0;
/// Sets alignment of column text
/**
* @param align Alignment
@@ -625,8 +644,6 @@ namespace nana
std::unique_ptr<container_interface> container_ptr_;
};
using size_type = std::size_t;
using native_string_type = ::nana::detail::native_string_type;
/// usefull for both absolute and display (sorted) positions
struct index_pair
@@ -839,10 +856,18 @@ namespace nana
size_type columns() const noexcept;
item_proxy& text(size_type col, cell);
item_proxy& text(size_type col, std::string);
item_proxy& text(size_type col, const std::wstring&);
std::string text(size_type col) const;
/// Converts a position of column between display position and absolute position
/**
* @param col The display position or absolute position.
* @param disp_order Indicates whether the col is a display position or absolute position. If this parameter is true, the col is display position
* @return absolute position if disp_order is false, display position otherwise.
*/
size_type column_cast(size_type col, bool disp_order) const;
item_proxy& text(size_type abs_col, cell);
item_proxy& text(size_type abs_col, std::string);
item_proxy& text(size_type abs_col, const std::wstring&);
std::string text(size_type abs_col) const;
void icon(const nana::paint::image&);
@@ -1377,18 +1402,20 @@ the nana::detail::basic_window member pointer scheme
/// Access a column at specified position
/**
* @param pos Position of column
* @param disp_order Indicates whether the pos is display position or absolute position.
* @return Reference to the requested column
* @except std::out_of_range if !(pos < columns())
*/
column_interface & column_at(size_type pos);
column_interface & column_at(size_type pos, bool disp_order = false);
/// Access a column at specified position
/**
* @param pos Position of column
* @param disp_order Indicates whether the pos is display position or absolute position.
* @return Constant reference to the requested column
* @except std::out_of_range if !(pos < columns())
*/
const column_interface & column_at(size_type pos) const;
const column_interface & column_at(size_type pos, bool disp_order = false) const;
/// Returns the number of columns
size_type column_size() const;
@@ -1418,7 +1445,7 @@ the nana::detail::basic_window member pointer scheme
/// Returns an index of item which contains the specified point.
index_pair cast(const point & screen_pos) const;
/// Returns the column which contains the specified point.
/// Returns the absolute position of column which contains the specified point.
size_type column_from_pos(const point & pos);
void checkable(bool);

View File

@@ -248,7 +248,7 @@ namespace nana
API::refresh_window(this->handle());
}
pat::cloneable<item_renderer>& renderer() const
const pat::cloneable<item_renderer>& renderer() const
{
return this->get_drawer_trigger().ext_renderer();
}

View File

@@ -24,6 +24,9 @@ namespace nana
{
friend class i18n_eval;
public:
/// Sets a handler to handle a msgid which hasn't been translated.
static void set_missing(std::function<void(const std::string& msgid_utf8)> handler);
void load(const std::string& file);
void load_utf8(const std::string& file);

View File

@@ -426,7 +426,7 @@ namespace detail
unsigned char * fade_table = nullptr;
std::unique_ptr<unsigned char[]> autoptr;
nana::pixel_argb_t rgb_imd;
nana::pixel_argb_t rgb_imd = {};
if(fade_rate != 0.0)
{
autoptr = detail::alloc_fade_table(1 - fade_rate);

View File

@@ -12,7 +12,7 @@
#ifndef NANA_SYSTEM_DATAEXCH_HPP
#define NANA_SYSTEM_DATAEXCH_HPP
#include <nana/basic_types.hpp>
#include <nana/gui/basis.hpp>
namespace nana{
@@ -31,15 +31,15 @@ namespace system{
text, pixmap
};
void set(const std::string & text_utf8);
void set(const std::wstring& text);
void set(const std::string & text_utf8, native_window_type owner = nullptr);
void set(const std::wstring& text, native_window_type owner = nullptr);
bool set(const nana::paint::graphics& g);
bool set(const nana::paint::graphics& g, native_window_type owner = nullptr);
void get(std::string& text_utf8);
void get(std::wstring& text);
private:
bool _m_set(format, const void* buf, std::size_t size);
bool _m_set(format, const void* buf, std::size_t size, native_window_type);
void* _m_get(format, size_t& size);
};