listbox header functions are deprecated, use column_interface
This commit is contained in:
parent
488f6ac88c
commit
be59604a08
@ -36,6 +36,42 @@ namespace nana
|
|||||||
{
|
{
|
||||||
namespace listbox
|
namespace listbox
|
||||||
{
|
{
|
||||||
|
/// An interface of column operations
|
||||||
|
class column_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// Destructor
|
||||||
|
virtual ~column_interface() = default;
|
||||||
|
|
||||||
|
/// Returns the width of column, in pixel
|
||||||
|
virtual unsigned width() const noexcept = 0;
|
||||||
|
|
||||||
|
/// Sets width
|
||||||
|
/**
|
||||||
|
* @param pixels The pixels of width
|
||||||
|
*/
|
||||||
|
virtual void width(unsigned pixels) noexcept = 0;
|
||||||
|
|
||||||
|
/// Automatically adjusted width
|
||||||
|
/**
|
||||||
|
* @param minimize The minimized width of column, in pixel
|
||||||
|
* @param maximize The maximized width of column, in pixel
|
||||||
|
*/
|
||||||
|
virtual void width(unsigned minimize, unsigned maximize) = 0;
|
||||||
|
|
||||||
|
/// Sets alignment of column text
|
||||||
|
/**
|
||||||
|
* @param align Alignment
|
||||||
|
*/
|
||||||
|
virtual void text_align(::nana::align align) noexcept = 0;
|
||||||
|
|
||||||
|
/// Adjusts the width to fit the content
|
||||||
|
/**
|
||||||
|
* The priority of max: maximize, ranged width, scheme's max_fit_content.
|
||||||
|
*/
|
||||||
|
virtual void fit_content(unsigned maximize = 0) noexcept = 0;
|
||||||
|
};
|
||||||
|
|
||||||
using size_type = std::size_t;
|
using size_type = std::size_t;
|
||||||
using native_string_type = ::nana::detail::native_string_type;
|
using native_string_type = ::nana::detail::native_string_type;
|
||||||
|
|
||||||
@ -86,9 +122,9 @@ namespace nana
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using selection = std::vector<index_pair>;
|
using index_pairs = ::std::vector<index_pair>;
|
||||||
|
|
||||||
using inline_notifier_interface = detail::inline_widget_notifier_interface<index_pair, std::string>;
|
using inline_notifier_interface = detail::inline_widget_notifier_interface<index_pair, ::std::string>;
|
||||||
|
|
||||||
struct cell
|
struct cell
|
||||||
{
|
{
|
||||||
@ -96,7 +132,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
::nana::color bgcolor;
|
::nana::color bgcolor;
|
||||||
::nana::color fgcolor;
|
::nana::color fgcolor;
|
||||||
/// ::nana::paint::font font; \todo
|
|
||||||
format() = default;
|
format() = default;
|
||||||
format(const ::nana::color& bgcolor, const ::nana::color& fgcolor);
|
format(const ::nana::color& bgcolor, const ::nana::color& fgcolor);
|
||||||
};
|
};
|
||||||
@ -173,8 +209,6 @@ namespace nana
|
|||||||
std::size_t pos_{0};
|
std::size_t pos_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
using selection = std::vector<index_pair>;
|
|
||||||
|
|
||||||
/// struct essence_t
|
/// struct essence_t
|
||||||
///@brief: this struct gives many data for listbox,
|
///@brief: this struct gives many data for listbox,
|
||||||
/// the state of the struct does not effect on member funcions, therefore all data members are public.
|
/// the state of the struct does not effect on member funcions, therefore all data members are public.
|
||||||
@ -535,10 +569,14 @@ namespace nana
|
|||||||
color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) };
|
color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) };
|
||||||
|
|
||||||
/// \todo how to implement some geometrical parameters ??
|
/// \todo how to implement some geometrical parameters ??
|
||||||
unsigned max_header_width{ 3000 }; ///< during auto width don't alow more than this
|
|
||||||
unsigned min_header_width{ 20 }; ///< def=20 . non counting suspension_width
|
/// The max column width which is generated by fit_content is allowed. It is ignored when it is 0, or a max value is passed to fit_content.
|
||||||
|
unsigned max_fit_content{ 0 };
|
||||||
|
|
||||||
|
unsigned min_column_width{ 20 }; ///< def=20 . non counting suspension_width
|
||||||
|
|
||||||
unsigned suspension_width { 8 }; ///< def= . the trigger will set this to the width if ("...")
|
unsigned suspension_width { 8 }; ///< def= . the trigger will set this to the width if ("...")
|
||||||
unsigned ext_w { 5 }; ///< def= 5. Additional or extended with added (before) to the text width to determine the cell width. cell_w = text_w + ext_w +1
|
unsigned text_margin { 5 }; ///< def= 5. Additional or extended with added (before) to the text width to determine the cell width. cell_w = text_w + ext_w +1
|
||||||
unsigned header_height { 25 }; ///< def=25 . header height header_size
|
unsigned header_height { 25 }; ///< def=25 . header height header_size
|
||||||
unsigned text_height { 14 }; ///< the trigger will set this to the height of the text font
|
unsigned text_height { 14 }; ///< the trigger will set this to the height of the text font
|
||||||
unsigned item_height_ex { 6 }; ///< Set !=0 !!!! def=6. item_height = text_height + item_height_ex
|
unsigned item_height_ex { 6 }; ///< Set !=0 !!!! def=6. item_height = text_height + item_height_ex
|
||||||
@ -614,18 +652,41 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
public concepts::any_objective<drawerbase::listbox::size_type, 2>
|
public concepts::any_objective<drawerbase::listbox::size_type, 2>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// An unsigned integral type
|
||||||
using size_type = drawerbase::listbox::size_type;
|
using size_type = drawerbase::listbox::size_type;
|
||||||
|
|
||||||
|
/// The representation of a category/item
|
||||||
using index_pair = drawerbase::listbox::index_pair;
|
using index_pair = drawerbase::listbox::index_pair;
|
||||||
|
|
||||||
|
/// A index_pair package
|
||||||
|
using index_pairs = drawerbase::listbox::index_pairs;
|
||||||
|
|
||||||
|
/// Iterator to access category
|
||||||
using cat_proxy = drawerbase::listbox::cat_proxy;
|
using cat_proxy = drawerbase::listbox::cat_proxy;
|
||||||
|
|
||||||
|
/// Iterator to access item
|
||||||
using item_proxy = drawerbase::listbox::item_proxy;
|
using item_proxy = drawerbase::listbox::item_proxy;
|
||||||
using selection = drawerbase::listbox::selection; ///<A container type for items.
|
|
||||||
|
/// The input resolver that converts an object to an item
|
||||||
using iresolver = drawerbase::listbox::iresolver;
|
using iresolver = drawerbase::listbox::iresolver;
|
||||||
|
|
||||||
|
/// The output resolver that converts an item to an object
|
||||||
using oresolver = drawerbase::listbox::oresolver;
|
using oresolver = drawerbase::listbox::oresolver;
|
||||||
|
|
||||||
|
/// The representation of an item
|
||||||
using cell = drawerbase::listbox::cell;
|
using cell = drawerbase::listbox::cell;
|
||||||
|
|
||||||
|
/// The options of exporting items into a string variable
|
||||||
using export_options= drawerbase::listbox::export_options;
|
using export_options= drawerbase::listbox::export_options;
|
||||||
using columns_indexs= drawerbase::listbox::size_type;
|
|
||||||
|
/// The interface for user-defined inline widgets
|
||||||
using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;
|
using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;
|
||||||
|
|
||||||
|
/// Column operations
|
||||||
|
using column_interface = drawerbase::listbox::column_interface;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/// Constructors
|
||||||
listbox() = default;
|
listbox() = default;
|
||||||
listbox(window, bool visible);
|
listbox(window, bool visible);
|
||||||
listbox(window, const rectangle& = {}, bool visible = true);
|
listbox(window, const rectangle& = {}, bool visible = true);
|
||||||
@ -648,7 +709,7 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
item_proxy operator[](const index_pair& abs_pos);
|
item_proxy operator[](const index_pair& abs_pos);
|
||||||
const item_proxy operator[](const index_pair &abs_pos) const;
|
const item_proxy operator[](const index_pair &abs_pos) const;
|
||||||
|
|
||||||
//Associative element access
|
//Associative category access
|
||||||
|
|
||||||
/// Returns a proxy to the category of the key or create a new one in the right order
|
/// Returns a proxy to the category of the key or create a new one in the right order
|
||||||
/**
|
/**
|
||||||
@ -724,10 +785,25 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
/// Appends a new column with a header text and the specified width at the end, and return it position
|
/// Appends a new column with a header text and the specified width at the end, and return it position
|
||||||
size_type append_header(std::string text_utf8, unsigned width = 120);
|
size_type append_header(std::string text_utf8, unsigned width = 120);
|
||||||
size_type append_header(std::wstring text, unsigned width = 120);
|
size_type append_header(std::wstring text, unsigned width = 120);
|
||||||
listbox& header_width(size_type position, unsigned pixels);
|
|
||||||
unsigned header_width(size_type position) const;
|
|
||||||
unsigned auto_width(size_type position, unsigned max=3000);
|
|
||||||
|
|
||||||
|
/// Access a column at specified position
|
||||||
|
/**
|
||||||
|
* @param pos Position of column
|
||||||
|
* @return Reference to the requested column
|
||||||
|
* @except std::out_of_range if !(pos < columns())
|
||||||
|
*/
|
||||||
|
column_interface & column_at(size_type pos);
|
||||||
|
|
||||||
|
/// Access a column at specified position
|
||||||
|
/**
|
||||||
|
* @param pos Position of column
|
||||||
|
* @return Constant reference to the requested column
|
||||||
|
* @except std::out_of_range if !(pos < columns())
|
||||||
|
*/
|
||||||
|
const column_interface & column_at(size_type pos) const;
|
||||||
|
|
||||||
|
/// Returns the number of columns
|
||||||
|
size_type column_size() const;
|
||||||
|
|
||||||
cat_proxy append(std::string); ///< Appends a new category to the end
|
cat_proxy append(std::string); ///< Appends a new category to the end
|
||||||
cat_proxy append(std::wstring); ///< Appends a new category to the end
|
cat_proxy append(std::wstring); ///< Appends a new category to the end
|
||||||
@ -751,16 +827,14 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
*/
|
*/
|
||||||
void insert_item(const index_pair& abs_pos, ::std::wstring text);
|
void insert_item(const index_pair& abs_pos, ::std::wstring text);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Returns an index of item which contains the specified point.
|
/// Returns an index of item which contains the specified point.
|
||||||
index_pair cast(const point & pos) const;
|
index_pair cast(const point & pos) const;
|
||||||
|
|
||||||
/// Returns the column which contains the specified point.
|
/// Returns the column which contains the specified point.
|
||||||
columns_indexs column_from_pos(const point & pos);
|
size_type column_from_pos(const point & pos);
|
||||||
|
|
||||||
void checkable(bool);
|
void checkable(bool);
|
||||||
selection checked() const; ///<Returns the items which are checked.
|
index_pairs checked() const; ///<Returns the items which are checked.
|
||||||
|
|
||||||
void clear(size_type cat); ///<Removes all the items from the specified category
|
void clear(size_type cat); ///<Removes all the items from the specified category
|
||||||
void clear(); ///<Removes all the items from all categories
|
void clear(); ///<Removes all the items from all categories
|
||||||
@ -783,7 +857,7 @@ the nana::detail::basic_window member pointer scheme
|
|||||||
void unsort();
|
void unsort();
|
||||||
bool freeze_sort(bool freeze);
|
bool freeze_sort(bool freeze);
|
||||||
|
|
||||||
selection selected() const; ///<Get the absolute indexs of all the selected items
|
index_pairs selected() const; ///<Get the absolute indexs of all the selected items
|
||||||
|
|
||||||
void show_header(bool);
|
void show_header(bool);
|
||||||
bool visible_header() const;
|
bool visible_header() const;
|
||||||
|
|||||||
@ -26,6 +26,8 @@
|
|||||||
#include <nana/gui/detail/element_store.hpp>
|
#include <nana/gui/detail/element_store.hpp>
|
||||||
#include <nana/gui/detail/color_schemes.hpp>
|
#include <nana/gui/detail/color_schemes.hpp>
|
||||||
|
|
||||||
|
#include <iostream> //use std::cerr
|
||||||
|
|
||||||
#ifndef WM_MOUSEWHEEL
|
#ifndef WM_MOUSEWHEEL
|
||||||
#define WM_MOUSEWHEEL 0x020A
|
#define WM_MOUSEWHEEL 0x020A
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -512,12 +512,6 @@ namespace nana{ namespace widgets
|
|||||||
const wchar_t* begin;
|
const wchar_t* begin;
|
||||||
const wchar_t* end;
|
const wchar_t* end;
|
||||||
unsigned pixels;
|
unsigned pixels;
|
||||||
/*
|
|
||||||
text_section() //deprecated
|
|
||||||
{
|
|
||||||
throw std::runtime_error("text_section default construction is forbidden.");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
text_section(const wchar_t* ptr, const wchar_t* endptr)
|
text_section(const wchar_t* ptr, const wchar_t* endptr)
|
||||||
: begin(ptr), end(endptr)
|
: begin(ptr), end(endptr)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user