diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
new file mode 100644
index 00000000..e04ee417
--- /dev/null
+++ b/build/cmake/CMakeLists.txt
@@ -0,0 +1,50 @@
+# CMake configuration for Nana
+# Author: ierofant(https://github.com/ierofant)
+
+project(nana)
+cmake_minimum_required(VERSION 2.8)
+
+string(REGEX REPLACE "/[^/]*$" "" CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+string(REGEX REPLACE "/[^/]*$" "" CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+
+set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
+set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
+endif(CMAKE_COMPILER_IS_GNUCXX)
+
+include_directories(${NANA_INCLUDE_DIR})
+aux_source_directory(${NANA_SOURCE_DIR} NANA_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/detail NANA_DETAIL_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/filesystem NANA_FILESYSTEM_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/audio NANA_AUDIO_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/audio/detail NANA_AUDIO_DETAIL_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/gui NANA_GUI_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/gui/detail NANA_GUI_DETAIL_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets NANA_GUI_WIDGETS_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/gui/widgets/skeletons NANA_GUI_WIDGETS_SKELETONS_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/paint NANA_PAINT_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/paint/detail NANA_PAINT_DETAIL_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/system NANA_SYSTEM_SOURCE)
+aux_source_directory(${NANA_SOURCE_DIR}/threads NANA_THREADS_SOURCE)
+
+add_library(${PROJECT_NAME} ${NANA_SOURCE}
+ ${NANA_DETAIL_SOURCE}
+ ${NANA_FILESYSTEM_SOURCE}
+ ${NANA_AUDIO_SOURCE}
+ ${NANA_AUDIO_DETAIL_SOURCE}
+ ${NANA_GUI_SOURCE}
+ ${NANA_GUI_DETAIL_SOURCE}
+ ${NANA_GUI_WIDGETS_SOURCE}
+ ${NANA_GUI_WIDGETS_SKELETONS_SOURCE}
+ ${NANA_PAINT_SOURCE}
+ ${NANA_PAINT_DETAIL_SOURCE}
+ ${NANA_SYSTEM_SOURCE}
+ ${NANA_THREADS_SOURCE})
+
+
+install(TARGETS ${PROJECT_NAME}
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib)
+install(DIRECTORY ${NANA_INCLUDE_DIR}/nana DESTINATION include)
\ No newline at end of file
diff --git a/build/codeblocks/nana.cbp b/build/codeblocks/nana.cbp
index b2021965..83985a24 100644
--- a/build/codeblocks/nana.cbp
+++ b/build/codeblocks/nana.cbp
@@ -52,6 +52,7 @@
+
@@ -68,6 +69,7 @@
+
@@ -89,6 +91,7 @@
+
diff --git a/build/codeblocks/nana.layout b/build/codeblocks/nana.layout
index 469d6a54..57a19817 100644
--- a/build/codeblocks/nana.layout
+++ b/build/codeblocks/nana.layout
@@ -1,39 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -41,6 +81,11 @@
+
+
+
+
+
@@ -56,9 +101,9 @@
-
+
-
+
@@ -66,9 +111,9 @@
-
+
-
+
@@ -76,79 +121,34 @@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/build/vc2013/nana.vcxproj b/build/vc2013/nana.vcxproj
index 292712b0..d6b6e976 100644
--- a/build/vc2013/nana.vcxproj
+++ b/build/vc2013/nana.vcxproj
@@ -99,6 +99,7 @@
+
@@ -116,6 +117,7 @@
+
@@ -137,6 +139,7 @@
+
diff --git a/build/vc2013/nana.vcxproj.filters b/build/vc2013/nana.vcxproj.filters
index 3309f037..f0f82981 100644
--- a/build/vc2013/nana.vcxproj.filters
+++ b/build/vc2013/nana.vcxproj.filters
@@ -291,5 +291,14 @@
Source Files\nana
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui\widgets
+
\ No newline at end of file
diff --git a/include/nana/basic_types.hpp b/include/nana/basic_types.hpp
index 05088e89..9a2d85f2 100644
--- a/include/nana/basic_types.hpp
+++ b/include/nana/basic_types.hpp
@@ -1,7 +1,7 @@
/*
* Basic Types definition
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,6 +14,7 @@
#define NANA_BASIC_TYPES_HPP
#include
+#include
namespace nana
{
@@ -98,27 +99,251 @@ namespace nana
typedef unsigned char uint8_t;
typedef unsigned long uint32_t;
typedef unsigned uint_t;
- typedef unsigned color_t;
typedef long long long_long_t;
- const color_t null_color = 0xFFFFFFFF;
-
- struct pixel_rgb_t
+ union pixel_argb_t
{
- union
+ struct element_tag
{
- struct element_tag
- {
- unsigned int blue:8;
- unsigned int green:8;
- unsigned int red:8;
- unsigned int alpha_channel:8;
- }element;
-
- color_t color;
- }u;
+ unsigned char blue;
+ unsigned char green;
+ unsigned char red;
+ unsigned char alpha_channel;
+ }element;
+ unsigned value;
};
+ union pixel_rgba_t
+ {
+ struct element_tag
+ {
+ unsigned char alpha_channel;
+ unsigned char blue;
+ unsigned char green;
+ unsigned char red;
+ }element;
+ unsigned value;
+ };
+
+ using pixel_color_t = pixel_argb_t;
+
+ //http://www.w3.org/TR/2011/REC-css3-color-20110607/
+ //4.3. Extended color keywords
+ enum class colors
+ {
+ alice_blue = 0xf0f8ff,
+ antique_white = 0xfaebd7,
+ aqua = 0xFFFF,
+ aquamarine = 0x7fffd4,
+ azure = 0xf0ffff,
+ beige = 0xf5f5dc,
+ bisque = 0xffe4ce,
+ black = 0x0,
+ blanched_almond = 0xffebcd,
+ blue = 0x0000FF,
+ blue_violet = 0x8a2be2,
+ brown = 0xa52a2a,
+ burly_wood = 0xdeb887,
+ cadet_blue = 0x5f9ea0,
+ chartreuse = 0x7fff00,
+ chocolate = 0xd2691e,
+ coral = 0xff7f50,
+ cornflower_blue = 0x6495ed,
+ cornsilk = 0xfff8dc,
+ crimson = 0xdc143c,
+ cyan = 0xffff,
+ dark_blue = 0x8b,
+ dark_cyan = 0x8b8b,
+ dark_goldenrod = 0xb8860b,
+ dark_gray = 0xa9a9a9,
+ dark_green = 0x6400,
+ dark_grey = dark_gray,
+ dark_khaki = 0xbdb76b,
+ dark_magenta = 0x8b008b,
+ dark_olive_green = 0x556b2f,
+ dark_orange = 0xff8c00,
+ dark_orchid = 0x9932cc,
+ dark_red = 0x8b0000,
+ dark_salmon = 0xe9976a,
+ dark_sea_green = 0x8fbc8f,
+ dark_slate_blue = 0x483d8b,
+ dark_slate_gray = 0x2f4f4f,
+ dark_slate_grey = 0x2f4f4f,
+ dark_turquoise = 0xced1,
+ dark_violet = 0x9400d3,
+ deep_pink = 0xff1493,
+ deep_sky_blue = 0xbfff,
+ dim_gray = 0x696969,
+ dim_grey = dim_gray,
+ dodger_blue = 0x1e90ff,
+ firebrick = 0xb22222,
+ floral_white = 0xfffaf0,
+ forest_green = 0x228b22,
+ fuchsia = 0xFF00FF,
+ gainsboro = 0xdcdcdc,
+ ghost_white = 0xf8f8ff,
+ gold = 0xffd700,
+ goldenrod = 0xdaa520,
+ gray = 0x808080,
+ green = 0x008000,
+ green_yellow = 0xadff2f,
+ grey = gray,
+ honeydew = 0xf0fff0,
+ hot_pink = 0xff69b4,
+ indian_red = 0xcd5c5c,
+ indigo = 0x4b0082,
+ ivory = 0xfffff0,
+ khaki = 0xf0e68c,
+ lavendar = 0xe6e6fa,
+ lavender_blush = 0xfff0f5,
+ lawn_green = 0x7cfc00,
+ lemon_chiffon = 0xfffacd,
+ light_blue = 0xadd8e6,
+ light_coral = 0xf08080,
+ light_cyan = 0xe0ffff,
+ light_goldenrod_yellow = 0xfafad2,
+ light_gray = 0xd3d3d3,
+ light_green = 0x90ee90,
+ light_grey = light_gray,
+ light_pink = 0xffb6c1,
+ light_salmon = 0xffa07a,
+ light_sea_green = 0x20b2aa,
+ light_sky_blue = 0x87cefa,
+ light_slate_gray = 0x778899,
+ light_slate_grey = light_slate_gray,
+ light_steel_blue = 0xb0c4de,
+ light_yellow = 0xffffe0,
+ lime = 0x00FF00,
+ lime_green = 0x32cd32,
+ linen = 0xfaf0e6,
+ magenta = 0xff00ff,
+ maroon = 0x800000,
+ medium_aquamarine = 0x66cdaa,
+ medium_blue = 0xcd,
+ medium_orchid = 0xba55d3,
+ medium_purple = 0x9370db,
+ medium_sea_green = 0x3cb371,
+ medium_slate_blue = 0x7b68ee,
+ medium_spring_green = 0xfa9a,
+ medium_turquoise = 0x48d1cc,
+ medium_violet_red = 0xc71585,
+ midnight_blue = 0x191970,
+ mint_cream = 0xf5fffa,
+
+ misty_rose = 0xffe4e1,
+ moccasin = 0xffe4b5,
+ navajo_white = 0xffdead,
+ navy = 0x000080,
+ old_lace = 0xfdf5e6,
+ olive = 0x808000,
+ olive_drab = 0x6b8e23,
+ orange = 0xffa500,
+ orange_red = 0xff4500,
+ orchid = 0xda70d6,
+ pale_goldenrod = 0xeee8aa,
+ pale_green = 0x98fb98,
+ pale_turquoise = 0xafeeee,
+ pale_violet_red = 0xdb7093,
+ papaya_whip = 0xffefd5,
+ peach_puff = 0xffdab9,
+ peru = 0xcd853f,
+ pink = 0xffc0cb,
+ plum = 0xdda0dd,
+ powder_blue = 0xb0e0e6,
+ purple = 0x800080,
+ red = 0xFF0000,
+ rosy_brown = 0xbc8f8f,
+ royal_blue = 0x4169e1,
+ saddle_brown = 0x8b4513,
+ salmon = 0xfa8072,
+ sandy_brown = 0xf4a460,
+ sea_green = 0x2e8b57,
+ sea_shell = 0xfff5ee,
+ sienna = 0xa0522d,
+ silver = 0xc0c0c0,
+ sky_blue = 0x87ceeb,
+ slate_blue = 0x6a5acd,
+ slate_gray = 0x708090,
+ slate_grey = 0x708090,
+ snow = 0xfffafa,
+ spring_green = 0xff7f,
+ steel_blue = 0x4682b4,
+ tan = 0xd2b48c,
+ teal = 0x008080,
+ thistle = 0xd8bfd8,
+ tomato = 0xff6347,
+ turquoise = 0x40e0d0,
+ violet = 0xee82ee,
+ wheat = 0xf5deb3,
+ white = 0xFFFFFF,
+ white_smoke = 0xf5f5f5,
+ yellow = 0xFFFF00,
+ yellow_green = 0x9acd32,
+
+ //temporary defintions, these will be replaced by color schema
+ button_face_shadow_start = 0xF5F4F2,
+ button_face_shadow_end = 0xD5D2CA,
+ button_face = 0xD4D0C8,
+ dark_border = 0x404040,
+ gray_border = 0x808080,
+ highlight = 0x1CC4F7
+ };
+
+ //Some helper types to identify an integer as color.
+ enum class color_rgb : unsigned{};
+ enum class color_argb: unsigned{};
+ enum class color_rgba : unsigned{};
+
+ class color
+ {
+ public:
+ color() = default;
+ color(colors);
+ color(colors, double alpha);
+ color(color_rgb);
+ color(color_argb);
+ color(color_rgba);
+ color(unsigned red, unsigned green, unsigned blue);
+ color(unsigned red, unsigned green, unsigned blue, double alpha);
+
+ /// Initializes the color with a CSS-like rgb string.
+ color(std::string css_rgb);
+
+ color& alpha(double); ///< Sets alpha channel
+ color& from_rgb(unsigned red, unsigned green, unsigned blue); ///< immutable alpha channel
+
+ /// Sets color with a HSL value.
+ /// @param hue in range of [0, 360]
+ /// @param saturation in range of [0, 1]
+ /// @param lightness in range of [0, 1]
+ color& from_hsl(double hue, double saturation, double lightness); ///< immutable alpha channel
+
+ color blend(const color& bgcolor, bool ignore_bgcolor_alpha) const;
+
+ ///< Blends two colors with the specified alpha, and the alpha values that come with these two colors are both ignored.
+ color blend(const color& bgcolor, double alpha) const;
+
+ ///< Determines whether the color is completely transparent.
+ bool invisible() const;
+ pixel_color_t px_color() const;
+ pixel_argb_t argb() const;
+ pixel_rgba_t rgba() const;
+
+ const double& r() const;
+ const double& g() const;
+ const double& b() const;
+ const double& a() const;
+
+ bool operator==(const color& other) const;
+ bool operator!=(const color& other) const;
+ private:
+ double r_;
+ double g_;
+ double b_;
+ double a_{ 0.0 }; //invisible
+ };
+
+
struct rectangle;
struct point
@@ -163,8 +388,9 @@ namespace nana
struct size
{
+ using value_type = unsigned;
size();
- size(unsigned width, unsigned height);
+ size(value_type width, value_type height);
size(const rectangle&);
size& operator=(const rectangle&);
@@ -175,8 +401,8 @@ namespace nana
bool operator!=(const size& rhs) const;
size operator+(const size&) const;
- unsigned width;
- unsigned height;
+ value_type width;
+ value_type height;
};
struct rectangle
@@ -247,6 +473,16 @@ namespace nana
{
top, center, bottom
};
+
+ ///The definition of the four corners of the world
+ enum class direction
+ {
+ north,
+ south,
+ east,
+ west,
+ southeast
+ };
}//end namespace nana
#endif
diff --git a/include/nana/config.hpp b/include/nana/config.hpp
index 8c25d372..418871f1 100644
--- a/include/nana/config.hpp
+++ b/include/nana/config.hpp
@@ -18,7 +18,6 @@
//Windows:
#define NANA_WINDOWS 1
#define PLATFORM_SPEC_HPP
- #define GUI_BEDROCK_HPP
//Test if it is MINGW
#if defined(__MINGW32__)
@@ -31,8 +30,6 @@
#define NANA_LINUX 1
#define NANA_X11 1
#define PLATFORM_SPEC_HPP
- #define GUI_BEDROCK_HPP
-
#define STD_CODECVT_NOT_SUPPORTED
#endif
diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp
index 66fe0cfe..d417d06d 100644
--- a/include/nana/deploy.hpp
+++ b/include/nana/deploy.hpp
@@ -42,6 +42,14 @@ namespace nana
std::size_t strlen(const char_t* str);
double strtod(const char_t* str, char_t** endptr);
char_t* strcpy(char_t* dest, const char_t* source);
+
+ //Workaround for no implemenation of std::stoi in MinGW.
+ int stoi(const std::string&, std::size_t * pos = nullptr, int base = 10);
+ int stoi(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
+
+ //Workaround for no implemenation of std::stod in MinGW.
+ double stod(const std::string&, std::size_t * pos = nullptr);
+ double stod(const std::wstring&, std::size_t* pos = nullptr);
}
#if defined(NANA_WINDOWS)
diff --git a/include/nana/detail/linux_X11/platform_spec.hpp b/include/nana/detail/linux_X11/platform_spec.hpp
index be306f5c..ae4a1830 100644
--- a/include/nana/detail/linux_X11/platform_spec.hpp
+++ b/include/nana/detail/linux_X11/platform_spec.hpp
@@ -85,11 +85,6 @@ namespace detail
{
typedef std::shared_ptr font_ptr_t;
- drawable_impl_type();
- ~drawable_impl_type();
-
- void fgcolor(unsigned color);
-
Pixmap pixmap;
GC context;
font_ptr_t font;
@@ -107,8 +102,20 @@ namespace detail
XftColor xft_fgcolor;
const std::string charset(const nana::string& str, const std::string& strcode);
#endif
+ drawable_impl_type();
+ ~drawable_impl_type();
+
+ void fgcolor(const ::nana::color&); //deprecated
+ void set_color(const ::nana::color&);
+ void set_text_color(const ::nana::color&);
+
+ void update_color();
+ void update_text_color();
private:
- unsigned fgcolor_{0xFFFFFFFF};
+ unsigned current_color_{ 0xFFFFFF };
+ unsigned color_{ 0xFFFFFFFF };
+ unsigned text_color_{ 0xFFFFFFFF };
+
#if defined(NANA_UNICODE)
struct conv_tag
{
@@ -217,9 +224,9 @@ namespace detail
void read_keystate(XKeyEvent&);
XIC caret_input_context(native_window_type) const;
- void caret_open(native_window_type, unsigned width, unsigned height);
+ void caret_open(native_window_type, const ::nana::size&);
void caret_close(native_window_type);
- void caret_pos(native_window_type, int x, int y);
+ void caret_pos(native_window_type, const ::nana::point&);
void caret_visible(native_window_type, bool);
void caret_flash(caret_tag&);
bool caret_update(native_window_type, nana::paint::graphics& root_graph, bool is_erase_caret_from_root_graph);
diff --git a/include/nana/detail/win32/platform_spec.hpp b/include/nana/detail/win32/platform_spec.hpp
index cb4be1fd..9e735f99 100644
--- a/include/nana/detail/win32/platform_spec.hpp
+++ b/include/nana/detail/win32/platform_spec.hpp
@@ -1,6 +1,7 @@
/*
* Platform Specification Implementation
- * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -91,8 +92,8 @@ namespace detail
HDC context;
HBITMAP pixmap;
- pixel_rgb_t* pixbuf_ptr;
- std::size_t bytes_per_line;
+ pixel_argb_t* pixbuf_ptr{nullptr};
+ std::size_t bytes_per_line{0};
font_ptr_t font;
struct pen_spec
@@ -102,7 +103,7 @@ namespace detail
int style;
int width;
- void set(HDC context, int style, int width, nana::color_t color);
+ void set(HDC context, int style, int width,unsigned color);
}pen;
struct brush_spec
@@ -111,9 +112,9 @@ namespace detail
HBRUSH handle;
t style;
- nana::color_t color;
+ unsigned color;
- void set(HDC context, t style, nana::color_t color);
+ void set(HDC context, t style, unsigned color);
}brush;
struct round_region_spec
@@ -136,9 +137,16 @@ namespace detail
drawable_impl_type();
~drawable_impl_type();
- void fgcolor(nana::color_t);
+ void fgcolor(const ::nana::color&); //deprecated
+ unsigned get_color() const;
+ void set_color(const ::nana::color&);
+ void set_text_color(const ::nana::color&);
+
+ void update_pen();
+ void update_brush();
private:
- unsigned fgcolor_;
+ unsigned color_{ 0xffffffff };
+ unsigned text_color_{0xffffffff};
};
class platform_spec
diff --git a/include/nana/gui/basis.hpp b/include/nana/gui/basis.hpp
index aade6c38..4eb95c88 100644
--- a/include/nana/gui/basis.hpp
+++ b/include/nana/gui/basis.hpp
@@ -1,7 +1,7 @@
/*
* Basis Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -25,6 +25,7 @@ namespace nana
struct native_window_handle_impl{};
struct window_handle_impl{};
struct event_handle_impl{};
+ struct native_drawable_impl{};
}
enum class checkstate
@@ -63,56 +64,39 @@ namespace nana
struct frame_tag: widget_tag{ static const flags value = flags::frame; };
}// end namespace category
- typedef detail::native_window_handle_impl * native_window_type;
-
- typedef detail::window_handle_impl* window; ///< \see [What is window class ](https://sourceforge.net/p/nanapro/discussion/general/thread/bd0fabfb/)
- typedef detail::event_handle_impl* event_handle;
+ using native_window_type = detail::native_window_handle_impl*;
+ using window = detail::window_handle_impl*; ///< \see [What is window class ](https://sourceforge.net/p/nanapro/discussion/general/thread/bd0fabfb/)
+ using event_handle = detail::event_handle_impl*;
+ using native_drawable_type = detail::native_drawable_impl*;
struct keyboard
{
- enum t{
+ enum{
//Control Code for ASCII
- select_all = 0x1,
- end_of_text = 0x3, //Ctrl+C
- backspace = 0x8, tab = 0x9,
- enter_n = 0xA, enter = 0xD, enter_r = 0xD,
- alt = 0x12,
- sync_idel = 0x16, //Ctrl+V
- cancel = 0x18, //Ctrl+X
- end_of_medium = 0x19, //Ctrl+Y
- substitute = 0x1A, //Ctrl+Z
- escape = 0x1B,
+ start_of_headline = 0x1, //Ctrl+A
+ end_of_text = 0x3, //Ctrl+C
+ backspace = 0x8, tab = 0x9,
+ enter_n = 0xA, enter = 0xD, enter_r = 0xD,
+ alt = 0x12,
+ sync_idel = 0x16, //Ctrl+V
+ cancel = 0x18, //Ctrl+X
+ end_of_medium = 0x19, //Ctrl+Y
+ substitute = 0x1A, //Ctrl+Z
+ escape = 0x1B,
//The following names are intuitive name of ASCII control codes
- copy = 0x3, //end_of_text
- paste = 0x16, //sync_idel
- cut = 0x18, //cancel
- redo = 0x19, //end_of_medium
- undo = 0x1A, //substitue
+ select_all = start_of_headline,
+ copy = end_of_text,
+ paste = sync_idel,
+ cut = cancel,
+ redo = end_of_medium,
+ undo = substitute,
//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
- };
- };
-
- namespace color
- {
- enum
- {
- white = 0xFFFFFF,
- blue = 0x0000FF,
- green = 0x00FF00,
- red = 0xFF0000,
-
- button_face_shadow_start = 0xF5F4F2,
- button_face_shadow_end = 0xD5D2CA,
- button_face = 0xD4D0C8,
- dark_border = 0x404040,
- gray_border = 0x808080,
- highlight = 0x1CC4F7
+ os_pageup = 0x21, os_pagedown,
+ os_arrow_left = 0x25, os_arrow_up, os_arrow_right, os_arrow_down,
+ os_insert = 0x2D, os_del
};
};
diff --git a/include/nana/gui/detail/basic_window.hpp b/include/nana/gui/detail/basic_window.hpp
index f84e3692..2834c870 100644
--- a/include/nana/gui/detail/basic_window.hpp
+++ b/include/nana/gui/detail/basic_window.hpp
@@ -1,7 +1,7 @@
/*
* A Basic Window Widget Definition
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,7 +14,7 @@
#define NANA_GUI_DETAIL_BASIC_WINDOW_HPP
#include "drawer.hpp"
#include "events_holder.hpp"
-#include "../basis.hpp"
+#include "widget_colors.hpp"
#include
#include
#include
@@ -74,7 +74,7 @@ namespace detail
struct basic_window
: public events_holder
{
- typedef std::vector container;
+ using container = std::vector;
struct root_context
{
@@ -119,6 +119,8 @@ namespace detail
bool is_ancestor_of(const basic_window* wd) const;
bool visible_parents() const;
bool belong_to_lazy() const;
+
+ bool is_draw_through() const; ///< Determines whether it is a draw-through window.
public:
//Override event_holder
bool set_events(const std::shared_ptr&) override;
@@ -155,7 +157,7 @@ namespace detail
{
bool enabled :1;
bool dbl_click :1;
- bool capture :1; //if mouse button is down, it always receive mouse move even the mouse is out of its rectangle
+ bool captured :1; //if mouse button is down, it always receive mouse move even the mouse is out of its rectangle
bool modal :1;
bool take_active:1; //If take_active is false, other.active_window still keeps the focus.
bool refreshing :1;
@@ -163,7 +165,8 @@ namespace detail
bool dropable :1; //Whether the window has make mouse_drop event.
bool fullscreen :1; //When the window is maximizing whether it fit for fullscreen.
bool borderless :1;
- unsigned Reserved :22;
+ bool make_bground_declared : 1; //explicitly make bground for bground effects
+ unsigned Reserved :21;
unsigned char tab; //indicate a window that can receive the keyboard TAB
mouse_action action;
}flags;
@@ -174,13 +177,8 @@ namespace detail
std::shared_ptr events_ptr;
general_events* attached_events;
}together;
-
- struct
- {
- color_t foreground;
- color_t background;
- color_t active;
- }color;
+
+ widget_colors* scheme{ nullptr };
struct
{
@@ -211,6 +209,8 @@ namespace detail
#endif
cursor state_cursor{nana::cursor::arrow};
basic_window* state_cursor_window{ nullptr };
+
+ std::function draw_through; ///< A draw through renderer for root widgets.
};
const category::flags category;
diff --git a/include/nana/gui/detail/bedrock.hpp b/include/nana/gui/detail/bedrock.hpp
index d58cc680..71a52149 100644
--- a/include/nana/gui/detail/bedrock.hpp
+++ b/include/nana/gui/detail/bedrock.hpp
@@ -1,7 +1,7 @@
/*
* A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,6 +16,7 @@
#include "events_operation.hpp"
#include "runtime_manager.hpp"
#include "general_events.hpp"
+#include "color_schemes.hpp"
#include "internal_scope_guard.hpp"
namespace nana
@@ -41,7 +42,7 @@ namespace detail
~bedrock();
void pump_event(window, bool is_modal);
- void map_thread_root_buffer(core_window_t* );
+ void map_thread_root_buffer(core_window_t*, bool forced);
static int inc_window(unsigned tid = 0);
thread_context* open_thread_context(unsigned tid = 0);
thread_context* get_thread_context(unsigned tid = 0);
@@ -66,6 +67,7 @@ namespace detail
bool whether_keyboard_shortkey() const;
element_store& get_element_store() const;
+ void map_through_widgets(core_window_t*, native_drawable_type);
public:
void event_expose(core_window_t *, bool exposed);
void event_move(core_window_t*, int x, int y);
@@ -76,22 +78,27 @@ namespace detail
void set_cursor(core_window_t*, nana::cursor, thread_context*);
void define_state_cursor(core_window_t*, nana::cursor, thread_context*);
void undefine_state_cursor(core_window_t*, thread_context*);
+
+ widget_colors& get_scheme_template(scheme_factory_base&&);
+ std::unique_ptr make_scheme(scheme_factory_base&&);
public:
- window_manager_t wd_manager;
events_operation evt_operation;
+ window_manager_t wd_manager;
runtime_manager rt_manager;
bool emit(event_code, core_window_t*, const arg_mouse&, bool ask_update, thread_context*);
- bool emit(event_code, core_window_t*, const event_arg_interface&, bool ask_update, thread_context*);
- bool emit_drawer(event_code, core_window_t*, const event_arg_interface&, thread_context*);
+ bool emit(event_code, core_window_t*, const event_arg&, bool ask_update, thread_context*);
+ bool emit_drawer(event_code, core_window_t*, const event_arg&, thread_context*);
private:
- void _m_emit_core(event_code, core_window_t*, bool draw_only, const event_arg_interface&);
+ void _m_emit_core(event_code, core_window_t*, bool draw_only, const event_arg&);
void _m_event_filter(event_code, core_window_t*, thread_context*);
void _m_except_handler();
private:
static bedrock bedrock_object;
+ struct pi_data;
+ pi_data* pi_data_;
struct private_impl;
private_impl *impl_;
};//end class bedrock
diff --git a/include/nana/gui/detail/bedrock_pi_data.hpp b/include/nana/gui/detail/bedrock_pi_data.hpp
new file mode 100644
index 00000000..b54e658f
--- /dev/null
+++ b/include/nana/gui/detail/bedrock_pi_data.hpp
@@ -0,0 +1,18 @@
+#ifndef NANA_DETAIL_BEDROCK_PI_DATA_HPP
+#define NANA_DETAIL_BEDROCK_PI_DATA_HPP
+
+#include
+#include "color_schemes.hpp"
+
+namespace nana
+{
+ namespace detail
+ {
+ struct bedrock::pi_data
+ {
+ color_schemes scheme;
+
+ };
+ }
+}
+#endif
diff --git a/include/nana/gui/detail/color_schemes.hpp b/include/nana/gui/detail/color_schemes.hpp
new file mode 100644
index 00000000..25f75079
--- /dev/null
+++ b/include/nana/gui/detail/color_schemes.hpp
@@ -0,0 +1,80 @@
+/*
+* Color Schemes
+* Nana C++ Library(http://www.nanapro.org)
+* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+*
+* Distributed under the Boost Software License, Version 1.0.
+* (See accompanying file LICENSE_1_0.txt or copy at
+* http://www.boost.org/LICENSE_1_0.txt)
+*
+* @file: nana/gui/color_schemes.hpp
+* @description:
+*/
+#ifndef NANA_DETAIL_COLOR_SCHEMES_HPP
+#define NANA_DETAIL_COLOR_SCHEMES_HPP
+
+#include "widget_colors.hpp"
+#include
+
+namespace nana
+{
+ namespace detail
+ {
+ class scheme_factory_base
+ {
+ public:
+ struct factory_identifier{};
+ virtual ~scheme_factory_base() = default;
+
+ virtual factory_identifier* get_id() const = 0;
+ virtual std::unique_ptr create() = 0;
+ virtual std::unique_ptr create(widget_colors&) = 0;
+ };
+
+ template
+ class scheme_factory
+ : public scheme_factory_base
+ {
+ private:
+ factory_identifier* get_id() const override
+ {
+ return &fid_;
+ }
+
+ std::unique_ptr create() override
+ {
+ return std::unique_ptr(new Scheme);
+ }
+
+ std::unique_ptr create(widget_colors& other) override
+ {
+ return std::unique_ptr{new Scheme(static_cast(other))};
+ }
+ private:
+ static factory_identifier fid_;
+ };
+
+ template
+ scheme_factory_base::factory_identifier scheme_factory::fid_;
+
+ class color_schemes
+ {
+ struct implement;
+ color_schemes(const color_schemes&) = delete;
+ color_schemes(color_schemes&&) = delete;
+ color_schemes& operator=(const color_schemes&) = delete;
+ color_schemes& operator=(color_schemes&&) = delete;
+ public:
+ using scheme = widget_colors;
+
+ color_schemes();
+ ~color_schemes();
+
+ scheme& scheme_template(scheme_factory_base&&);
+ std::unique_ptr create(scheme_factory_base&&);
+ private:
+ implement * impl_;
+ };
+ }//end namespace detail;
+}//end namespace nana
+#endif
\ No newline at end of file
diff --git a/include/nana/gui/detail/drawer.hpp b/include/nana/gui/detail/drawer.hpp
index 8cb5465a..f6948a45 100644
--- a/include/nana/gui/detail/drawer.hpp
+++ b/include/nana/gui/detail/drawer.hpp
@@ -1,7 +1,7 @@
/*
* A Drawer Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -110,7 +110,7 @@ namespace nana
void key_char(const arg_keyboard&);
void key_release(const arg_keyboard&);
void shortkey(const arg_keyboard&);
- void map(window); //Copy the root buffer to screen
+ void map(window, bool forced); //Copy the root buffer to screen
void refresh();
drawer_trigger* realizer() const;
void attached(widget&, drawer_trigger&);
@@ -123,7 +123,7 @@ namespace nana
void _m_bground_pre();
void _m_bground_end();
void _m_draw_dynamic_drawing_object();
- void _m_use_refresh();
+ bool _m_lazy_decleared() const;
template
void _m_emit(event_code evt_code, const Arg& arg, Mfptr mfptr)
@@ -139,14 +139,20 @@ namespace nana
{
realizer_->_m_reset_overrided();
(realizer_->*mfptr)(graphics, arg);
- mth_state_[pos] = (realizer_->_m_overrided() ? method_state::overrided : method_state::not_overrided);
+
+ //Check realizer, when the window is closed in that event handler, the drawer will be
+ //detached and realizer will be a nullptr
+ if(realizer_)
+ mth_state_[pos] = (realizer_->_m_overrided() ? method_state::overrided : method_state::not_overrided);
}
else
(realizer_->*mfptr)(graphics, arg);
- _m_use_refresh();
- _m_draw_dynamic_drawing_object();
- _m_bground_end();
+ if (_m_lazy_decleared())
+ {
+ _m_draw_dynamic_drawing_object();
+ _m_bground_end();
+ }
}
}
}
diff --git a/include/nana/gui/detail/effects_renderer.hpp b/include/nana/gui/detail/effects_renderer.hpp
index a3eb42c6..91daf849 100644
--- a/include/nana/gui/detail/effects_renderer.hpp
+++ b/include/nana/gui/detail/effects_renderer.hpp
@@ -3,7 +3,6 @@
#include
#include
#include
-
#include
namespace nana{
@@ -12,7 +11,7 @@ namespace nana{
template
class edge_nimbus_renderer
{
- edge_nimbus_renderer(){}
+ edge_nimbus_renderer() = default;
public:
typedef CoreWindow core_window_t;
typedef window_layout window_layer;
@@ -29,7 +28,7 @@ namespace nana{
return 2;
}
- bool render(core_window_t * wd)
+ bool render(core_window_t * wd, bool forced)
{
bool rendered = false;
core_window_t * root_wd = wd->root_widget;
@@ -44,7 +43,7 @@ namespace nana{
auto graph = root_wd->root_graph;
std::vector erase;
- std::vector r_set;
+ std::vector> rd_set;
nana::rectangle r;
for(auto & action : nimbus)
{
@@ -53,8 +52,12 @@ namespace nana{
if(action.window == wd)
rendered = true;
- r_set.push_back(r);
- action.rendered = true;
+ //Avoiding duplicated rendering. If the window is declared to lazy refresh, it should be rendered.
+ if ((forced && (action.window == wd)) || !action.rendered || (action.window->other.upd_state == core_window_t::update_state::refresh))
+ {
+ rd_set.emplace_back(r, action.window);
+ action.rendered = true;
+ }
}
else if(action.rendered)
{
@@ -77,13 +80,9 @@ namespace nana{
graph->paste(native, r, r.x, r.y);
}
- auto visual_iterator = r_set.begin();
//Render
- for(auto & action : nimbus)
- {
- if(action.rendered)
- _m_render_edge_nimbus(action.window, *(visual_iterator++));
- }
+ for (auto & rd : rd_set)
+ _m_render_edge_nimbus(rd.second, rd.first);
}
return rendered;
}
@@ -102,7 +101,7 @@ namespace nana{
nana::rectangle r(visual);
r.pare_off(-static_cast(weight()));
nana::rectangle good_r;
- if(overlap(r, nana::rectangle(wd->root_graph->size()), good_r))
+ if(overlap(r, wd->root_graph->size(), good_r))
{
if( (good_r.x < wd->pos_root.x) || (good_r.y < wd->pos_root.y) ||
(good_r.x + good_r.width > visual.x + visual.width) || (good_r.y + good_r.height > visual.y + visual.height))
@@ -110,7 +109,7 @@ namespace nana{
auto graph = wd->root_graph;
nana::paint::pixel_buffer pixbuf(graph->handle(), r);
- pixel_rgb_t px0, px1, px2, px3;
+ pixel_argb_t px0, px1, px2, px3;
px0 = pixbuf.pixel(0, 0);
px1 = pixbuf.pixel(r.width - 1, 0);
@@ -120,12 +119,12 @@ namespace nana{
good_r.x = good_r.y = 1;
good_r.width = r.width - 2;
good_r.height = r.height - 2;
- pixbuf.rectangle(good_r, wd->color.active, 0.95, false);
+ pixbuf.rectangle(good_r, wd->scheme->activated.get_color(), 0.95, false);
good_r.x = good_r.y = 0;
good_r.width = r.width;
good_r.height = r.height;
- pixbuf.rectangle(good_r, wd->color.active, 0.4, false);
+ pixbuf.rectangle(good_r, wd->scheme->activated.get_color(), 0.4, false);
pixbuf.pixel(0, 0, px0);
pixbuf.pixel(r.width - 1, 0, px1);
diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp
index 486373d8..20dae998 100644
--- a/include/nana/gui/detail/general_events.hpp
+++ b/include/nana/gui/detail/general_events.hpp
@@ -1,7 +1,7 @@
/*
* Definition of General Events
* Nana C++ Library(http://www.nanapro.org)
-* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -28,27 +28,32 @@ namespace nana
class event_interface
{
public:
- virtual ~event_interface(){}
+ virtual ~event_interface() = default;
virtual void remove(event_handle) = 0;
};
class docker_interface
{
public:
- virtual ~docker_interface(){}
+ virtual ~docker_interface() = default;
virtual event_interface* get_event() const = 0;
};
- class event_arg_interface
- {
- public:
- virtual ~event_arg_interface(){}
- };
-
void events_operation_register(event_handle);
void events_operation_cancel(event_handle);
}//end namespace detail
+ class event_arg
+ {
+ public:
+ virtual ~event_arg();
+
+ void stop_propagation() const;
+ bool propagation_stopped() const;
+ private:
+ mutable bool stop_propagation_{ false };
+ };
+
struct general_events;
template
@@ -62,15 +67,16 @@ namespace nana
{
basic_event * const event_ptr;
std::function invoke;
- bool flag_entered = false;
- bool flag_deleted = false;
+ bool flag_entered{ false };
+ bool flag_deleted{ false };
+ bool unignorable{false};
- docker(basic_event * s, std::function && ivk)
- : event_ptr(s), invoke(std::move(ivk))
+ docker(basic_event * s, std::function && ivk, bool unignorable_flag)
+ : event_ptr(s), invoke(std::move(ivk)), unignorable(unignorable_flag)
{}
- docker(basic_event * s, const std::function & ivk)
- : event_ptr(s), invoke(ivk)
+ docker(basic_event * s, const std::function & ivk, bool unignorable_flag)
+ : event_ptr(s), invoke(ivk), unignorable(unignorable_flag)
{}
~docker()
@@ -91,8 +97,8 @@ namespace nana
if (nullptr == dockers_)
dockers_.reset(new std::vector>);
- typedef typename std::remove_reference::type prototype;
- std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn))));
+ using prototype = typename std::remove_reference::type;
+ std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn)), false));
auto evt = reinterpret_cast(static_cast(dck.get()));
dockers_->emplace(dockers_->begin(), std::move(dck));
detail::events_operation_register(evt);
@@ -113,8 +119,8 @@ namespace nana
if (nullptr == dockers_)
dockers_.reset(new std::vector>);
- typedef typename std::remove_reference::type prototype;
- std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn))));
+ using prototype = typename std::remove_reference::type;
+ std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn)), false));
auto evt = reinterpret_cast(static_cast(dck.get()));
dockers_->emplace_back(std::move(dck));
detail::events_operation_register(evt);
@@ -127,6 +133,24 @@ namespace nana
return connect(std::forward(fn));
}
+ template
+ event_handle connect_unignorable(Function && fn, bool in_front = false)
+ {
+ internal_scope_guard lock;
+ if (nullptr == dockers_)
+ dockers_.reset(new std::vector>);
+
+ using prototype = typename std::remove_reference::type;
+ std::unique_ptr dck(new docker(this, factory::value>::build(std::forward(fn)), true));
+ auto evt = reinterpret_cast(static_cast(dck.get()));
+ if (in_front)
+ dockers_->emplace(dockers_->begin(), std::move(dck));
+ else
+ dockers_->emplace_back(std::move(dck));
+ detail::events_operation_register(evt);
+ return evt;
+ }
+
std::size_t length() const
{
internal_scope_guard lock;
@@ -158,20 +182,30 @@ namespace nana
(*output++) = dck.get();
}
+ bool stop_propagation = false;
for (; transitory != output; ++transitory)
{
- std::unique_ptr p(*transitory);
- auto i = std::find(dockers.begin(), dockers.end(), p);
+ auto docker_ptr = *transitory;
+ if (stop_propagation && !docker_ptr->unignorable)
+ continue;
+
+ auto i = std::find_if(dockers.begin(), dockers.end(), [docker_ptr](std::unique_ptr& p){
+ return (docker_ptr == p.get());
+ });
+
if (i != dockers.end())
{
- (*transitory)->flag_entered = true;
- (*transitory)->invoke(arg);
- (*transitory)->flag_entered = false;
+ docker_ptr->flag_entered = true;
+ docker_ptr->invoke(arg);
- if ((*transitory)->flag_deleted)
+ if (arg.propagation_stopped())
+ stop_propagation = true;
+
+ docker_ptr->flag_entered = false;
+
+ if (docker_ptr->flag_deleted)
dockers.erase(i);
}
- p.release();
}
}
@@ -182,7 +216,7 @@ namespace nana
dockers_.reset();
}
- void remove(event_handle evt)
+ void remove(event_handle evt) override
{
internal_scope_guard lock;
if (dockers_)
@@ -362,7 +396,7 @@ namespace nana
};
struct arg_mouse
- : public detail::event_arg_interface
+ : public event_arg
{
event_code evt_code;
::nana::window window_handle;
@@ -386,27 +420,27 @@ namespace nana
unsigned distance; //expressed in multiples or divisions of 120
};
- struct arg_dropfiles : public detail::event_arg_interface
+ struct arg_dropfiles : public event_arg
{
::nana::window window_handle;
::nana::point pos;
std::vector files;
};
- struct arg_expose : public detail::event_arg_interface
+ struct arg_expose : public event_arg
{
::nana::window window_handle;
bool exposed;
};
- struct arg_focus : public detail::event_arg_interface
+ struct arg_focus : public event_arg
{
::nana::window window_handle;
::nana::native_window_type receiver;
bool getting;
};
- struct arg_keyboard : public detail::event_arg_interface
+ struct arg_keyboard : public event_arg
{
event_code evt_code;
::nana::window window_handle;
@@ -416,21 +450,21 @@ namespace nana
bool shift;
};
- struct arg_move : public detail::event_arg_interface
+ struct arg_move : public event_arg
{
::nana::window window_handle;
int x;
int y;
};
- struct arg_resized : public detail::event_arg_interface
+ struct arg_resized : public event_arg
{
::nana::window window_handle;
unsigned width;
unsigned height;
};
- struct arg_resizing : public detail::event_arg_interface
+ struct arg_resizing : public event_arg
{
::nana::window window_handle;
window_border border;
@@ -438,13 +472,13 @@ namespace nana
mutable unsigned height;
};
- struct arg_unload : public detail::event_arg_interface
+ struct arg_unload : public event_arg
{
::nana::window window_handle;
mutable bool cancel;
};
- struct arg_destroy : public detail::event_arg_interface
+ struct arg_destroy : public event_arg
{
::nana::window window_handle;
};
@@ -471,6 +505,7 @@ namespace nana
basic_event move;
basic_event resizing;
basic_event resized;
+
basic_event destroy;
};
@@ -482,16 +517,6 @@ namespace nana
basic_event unload;
};
}//end namespace detail
-
- namespace dev
- {
- template
- struct event_mapping
- {
- typedef general_events type;
- };
- }//end namespace dev
-
}//end namespace nana
#endif
diff --git a/include/nana/gui/detail/inner_fwd_implement.hpp b/include/nana/gui/detail/inner_fwd_implement.hpp
index 31b59733..9e782092 100644
--- a/include/nana/gui/detail/inner_fwd_implement.hpp
+++ b/include/nana/gui/detail/inner_fwd_implement.hpp
@@ -124,7 +124,7 @@ namespace nana{
root_misc(core_window_t * wd, unsigned width, unsigned height)
: window(wd),
- root_graph(width, height)
+ root_graph({ width, height })
{}
};//end struct root_misc
diff --git a/include/nana/gui/detail/native_window_interface.hpp b/include/nana/gui/detail/native_window_interface.hpp
index fca2b828..39cd7c49 100644
--- a/include/nana/gui/detail/native_window_interface.hpp
+++ b/include/nana/gui/detail/native_window_interface.hpp
@@ -1,6 +1,7 @@
/*
* Platform Implementation
- * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -33,7 +34,7 @@ namespace detail
unsigned extra_height; //extra border size, it is useful in Windows, ignore in X11 always 0
};
- static nana::size screen_size();
+ static nana::size primary_monitor_size();
static rectangle screen_area_from_point(const point&);
static window_result create_window(native_window_type, bool nested, const rectangle&, const appearance&);
static native_window_type create_child_window(native_window_type, const rectangle&);
@@ -58,7 +59,7 @@ namespace detail
static nana::point window_position(native_window_type);
static void move_window(native_window_type, int x, int y);
static void move_window(native_window_type, const rectangle&);
- static void bring_to_top(native_window_type);
+ static void bring_top(native_window_type, bool activated);
static void set_window_z_order(native_window_type, native_window_type wd_after, z_order_action action_if_no_wd_after);
static void window_size(native_window_type, const size&);
@@ -69,9 +70,9 @@ namespace detail
static nana::point cursor_position();
static native_window_type get_owner_window(native_window_type);
//For Caret
- static void caret_create(native_window_type, unsigned width, unsigned height);
+ static void caret_create(native_window_type, const ::nana::size&);
static void caret_destroy(native_window_type);
- static void caret_pos(native_window_type, int x, int y);
+ static void caret_pos(native_window_type, const ::nana::point&);
static void caret_visible(native_window_type, bool);
static void set_focus(native_window_type);
diff --git a/include/nana/gui/detail/widget_colors.hpp b/include/nana/gui/detail/widget_colors.hpp
new file mode 100644
index 00000000..d4d81e1a
--- /dev/null
+++ b/include/nana/gui/detail/widget_colors.hpp
@@ -0,0 +1,46 @@
+/*
+* Color Schemes
+* Nana C++ Library(http://www.nanapro.org)
+* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+*
+* Distributed under the Boost Software License, Version 1.0.
+* (See accompanying file LICENSE_1_0.txt or copy at
+* http://www.boost.org/LICENSE_1_0.txt)
+*
+* @file: nana/gui/widget_colors.hpp
+* @description:
+*/
+#ifndef NANA_DETAIL_WIDGET_COLORS_HPP
+#define NANA_DETAIL_WIDGET_COLORS_HPP
+
+#include
+#include
+namespace nana
+{
+ class color_proxy
+ {
+ public:
+ color_proxy(const color_proxy&);
+ color_proxy(color_rgb);
+ color_proxy(colors);
+ color_proxy& operator=(const color_proxy&);
+ color_proxy& operator=(const ::nana::color&);
+ color_proxy& operator=(color_rgb);
+ color_proxy& operator=(colors);
+ color get_color() const;
+ operator color() const;
+ private:
+ std::shared_ptr color_;
+ };//end namespace color_proxy
+
+ struct widget_colors
+ {
+ virtual ~widget_colors() = default;
+
+ color_proxy activated{ static_cast(0x60C8FD) };
+ color_proxy background{colors::button_face};
+ color_proxy foreground{colors::black};
+ };
+}
+
+#endif
\ No newline at end of file
diff --git a/include/nana/gui/detail/window_manager.hpp b/include/nana/gui/detail/window_manager.hpp
index baab1232..2e07ac31 100644
--- a/include/nana/gui/detail/window_manager.hpp
+++ b/include/nana/gui/detail/window_manager.hpp
@@ -150,7 +150,7 @@ namespace detail
core_window_t* root(native_window_type) const;
//Copy the root buffer that wnd specified into DeviceContext
- void map(core_window_t*);
+ void map(core_window_t*, bool forced);
bool update(core_window_t*, bool redraw, bool force);
void refresh_tree(core_window_t*);
diff --git a/include/nana/gui/element.hpp b/include/nana/gui/element.hpp
index 121e7ce6..ee63ecf0 100644
--- a/include/nana/gui/element.hpp
+++ b/include/nana/gui/element.hpp
@@ -30,19 +30,17 @@ namespace nana
class element_interface
{
public:
- typedef paint::graphics & graph_reference;
+ using graph_reference = paint::graphics&;
- virtual ~element_interface()
- {}
-
- virtual bool draw(graph_reference, nana::color_t bgcolor, nana::color_t fgcolor, const nana::rectangle&, element_state) = 0;
+ virtual ~element_interface() = default;
+ virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) = 0;
};
class crook_interface
{
public:
- typedef paint::graphics & graph_reference;
- typedef checkstate state;
+ using graph_reference = paint::graphics&;
+ using state = checkstate;
struct data
{
@@ -50,10 +48,25 @@ namespace nana
bool radio;
};
- virtual ~crook_interface()
- {}
+ virtual ~crook_interface() = default;
+ virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state, const data&) = 0;
+ };
- virtual bool draw(graph_reference, nana::color_t bgcolor, nana::color_t fgcolor, const nana::rectangle&, element_state, const data&) = 0;
+ class border_interface
+ {
+ public:
+ using graph_reference = paint::graphics&;
+
+ virtual ~border_interface() = default;
+ virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, unsigned weight) = 0;
+ };
+
+ class arrow_interface
+ {
+ public:
+ using graph_reference = paint::graphics&;
+ virtual ~arrow_interface() = default;
+ virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, direction) = 0;
};
class provider
@@ -87,16 +100,48 @@ namespace nana
void add_crook(const std::string& name, const pat::cloneable>&);
crook_interface* const * keeper_crook(const std::string& name);
+
+ void add_border(const std::string&, const pat::cloneable>&);
+ border_interface* const * keeper_border(const std::string&);
+
+ void add_arrow(const std::string&, const pat::cloneable>&);
+ arrow_interface* const * keeper_arrow(const std::string&);
+
+ void add_button(const std::string&, const pat::cloneable>&);
+ element_interface* const* keeper_button(const std::string&);
};
+ class crook;
template
void add_crook(const std::string& name)
{
- typedef provider::factory factory_t;
+ using factory_t = provider::factory;
provider().add_crook(name, pat::cloneable(factory_t()));
}
- class crook;
+ class border;
+ template
+ void add_border(const std::string& name)
+ {
+ using factory_t = provider::factory;
+ provider().add_border(name, pat::cloneable(factory_t()));
+ }
+
+ class arrow;
+ template
+ void add_arrow(const std::string& name)
+ {
+ using factory_t = provider::factory;
+ provider().add_arrow(name, pat::cloneable(factory_t()));
+ }
+
+ class button;
+ template
+ void add_button(const std::string& name)
+ {
+ using factory_t = provider::factory;
+ provider().add_button(name, pat::cloneable(factory_t()));
+ }
}//end namespace element
template class facade;
@@ -106,11 +151,10 @@ namespace nana
: public element::element_interface
{
public:
- typedef ::nana::paint::graphics & graph_reference;
- typedef element::crook_interface::state state;
+ using graph_reference = ::nana::paint::graphics &;
+ using state = element::crook_interface::state;
- facade();
- facade(const char* name);
+ facade(const char* name = nullptr);
facade & reverse();
facade & check(state);
@@ -122,11 +166,65 @@ namespace nana
void switch_to(const char*);
public:
//Implement element_interface
- bool draw(graph_reference, nana::color_t bgcolor, nana::color_t fgcolor, const nana::rectangle& r, element_state) override;
+ bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state) override;
private:
element::crook_interface::data data_;
element::crook_interface* const * keeper_;
- };
+ }; //end class facade
+
+ template<>
+ class facade
+ : public element::element_interface
+ {
+ using graph_reference = ::nana::paint::graphics &;
+ public:
+ facade(const char* name = nullptr);
+
+ void switch_to(const char*);
+ public:
+ //Implement element_interface
+ bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
+ private:
+ element::border_interface* const * keeper_;
+ };//end class facade
+
+ template<>
+ class facade
+ : public element::element_interface
+ {
+ using graph_reference = ::nana::paint::graphics &;
+ public:
+ enum class style
+ {
+ solid
+ };
+
+ facade(const char* name = nullptr);
+
+ void switch_to(const char*);
+ void direction(::nana::direction);
+ public:
+ //Implement element_interface
+ bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
+ private:
+ element::arrow_interface* const * keeper_;
+ ::nana::direction dir_{::nana::direction::north};
+ };//end class facade
+
+ template<>
+ class facade
+ : public element::element_interface
+ {
+ public:
+ facade(const char* name = nullptr);
+ void switch_to(const char*);
+ public:
+ //Implement element_interface
+ bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
+ private:
+ element::element_interface* const * keeper_;
+ };//end class facade
+
namespace element
{
@@ -144,7 +242,7 @@ namespace nana
void set(const cloneable_element&);
void set(const char*);
- bool draw(graph_reference, nana::color_t bgcolor, nana::color_t fgcolor, const nana::rectangle&, element_state);
+ bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state);
private:
cloneable_element holder_;
element_interface * place_ptr_;
@@ -174,7 +272,7 @@ namespace nana
void stretch_parts(unsigned left, unsigned top, unsigned right, unsigned bottom);
//Implement the methods of element_interface.
- virtual bool draw(graph_reference, nana::color_t bgcolor, nana::color_t fgcolor, const nana::rectangle&, element_state);
+ virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state);
private:
struct draw_method;
struct draw_image;
diff --git a/include/nana/gui/msgbox.hpp b/include/nana/gui/msgbox.hpp
index f179c556..fe6ae1ff 100644
--- a/include/nana/gui/msgbox.hpp
+++ b/include/nana/gui/msgbox.hpp
@@ -1,7 +1,7 @@
/*
* A Message Box Class
* Nana C++ Library(http://www.nanapro.org)
-* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
+* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -91,6 +91,141 @@ namespace nana
button_t button_;
icon_t icon_;
};
+
+ class inputbox
+ {
+ struct abstract_content
+ {
+ virtual ~abstract_content() = default;
+
+ virtual const ::nana::string& label() const = 0;
+ virtual window create(window, unsigned label_px) = 0;
+ virtual unsigned fixed_pixels() const = 0;
+ };
+ public:
+ class integer
+ : public abstract_content
+ {
+ struct implement;
+ public:
+ integer(::nana::string label, int init_value, int begin, int last, int step);
+ ~integer();
+
+ int value() const;
+ private:
+ //Implementation of abstract_content
+ const ::nana::string& label() const override;
+ window create(window, unsigned label_px) override;
+ unsigned fixed_pixels() const override;
+ private:
+ std::unique_ptr impl_;
+ };
+
+ class real
+ : public abstract_content
+ {
+ struct implement;
+ public:
+ real(::nana::string label, double init_value, double begin, double last, double step);
+ ~real();
+
+ double value() const;
+ private:
+ //Implementation of abstract_content
+ const ::nana::string& label() const override;
+ window create(window, unsigned label_px) override;
+ unsigned fixed_pixels() const override;
+ private:
+ std::unique_ptr impl_;
+ };
+
+ class text
+ : public abstract_content
+ {
+ struct implement;
+ public:
+ text(::nana::string label);
+ text(::nana::string label, std::vector<::nana::string>);
+
+ ~text();
+
+ ::nana::string value() const;
+ private:
+ //Implementation of abstract_content
+ const ::nana::string& label() const override;
+ window create(window, unsigned label_px) override;
+ unsigned fixed_pixels() const override;
+ private:
+ std::unique_ptr impl_;
+ };
+
+ class date
+ : public abstract_content
+ {
+ struct implement;
+ public:
+ date(::nana::string label);
+
+ ~date();
+
+ ::nana::string value() const;
+ int year() const;
+ int month() const; //[1, 12]
+ int day() const; //[1, 31]
+ unsigned fixed_pixels() const override;
+ private:
+ //Implementation of abstract_content
+ const ::nana::string& label() const override;
+ window create(window, unsigned label_px) override;
+ private:
+ std::unique_ptr impl_;
+ };
+
+ inputbox(window, ::nana::string description, ::nana::string title = ::nana::string());
+
+ template
+ bool show(Args&& ... args)
+ {
+ std::vector contents;
+ _m_fetch_args(contents, std::forward(args)...);
+
+ if (contents.empty())
+ return false;
+
+ return _m_open(contents, false);
+ }
+
+ template
+ bool show_modal(Args&& ... args)
+ {
+ std::vector contents;
+ _m_fetch_args(contents, std::forward(args)...);
+
+ if (contents.empty())
+ return false;
+
+ return _m_open(contents, true);
+ }
+
+ /// Sets a verifier to verify the user input.
+ void verify(std::function verifier);
+ private:
+ void _m_fetch_args(std::vector&);
+
+ template
+ void _m_fetch_args(std::vector& contents, abstract_content& content, Args&&... args)
+ {
+ contents.push_back(&content);
+ _m_fetch_args(contents, std::forward(args)...);
+ }
+
+ bool _m_open(std::vector&, bool modal);
+ private:
+ window owner_;
+ ::nana::string description_;
+ ::nana::string title_;
+ std::function verifier_;
+ };
}//end namespace nana
#endif
diff --git a/include/nana/gui/notifier.hpp b/include/nana/gui/notifier.hpp
index f7a7531d..c6eea9da 100644
--- a/include/nana/gui/notifier.hpp
+++ b/include/nana/gui/notifier.hpp
@@ -1,7 +1,7 @@
/*
* Definition of Notifier
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,6 +20,7 @@ namespace nana
class notifier;
struct arg_notifier
+ : public event_arg
{
event_code evt_code;
notifier* notifier_ptr;
diff --git a/include/nana/gui/programming_interface.hpp b/include/nana/gui/programming_interface.hpp
index 2fcb4b15..b65a15fc 100644
--- a/include/nana/gui/programming_interface.hpp
+++ b/include/nana/gui/programming_interface.hpp
@@ -1,7 +1,7 @@
/*
* Nana GUI Programming Interface Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,7 +13,7 @@
#ifndef NANA_GUI_PROGRAMMING_INTERFACE_HPP
#define NANA_GUI_PROGRAMMING_INTERFACE_HPP
#include
-#include GUI_BEDROCK_HPP
+#include "detail/bedrock.hpp"
#include "effects.hpp"
#include "detail/general_events.hpp"
#include
@@ -24,6 +24,17 @@ namespace nana
class drawer_trigger;
class widget;
+ namespace dev
+ {
+ /// Traits for widget classes
+ template
+ struct widget_traits
+ {
+ using event_type = ::nana::general_events;
+ using scheme_type = ::nana::widget_colors;
+ };
+ }
+
namespace API
{
void effects_edge_nimbus(window, effects::edge_nimbus);
@@ -45,6 +56,16 @@ namespace API
}
bool set_events(window, const std::shared_ptr&);
+
+ template
+ std::unique_ptr make_scheme()
+ {
+ return std::unique_ptr(
+ static_cast(::nana::detail::bedrock::instance().make_scheme(::nana::detail::scheme_factory()).release()));
+ }
+
+ void set_scheme(window, widget_colors*);
+ widget_colors* get_scheme(window);
void attach_drawer(widget&, drawer_trigger&);
nana::string window_caption(window);
@@ -70,8 +91,6 @@ namespace API
bool register_shortkey(window, unsigned long);
void unregister_shortkey(window);
- nana::size screen_size();
- rectangle screen_area_from_point(const point&);
nana::point cursor_position();
rectangle make_center(unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the screen.
rectangle make_center(window, unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the window
@@ -100,7 +119,8 @@ namespace API
void window_icon_default(const paint::image&);
void window_icon(window, const paint::image&);
- bool empty_window(window); ///< Determines whether a window is existing.
+ bool empty_window(window); ///< Determines whether a window is existing.
+ bool is_window(window); ///< Determines whether a window is existing, equal to !empty_window.
void enable_dropfiles(window, bool);
/// \brief Retrieves the native window of a Nana.GUI window.
@@ -127,16 +147,16 @@ namespace API
bool set_parent_window(window, window new_parent);
template
- typename ::nana::dev::event_mapping::type & events(window wd)
+ typename ::nana::dev::widget_traits::event_type & events(window wd)
{
- typedef typename ::nana::dev::event_mapping::type event_type;
+ using event_type = typename ::nana::dev::widget_traits::event_type;
internal_scope_guard lock;
auto * general_evt = detail::get_general_events(wd);
if (nullptr == general_evt)
throw std::invalid_argument("API::events(): bad parameter window handle, no events object or invalid window handle.");
- if (std::is_same::value)
+ if (std::is_same<::nana::general_events, event_type>::value)
return *static_cast(general_evt);
auto * widget_evt = dynamic_cast(general_evt);
@@ -145,7 +165,7 @@ namespace API
return *widget_evt;
}
- template::value>::type* = nullptr>
+ template::value>::type* = nullptr>
bool emit_event(event_code evt_code, window wd, const EventArg& arg)
{
auto & brock = ::nana::detail::bedrock::instance();
@@ -154,13 +174,35 @@ namespace API
void umake_event(event_handle);
+ template
+ typename ::nana::dev::widget_traits::scheme_type & scheme(window wd)
+ {
+ using scheme_type = typename ::nana::dev::widget_traits::scheme_type;
+
+ internal_scope_guard lock;
+ auto * wdg_colors = dev::get_scheme(wd);
+ if (nullptr == wdg_colors)
+ throw std::invalid_argument("API::scheme(): bad parameter window handle, no events object or invalid window handle.");
+
+ if (std::is_same<::nana::widget_colors, scheme_type>::value)
+ return *static_cast(wdg_colors);
+
+ auto * comp_wdg_colors = dynamic_cast(wdg_colors);
+ if (nullptr == comp_wdg_colors)
+ throw std::invalid_argument("API::scheme(): bad template parameter Widget, the widget type and window handle do not match.");
+ return *comp_wdg_colors;
+ }
+
nana::point window_position(window);
void move_window(window, int x, int y);
void move_window(window wd, const rectangle&);
- void bring_to_top(window);
+ void bring_top(window, bool activated);
bool set_window_z_order(window wd, window wd_after, z_order_action action_if_no_wd_after);
+ void draw_through(window, std::function);
+ void map_through_widgets(window, native_drawable_type);
+
nana::size window_size(window);
void window_size(window, const size&);
bool window_rectangle(window, rectangle&);
@@ -185,6 +227,7 @@ namespace API
void refresh_window_tree(window); ///< Refreshs the specified window and all it’s children windows, then display it immediately
void update_window(window); ///< Copies the off-screen buffer to the screen for immediate display.
+ void window_caption(window, const std::string& title_utf8);
void window_caption(window, const nana::string& title);
nana::string window_caption(window);
@@ -201,17 +244,18 @@ namespace API
void capture_ignore_children(bool ignore); ///< Enables or disables the captured window whether redirects the mouse input to its children if the mouse is over its children.
void modal_window(window); ///< Blocks the routine til the specified window is closed.
void wait_for(window);
- color_t foreground(window);
- color_t foreground(window, color_t);
- color_t background(window);
- color_t background(window, color_t);
- color_t active(window);
- color_t active(window, color_t);
+
+ color fgcolor(window);
+ color fgcolor(window, const color&);
+ color bgcolor(window);
+ color bgcolor(window, const color&);
+ color activated_color(window);
+ color activated_color(window, const color&);
void create_caret(window, unsigned width, unsigned height);
void destroy_caret(window);
void caret_effective_range(window, const rectangle&);
- void caret_pos(window, int x, int y);
+ void caret_pos(window, const ::nana::point&);
nana::point caret_pos(window);
nana::size caret_size(window);
void caret_size(window, const size&);
diff --git a/include/nana/gui/screen.hpp b/include/nana/gui/screen.hpp
new file mode 100644
index 00000000..ef2aaac1
--- /dev/null
+++ b/include/nana/gui/screen.hpp
@@ -0,0 +1,52 @@
+/*
+* Screen Informations
+* Nana C++ Library(http://www.nanapro.org)
+* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
+*
+* Distributed under the Boost Software License, Version 1.0.
+* (See accompanying file LICENSE_1_0.txt or copy at
+* http://www.boost.org/LICENSE_1_0.txt)
+*
+* @file: nana/gui/screen.hpp
+*/
+
+#ifndef NANA_GUI_SCREEN_HPP
+#define NANA_GUI_SCREEN_HPP
+#include "basis.hpp"
+#include
+#include
+
+namespace nana
+{
+ /// The monitor display metrics
+ class display
+ {
+ public:
+ virtual ~display() = default;
+
+ /// The index of monitor.
+ virtual std::size_t get_index() const = 0;
+
+ /// Returns the positional coordinates and size of the display device in reference to the desktop area
+ virtual const ::nana::rectangle& area() const = 0;
+ };
+
+ class screen
+ {
+ public:
+ static ::nana::size desktop_size();
+ static ::nana::size primary_monitor_size();
+ static std::shared_ptr from_point(const point&);
+ static std::shared_ptr from_window(window);
+
+ /// Returns the number of display monitors
+ std::size_t count() const;
+
+ std::shared_ptr get_display(std::size_t index) const;
+ std::shared_ptr get_primary() const;
+
+ void for_each(std::function) const;
+ };
+}//end namespace nana
+
+#endif
diff --git a/include/nana/gui/timer.hpp b/include/nana/gui/timer.hpp
index 458e929e..893a4e5d 100644
--- a/include/nana/gui/timer.hpp
+++ b/include/nana/gui/timer.hpp
@@ -1,6 +1,6 @@
/*
* A Timer Implementation
- * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,6 +22,7 @@ namespace nana
/// Can repeatedly call a piece of code.
struct arg_elapse
+ : public event_arg
{
long long id; //timer identifier;
};
diff --git a/include/nana/gui/widgets/button.hpp b/include/nana/gui/widgets/button.hpp
index f6d67d9b..5305e4f6 100644
--- a/include/nana/gui/widgets/button.hpp
+++ b/include/nana/gui/widgets/button.hpp
@@ -53,10 +53,10 @@ namespace nana{
void _m_draw_background(graph_reference);
void _m_draw_border(graph_reference);
private:
- widget* widget_;
- paint::graphics* graph_;
+ widget* wdg_{nullptr};
+ paint::graphics* graph_{nullptr};
- element::cite_bground cite_;
+ element::cite_bground cite_{"button"};
struct attr_tag
{
@@ -68,8 +68,8 @@ namespace nana{
bool enable_pushed;
bool focus_color;
paint::image * icon;
- color_t bgcolor;
- color_t fgcolor;
+ ::nana::color bgcolor;
+ ::nana::color fgcolor;
}attr_;
};
}//end namespace button
diff --git a/include/nana/gui/widgets/categorize.hpp b/include/nana/gui/widgets/categorize.hpp
index 204e4fc5..72df23d6 100644
--- a/include/nana/gui/widgets/categorize.hpp
+++ b/include/nana/gui/widgets/categorize.hpp
@@ -1,7 +1,7 @@
/*
* A Categorize Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -23,6 +23,7 @@ namespace nana
template
struct arg_categorize
+ : public event_arg
{
categorize & widget;
ValueType & value;
@@ -164,7 +165,7 @@ namespace nana
categorize(window wd, const rectangle& r = rectangle(), bool visible = true)
{
- this->get_drawer_trigger().template create_event_agent(*this);
+ this->get_drawer_trigger().create_event_agent(*this);
this->create(wd, r, visible);
}
diff --git a/include/nana/gui/widgets/checkbox.hpp b/include/nana/gui/widgets/checkbox.hpp
index 5f9da66a..0795fa1a 100644
--- a/include/nana/gui/widgets/checkbox.hpp
+++ b/include/nana/gui/widgets/checkbox.hpp
@@ -44,7 +44,6 @@ namespace drawerbase
private:
static const int interval = 4;
widget* widget_;
- unsigned state_;
std::unique_ptr imptr_;
implement * impl_;
};
diff --git a/include/nana/gui/widgets/combox.hpp b/include/nana/gui/widgets/combox.hpp
index fc00c092..5a1f7e84 100644
--- a/include/nana/gui/widgets/combox.hpp
+++ b/include/nana/gui/widgets/combox.hpp
@@ -1,7 +1,7 @@
/*
* A Combox Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,6 +14,7 @@
#define NANA_GUI_WIDGETS_COMBOX_HPP
#include "widget.hpp"
#include "float_listbox.hpp"
+#include "skeletons/text_editor_scheme.hpp"
#include
#include
#include
@@ -21,15 +22,13 @@
namespace nana
{
/// A list box combined with a textbox - the list box should drop down when the user selects the arrow next to the control
- class combox;
+ class combox;
struct arg_combox
+ : public event_arg
{
combox & widget;
-
- arg_combox(combox& wdg)
- : widget(wdg)
- {}
+ arg_combox(combox&);
};
namespace drawerbase
@@ -39,7 +38,8 @@ namespace nana
struct combox_events
: public general_events
{
- basic_event selected;
+ basic_event selected;
+ basic_event text_changed;
};
class drawer_impl;
@@ -51,8 +51,6 @@ namespace nana
trigger();
~trigger();
- void set_accept(std::function&&);
-
drawer_impl& get_drawer_impl();
const drawer_impl& get_drawer_impl() const;
private:
@@ -69,7 +67,6 @@ namespace nana
void key_press(graph_reference, const arg_keyboard&) override;
void key_char(graph_reference, const arg_keyboard&) override;
private:
- std::function pred_acceptive_;
drawer_impl * drawer_;
};
@@ -160,7 +157,7 @@ namespace nana
}//end namespace drawerbase
class combox
- : public widget_object,
+ : public widget_object,
public nana::concepts::any_objective
{
public:
@@ -169,15 +166,15 @@ namespace nana
combox();
combox(window, bool visible);
- combox(window, const nana::string& text, bool visible = true);
- combox(window, const nana::char_t* text, bool visible = true);
+ combox(window, nana::string, bool visible = true);
+ combox(window, const nana::char_t*, bool visible = true);
combox(window, const rectangle& r = rectangle(), bool visible = true);
void clear();
void editable(bool);
bool editable() const;
void set_accept(std::function);
- combox& push_back(const nana::string&);
+ combox& push_back(nana::string);
std::size_t the_number_of_options() const;
std::size_t option() const; ///< Index of the last selected, from drop-down list, item.
void option(std::size_t); ///< Select the text specified by index
@@ -223,11 +220,23 @@ namespace nana
private:
item_proxy _m_at_key(std::shared_ptr&&);
void _m_erase(nana::detail::key_interface*);
+ drawerbase::combox::drawer_impl & _m_impl();
+ const drawerbase::combox::drawer_impl& _m_impl() const;
private:
//Overrides widget's virtual functions
nana::string _m_caption() const override;
void _m_caption(nana::string&&) override;
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
};
+
+ namespace dev
+ {
+ template<>
+ struct widget_traits
+ {
+ using event_type = drawerbase::combox::combox_events;
+ using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
+ };
+ }
}
#endif
diff --git a/include/nana/gui/widgets/date_chooser.hpp b/include/nana/gui/widgets/date_chooser.hpp
index 03b47c5d..b4bf2126 100644
--- a/include/nana/gui/widgets/date_chooser.hpp
+++ b/include/nana/gui/widgets/date_chooser.hpp
@@ -1,7 +1,7 @@
/*
* A date chooser Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -43,10 +43,8 @@ namespace nana
bool chose() const;
nana::date read() const;
void week_name(unsigned index, const nana::string&);
- void month_name(unsigned index, const nana::string&);
private:
- void _m_init_color();
- where _m_pos_where(graph_reference, int x, int y);
+ where _m_pos_where(graph_reference, const ::nana::point& pos);
void _m_draw(graph_reference);
void _m_draw_topbar(graph_reference);
void _m_make_drawing_basis(drawing_basis&, graph_reference, const nana::point& refpos);
@@ -58,14 +56,13 @@ namespace nana
bool _m_get_trace(point, int & res);
void _m_perf_transform(transform_action tfid, graph_reference, graph_reference dirtybuf, graph_reference newbuf, const nana::point& refpos);
private:
- void refresh(graph_reference);
+ void refresh(graph_reference) override;
void attached(widget_reference, graph_reference) override;
void mouse_move(graph_reference, const arg_mouse&) override;
void mouse_leave(graph_reference, const arg_mouse&) override;
void mouse_up(graph_reference, const arg_mouse&) override;
private:
nana::string weekstr_[7];
- nana::string monthstr_[12];
widget * widget_;
@@ -91,10 +88,10 @@ namespace nana
struct color_tag
{
- nana::color_t highlight;
- nana::color_t selected;
- nana::color_t normal;
- nana::color_t bkcolor;
+ ::nana::color highlight;
+ ::nana::color selected;
+ ::nana::color normal;
+ ::nana::color bgcolor;
}color_;
};
@@ -116,7 +113,6 @@ namespace nana
bool chose() const;
nana::date read() const;
void weekstr(unsigned index, const nana::string&);///> items;
- std::size_t max_items; // the number of items display.
- mutable std::size_t index; // the result of the selection.
+ std::size_t max_items{10}; // the number of items display.
+ mutable std::size_t index{::nana::npos}; // the result of the selection.
mutable bool have_selected;
-
- module_def();
};
class item_renderer
@@ -51,7 +49,7 @@ namespace nana
typedef paint::graphics& graph_reference;
enum state_t{StateNone, StateHighlighted};
- virtual ~item_renderer() = 0;
+ virtual ~item_renderer() = default;
virtual void image(bool enabled, unsigned pixels) = 0;
virtual void render(widget_reference, graph_reference, const nana::rectangle&, const item_interface*, state_t) = 0;
virtual unsigned item_pixels(graph_reference) const = 0;
diff --git a/include/nana/gui/widgets/form.hpp b/include/nana/gui/widgets/form.hpp
index 4f6c0aaf..0f64c54a 100644
--- a/include/nana/gui/widgets/form.hpp
+++ b/include/nana/gui/widgets/form.hpp
@@ -24,12 +24,10 @@ namespace nana
class trigger: public drawer_trigger
{
public:
- trigger();
void attached(widget_reference, graph_reference) override;
void refresh(graph_reference) override;
- void resized(graph_reference, const arg_resized&) override;
private:
- widget* wd_;
+ widget* wd_{nullptr};
};
}//end namespace form
}//end namespace drawerbase
@@ -47,6 +45,9 @@ namespace nana
form(window, const ::nana::size& = { 300, 200 }, const appearance& = {});
/// Creates a window at the point and size specified by rect, with the specified appearance. This window is always floating above its owner.
form(window, const rectangle&, const appearance& = {});
+
+ void modality() const;
+ void wait_for_this();
};
class nested_form : public widget_object
diff --git a/include/nana/gui/widgets/label.hpp b/include/nana/gui/widgets/label.hpp
index dc79eb1c..c6488e5b 100644
--- a/include/nana/gui/widgets/label.hpp
+++ b/include/nana/gui/widgets/label.hpp
@@ -69,6 +69,8 @@ namespace nana
/// "corrected" size that changes lines to fit the text into the specified width
nana::size measure(unsigned allowed_width_in_pixel) const;
+ static ::nana::size measure(::nana::paint::graphics&, const ::nana::string&, unsigned allowed_width_in_pixel, bool format_enabled, align h_align, align_v v_align);
+
label& text_align(align horizontal_align, align_v vertical_align= align_v::top);
private:
//Overrides widget's virtual function
diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp
index 691e83c5..8274d3e3 100644
--- a/include/nana/gui/widgets/listbox.hpp
+++ b/include/nana/gui/widgets/listbox.hpp
@@ -1,7 +1,7 @@
/*
* A List Box Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -33,10 +33,11 @@ namespace nana
{
struct format
{
- ::nana::color_t bgcolor;
- ::nana::color_t fgcolor;
+ ::nana::color bgcolor;
+ ::nana::color fgcolor;
- format(color_t bgcolor = 0xFF000000, color_t fgcolor = 0xFF000000);
+ format() = default;
+ format(const ::nana::color& bgcolor, const ::nana::color& fgcolor);
};
using format_ptr = std::unique_ptr < format > ;
@@ -49,7 +50,7 @@ namespace nana
cell(cell&&);
cell(nana::string);
cell(nana::string, const format&);
- cell(nana::string, color_t bgcolor, color_t fgcolor);
+ cell(nana::string, const ::nana::color& bgcolor, const ::nana::color& fgcolor);
cell& operator=(const cell&);
cell& operator=(cell&&);
@@ -212,11 +213,11 @@ namespace nana
item_proxy & select(bool);
bool selected() const;
- item_proxy & bgcolor(nana::color_t);
- nana::color_t bgcolor() const;
+ item_proxy & bgcolor(const nana::color&);
+ nana::color bgcolor() const;
- item_proxy& fgcolor(nana::color_t);
- nana::color_t fgcolor() const;
+ item_proxy& fgcolor(const nana::color&);
+ nana::color fgcolor() const;
index_pair pos() const;
@@ -415,9 +416,12 @@ namespace nana
}//end namespace drawerbase
struct arg_listbox
+ : public event_arg
{
mutable drawerbase::listbox::item_proxy item;
bool selected;
+
+ arg_listbox(const drawerbase::listbox::item_proxy&, bool selected);
};
namespace drawerbase
@@ -430,6 +434,15 @@ namespace nana
basic_event checked;
basic_event selected;
};
+
+ struct scheme
+ : public widget_colors
+ {
+ color_proxy header_bgcolor{static_cast(0xf1f2f4)};
+ color_proxy header_grabbed{ static_cast(0x8BD6F6)};
+ color_proxy header_floated{ static_cast(0xBABBBC)};
+ color_proxy item_selected{ static_cast(0xD5EFFC) };
+ };
}
}//end namespace drawerbase
@@ -441,7 +454,7 @@ The user can \a drag the header to \a reisize it or to \a reorganize it.
By \a clicking on a header the list get \a reordered, first up, and then down alternatively,
*/
class listbox
- : public widget_object,
+ : public widget_object,
public concepts::any_objective
{
public:
@@ -471,8 +484,8 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
template
cat_proxy operator[](const Key & ck)
{
- typedef typename nana::detail::type_escape::type key_t;
- std::shared_ptr p(new nana::key>(ck), [](nana::detail::key_interface* p)
+ using catkey = typename ::nana::detail::type_escape::type;
+ std::shared_ptr p(new nana::key>(ck), [](nana::detail::key_interface* p)
{
delete p;
});
@@ -483,8 +496,8 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
template
cat_proxy operator[](Key && ck)
{
- typedef typename nana::detail::type_escape::type key_t;
- std::shared_ptr p(new nana::key>(std::move(ck)), [](nana::detail::key_interface* p)
+ using catkey = typename ::nana::detail::type_escape::type;
+ std::shared_ptr p(new nana::key>(std::move(ck)), [](nana::detail::key_interface* p)
{
delete p;
});
@@ -539,6 +552,9 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
size_type size_categ() const; ///);
void _m_ease_key(nana::detail::key_interface*);
};
+
+ namespace dev
+ {
+ template<>
+ struct widget_traits
+ {
+ using event_type = drawerbase::listbox::listbox_events;
+ using scheme_type = drawerbase::listbox::scheme;
+ };
+ }
}//end namespace nana
#endif
diff --git a/include/nana/gui/widgets/menu.hpp b/include/nana/gui/widgets/menu.hpp
index 7e072324..36f99a28 100644
--- a/include/nana/gui/widgets/menu.hpp
+++ b/include/nana/gui/widgets/menu.hpp
@@ -104,7 +104,7 @@ namespace nana
checks check_style;
};
- virtual ~renderer_interface() = 0;
+ virtual ~renderer_interface() = default;
virtual void background(graph_reference, window) = 0;
virtual void item(graph_reference, const nana::rectangle&, const attr&) = 0;
diff --git a/include/nana/gui/widgets/panel.hpp b/include/nana/gui/widgets/panel.hpp
index a9dc6a18..e1d98d00 100644
--- a/include/nana/gui/widgets/panel.hpp
+++ b/include/nana/gui/widgets/panel.hpp
@@ -1,7 +1,7 @@
/*
* A Panel Implementation
* Nana C++ Library(http://www.nanaro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -25,13 +25,10 @@ namespace nana
{
class drawer: public drawer_trigger
{
- public:
- drawer();
- private:
void attached(widget_reference, graph_reference) override;
void refresh(graph_reference) override;
private:
- window window_;
+ window window_{nullptr};
};
}// end namespace panel
}//end namespace drawerbase
diff --git a/include/nana/gui/widgets/picture.hpp b/include/nana/gui/widgets/picture.hpp
index 7238fe32..5c9b5f97 100644
--- a/include/nana/gui/widgets/picture.hpp
+++ b/include/nana/gui/widgets/picture.hpp
@@ -1,7 +1,7 @@
/*
* A Picture Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -26,7 +26,7 @@ namespace nana
void attached(widget_reference, graph_reference) override;
void load(const nana::char_t* file);
void load(const nana::paint::image&);
- void set_shadow_background(unsigned begin_color, unsigned end_color, bool horizontal);
+ void set_shadow_background(const ::nana::color& from, const ::nana::color& to, bool horizontal);
bool bgstyle(bool is_stretch, nana::arrange, int beg, int end);
private:
void refresh(graph_reference) override;
@@ -35,13 +35,12 @@ namespace nana
widget* widget_;
nana::paint::graphics* graph_;
- struct runtime_type
+ struct
{
- runtime_type();
- unsigned background_shadow_start;
- unsigned background_shadow_end;
+ ::nana::color gradual_from;
+ ::nana::color gradual_to;
bool horizontal;
- }runtime_;
+ }bground_;
struct back_image_tag
{
@@ -72,8 +71,8 @@ namespace nana
int end ///< specify the stretchy area of image.
);
- /// Fills a gradual change color in background.
- void set_shadow_background(unsigned begin_color, unsigned end_color, bool horizontal);
+ /// Fills a gradual-change color in background. If One of colors is invisible or clr_from is equal to clr_to, it draws background in bgcolor.
+ void set_gradual_background(const ::nana::color& clr_from, const ::nana::color& clr_to, bool horizontal);
void transparent(bool);
bool transparent() const;
};
diff --git a/include/nana/gui/widgets/progress.hpp b/include/nana/gui/widgets/progress.hpp
index 6b12fee5..352069df 100644
--- a/include/nana/gui/widgets/progress.hpp
+++ b/include/nana/gui/widgets/progress.hpp
@@ -1,7 +1,7 @@
/*
* A Progress Indicator Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -23,7 +23,6 @@ namespace nana
class trigger: public drawer_trigger
{
public:
- trigger();
unsigned value() const;
unsigned value(unsigned);
unsigned inc();
@@ -41,13 +40,14 @@ namespace nana
bool _m_check_changing(unsigned) const;
private:
static const unsigned border = 2;
- widget * widget_;
- nana::paint::graphics* graph_;
- unsigned draw_width_;
- bool has_value_;
- bool unknown_;
- unsigned max_;
- unsigned value_;
+
+ widget * widget_{nullptr};
+ nana::paint::graphics* graph_{nullptr};
+ unsigned draw_width_{static_cast(-1)};
+ //bool has_value_{true}; //deprecated
+ bool unknown_{false};
+ unsigned max_{100};
+ unsigned value_{0};
}; //end class drawer
}
}//end namespace drawerbase
diff --git a/include/nana/gui/widgets/scroll.hpp b/include/nana/gui/widgets/scroll.hpp
index 26421b48..4b165313 100644
--- a/include/nana/gui/widgets/scroll.hpp
+++ b/include/nana/gui/widgets/scroll.hpp
@@ -1,7 +1,7 @@
/*
* A Scroll Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,8 +22,13 @@ namespace nana
template
struct arg_scroll
+ : public event_arg
{
scroll & widget;
+
+ arg_scroll(scroll & wdg)
+ : widget(wdg)
+ {}
};
namespace drawerbase
@@ -81,9 +86,9 @@ namespace nana
bool _m_check() const;
void _m_adjust_scroll(graph_reference);
void _m_background(graph_reference);
- void _m_button_frame(graph_reference, int x, int y, unsigned width, unsigned height, int state);
+ void _m_button_frame(graph_reference, ::nana::rectangle, int state);
void _m_draw_scroll(graph_reference, int state);
- void _m_draw_button(graph_reference, int x, int y, unsigned width, unsigned height, buttons what, int state);
+ void _m_draw_button(graph_reference, ::nana::rectangle, buttons what, int state);
private:
metrics_type &metrics_;
bool vertical_;
@@ -180,7 +185,7 @@ namespace nana
return false;
}
private:
- void attached(widget_reference widget, graph_reference graph)
+ void attached(widget_reference widget, graph_reference graph) override
{
graph_ = &graph;
widget_ = static_cast< ::nana::scroll*>(&widget);
@@ -190,12 +195,12 @@ namespace nana
timer_.elapse(std::bind(&trigger::_m_tick, this));
}
- void detached()
+ void detached() override
{
graph_ = nullptr;
}
- void refresh(graph_reference graph)
+ void refresh(graph_reference graph) override
{
drawer_.draw(graph, metrics_.what);
}
@@ -213,7 +218,7 @@ namespace nana
API::lazy_refresh();
}
- void mouse_move(graph_reference graph, const ::nana::arg_mouse& arg)
+ void mouse_move(graph_reference graph, const ::nana::arg_mouse& arg) override
{
bool redraw = false;
if(metrics_.pressed && (metrics_.what == buttons::scroll))
@@ -240,7 +245,7 @@ namespace nana
}
}
- void mouse_down(graph_reference graph, const arg_mouse& arg)
+ void mouse_down(graph_reference graph, const arg_mouse& arg) override
{
if(arg.left_button)
{
@@ -275,7 +280,7 @@ namespace nana
}
}
- void mouse_up(graph_reference graph, const arg_mouse& arg)
+ void mouse_up(graph_reference graph, const arg_mouse& arg) override
{
timer_.stop();
@@ -287,7 +292,7 @@ namespace nana
API::lazy_refresh();
}
- void mouse_leave(graph_reference graph, const arg_mouse&)
+ void mouse_leave(graph_reference graph, const arg_mouse&) override
{
if(metrics_.pressed) return;
@@ -296,7 +301,7 @@ namespace nana
API::lazy_refresh();
}
- void mouse_wheel(graph_reference graph, const arg_wheel& arg)
+ void mouse_wheel(graph_reference graph, const arg_wheel& arg) override
{
if(make_step(arg.upwards == false, 3))
{
@@ -307,7 +312,7 @@ namespace nana
private:
void _m_emit_value_changed()
{
- widget_->events().value_changed.emit(::nana::arg_scroll({*widget_}));
+ widget_->events().value_changed.emit(::nana::arg_scroll(*widget_));
}
void _m_tick()
diff --git a/include/nana/gui/widgets/skeletons/text_editor.hpp b/include/nana/gui/widgets/skeletons/text_editor.hpp
index 0af6b895..7b861606 100644
--- a/include/nana/gui/widgets/skeletons/text_editor.hpp
+++ b/include/nana/gui/widgets/skeletons/text_editor.hpp
@@ -1,7 +1,7 @@
/*
* A text editor implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,9 +14,9 @@
#ifndef NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#define NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#include "textbase.hpp"
+#include "text_editor_scheme.hpp"
#include
#include
-#include
namespace nana{ namespace widgets
{
@@ -127,22 +127,37 @@ namespace nana{ namespace widgets
class undo_backspace;
class undo_input_text;
class undo_move_text;
- public:
- typedef nana::char_t char_type;
- typedef textbase::size_type size_type;
- typedef textbase::string_type string_type;
- typedef nana::paint::graphics & graph_reference;
+ struct keywords;
+ class keyword_parser;
+ public:
+ using char_type = ::nana::char_t;
+ using size_type = textbase::size_type;
+ using string_type = textbase::string_type;
+
+ using graph_reference = ::nana::paint::graphics&;
struct ext_renderer_tag
{
- std::function background;
+ std::function background;
};
- text_editor(window, graph_reference);
+ enum class accepts
+ {
+ no_restrict, integer, real
+ };
+
+ text_editor(window, graph_reference, const text_editor_scheme*);
~text_editor();
- bool respone_keyboard(nana::char_t, bool enterable);
+ void set_highlight(const std::string& name, const ::nana::color&, const ::nana::color&);
+ void erase_highlight(const std::string& name);
+ void set_keyword(const ::nana::string& kw, const std::string& name, bool case_sensitive, bool whole_word_matched);
+ void erase_keyword(const ::nana::string& kw);
+
+ void set_accept(std::function);
+ void set_accept(accepts);
+ bool respone_keyboard(char_type);
void typeface_changed();
@@ -151,12 +166,12 @@ namespace nana{ namespace widgets
/// Set the text_editor whether it is line wrapped, it returns false if the state is not changed.
bool line_wrapped(bool);
- void border_renderer(std::function);
+ void border_renderer(std::function);
bool load(const nana::char_t*);
- //text_area
- //@return: Returns true if the area of text is changed.
+ /// Sets the text area.
+ /// @return true if the area is changed with the new value.
bool text_area(const nana::rectangle&);
bool tip_string(nana::string&&);
@@ -180,8 +195,7 @@ namespace nana{ namespace widgets
void text(nana::string);
nana::string text() const;
- //move_caret
- //@brief: Set caret position through text coordinate
+ /// Sets caret position through text coordinate.
void move_caret(const upoint&);
void move_caret_end();
void reset_caret_height() const;
@@ -190,7 +204,7 @@ namespace nana{ namespace widgets
bool selected() const;
bool select(bool);
- //Set the end position of a selected string
+ /// Sets the end position of a selected string.
void set_end_caret();
bool hit_text_area(const point&) const;
bool hit_select_area(nana::upoint pos) const;
@@ -199,6 +213,7 @@ namespace nana{ namespace widgets
/// Returns width of text area excluding the vscroll size.
unsigned width_pixels() const;
+ window window_handle() const;
public:
void draw_scroll_rectangle();
void render(bool focused);
@@ -227,46 +242,43 @@ namespace nana{ namespace widgets
skeletons::textbase& textbase();
const skeletons::textbase& textbase() const;
private:
- nana::color_t _m_bgcolor() const;
+ bool _m_accepts(char_type) const;
+ ::nana::color _m_bgcolor() const;
bool _m_scroll_text(bool vertical);
void _m_on_scroll(const arg_mouse&);
void _m_scrollbar();
- nana::size _m_text_area() const;
+ ::nana::size _m_text_area() const;
void _m_get_scrollbar_size();
void _m_reset();
- nana::upoint _m_put(nana::string);
- nana::upoint _m_erase_select();
+ ::nana::upoint _m_put(nana::string);
+ ::nana::upoint _m_erase_select();
bool _m_make_select_string(nana::string&) const;
static bool _m_resolve_text(const nana::string&, std::vector> & lines);
bool _m_cancel_select(int align);
unsigned _m_tabs_pixels(size_type tabs) const;
- nana::size _m_text_extent_size(const char_type*) const;
nana::size _m_text_extent_size(const char_type*, size_type n) const;
- //_m_move_offset_x_while_over_border
- //@brief: Moves the view window
+ /// Moves the view of window.
bool _m_move_offset_x_while_over_border(int many);
bool _m_move_select(bool record_undo);
int _m_text_top_base() const;
- //_m_endx
- //@brief: Gets the right point of text area
+
+ /// Returns the right point of text area.
int _m_endx() const;
- //_m_endy
- //@brief: Get the bottom point of text area
+ /// Returns the bottom point of text area.
int _m_endy() const;
- void _m_draw_tip_string() const;
-
+ void _m_draw_parse_string(const keyword_parser&, bool rtl, ::nana::point pos, const ::nana::color& fgcolor, const ::nana::char_t*, std::size_t len) const;
//_m_draw_string
//@brief: Draw a line of string
- void _m_draw_string(int top, nana::color_t color, const nana::upoint& str_pos, const nana::string&, bool if_mask) const;
- //_m_draw
- //@brief: Draw a character at a position specified by caret pos.
- //@return: true if beyond the border
- bool _m_draw(nana::char_t, std::size_t secondary_before);
+ void _m_draw_string(int top, const ::nana::color&, const nana::upoint& str_pos, const nana::string&, bool if_mask) const;
+ //_m_update_caret_line
+ //@brief: redraw whole line specified by caret pos.
+ //@return: true if caret overs the border
+ bool _m_update_caret_line(std::size_t secondary_before);
bool _m_get_sort_select_points(nana::upoint&, nana::upoint&) const;
void _m_offset_y(int y);
@@ -279,6 +291,9 @@ namespace nana{ namespace widgets
undoable undo_;
nana::window window_;
graph_reference graph_;
+ const text_editor_scheme* scheme_;
+ std::unique_ptr keywords_;
+
skeletons::textbase textbase_;
nana::char_t mask_char_{0};
@@ -286,6 +301,9 @@ namespace nana{ namespace widgets
struct attributes
{
+ accepts acceptive{ accepts::no_restrict };
+ std::function pred_acceptive;
+
nana::string tip_string;
bool line_wrapped{false};
@@ -308,7 +326,7 @@ namespace nana{ namespace widgets
unsigned scroll_pixels;
unsigned vscroll;
unsigned hscroll;
- std::function border_renderer;
+ std::function border_renderer;
}text_area_;
struct selection
diff --git a/include/nana/gui/widgets/skeletons/text_editor_scheme.hpp b/include/nana/gui/widgets/skeletons/text_editor_scheme.hpp
new file mode 100644
index 00000000..00806b3b
--- /dev/null
+++ b/include/nana/gui/widgets/skeletons/text_editor_scheme.hpp
@@ -0,0 +1,22 @@
+
+#ifndef NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
+#define NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
+
+#include "../../detail/widget_colors.hpp"
+
+namespace nana
+{
+ namespace widgets
+ {
+ namespace skeletons
+ {
+ struct text_editor_scheme
+ : public ::nana::widget_colors
+ {
+ color_proxy selection{static_cast(0x3399FF)};
+ color_proxy selection_text{colors::white};
+ };
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/include/nana/gui/widgets/skeletons/text_token_stream.hpp b/include/nana/gui/widgets/skeletons/text_token_stream.hpp
index a753f3f4..024c12ce 100644
--- a/include/nana/gui/widgets/skeletons/text_token_stream.hpp
+++ b/include/nana/gui/widgets/skeletons/text_token_stream.hpp
@@ -45,9 +45,7 @@ namespace nana{ namespace widgets{ namespace skeletons
tokenizer(const nana::string& s, bool format_enabled)
: iptr_(s.data()),
endptr_(s.data() + s.size()),
- format_enabled_(format_enabled),
- format_state_(false),
- revert_token_(token::eof)
+ format_enabled_(format_enabled)
{
}
@@ -414,17 +412,14 @@ namespace nana{ namespace widgets{ namespace skeletons
}
}
private:
- const nana::char_t * iptr_;
- const nana::char_t * endptr_;
+ const ::nana::char_t * iptr_;
+ const ::nana::char_t * endptr_;
const bool format_enabled_;
- bool format_state_;
+ bool format_state_{false};
- nana::string idstr_;
+ ::nana::string idstr_;
std::pair binary_;
-
- std::size_t whspace_size_;
-
- token revert_token_;
+ token revert_token_{token::eof};
};
//The fblock states a format, and a format from which it is inherted
@@ -439,16 +434,16 @@ namespace nana{ namespace widgets{ namespace skeletons
};
};
- nana::string font;
+ ::nana::string font;
std::size_t font_size;
bool bold;
bool bold_empty; //bold should be ignored if bold_empty is true
aligns::t text_align;
- nana::color_t bgcolor; //If the color is not specified, it will be ignored, and the system will search for its parent.
- nana::color_t fgcolor; //ditto
+ ::nana::color bgcolor; //If the color is not specified, it will be ignored, and the system will search for its parent.
+ ::nana::color fgcolor; //ditto
- nana::string target;
- nana::string url;
+ ::nana::string target;
+ ::nana::string url;
fblock * parent;
};
@@ -528,7 +523,7 @@ namespace nana{ namespace widgets{ namespace skeletons
{
public:
data_image(const nana::string& imgpath, const nana::size & sz, std::size_t limited)
- : image_(imgpath), limited_(limited)
+ : image_(imgpath)//, limited_(limited)
{
size_ = image_.size();
@@ -597,7 +592,6 @@ namespace nana{ namespace widgets{ namespace skeletons
nana::string str_;
nana::paint::image image_;
nana::size size_;
- std::size_t limited_;
};
class dstream
@@ -741,41 +735,45 @@ namespace nana{ namespace widgets{ namespace skeletons
switch(tknizer.read())
{
case token::number:
- fp->fgcolor = tknizer.number();
+ {
+ pixel_color_t px;
+ px.value = static_cast(tknizer.number());
+ fp->fgcolor = {px.element.red, px.element.green, px.element.blue};
+ }
break;
case token::red:
- fp->fgcolor = 0xFF0000;
+ fp->fgcolor = colors::red;
break;
case token::green:
- fp->fgcolor = 0xFF00;
+ fp->fgcolor = colors::green;
break;
case token::blue:
- fp->fgcolor = 0xFF;
+ fp->fgcolor = colors::blue;
break;
case token::white:
- fp->fgcolor = 0xFFFFFF;
+ fp->fgcolor = colors::white;
break;
case token::black:
- fp->fgcolor = 0x0;
+ fp->fgcolor = colors::black;
break;
default:
throw std::runtime_error("");
}
break;
case token::red: //support the omitting of color.
- fp->fgcolor = 0xFF0000;
+ fp->fgcolor = colors::red;
break;
case token::green: //support the omitting of color.
- fp->fgcolor = 0xFF00;
+ fp->fgcolor = colors::green;
break;
case token::blue: //support the omitting of color.
- fp->fgcolor = 0xFF;
+ fp->fgcolor = colors::blue;
break;
case token::white: //support the omitting of color.
- fp->fgcolor = 0xFFFFFF;
+ fp->fgcolor = colors::white;
break;
case token::black: //support the omitting of color.
- fp->fgcolor = 0x0;
+ fp->fgcolor = colors::black;
break;
case token::baseline:
fp->text_align = fblock::aligns::baseline;
@@ -867,10 +865,6 @@ namespace nana{ namespace widgets{ namespace skeletons
fbp->bold_empty = true;
fbp->text_align = fblock::aligns::baseline;
- //Refer to the definition for the color specification.
- fbp->bgcolor = 0xFFFFFFFF;
- fbp->fgcolor = 0xFFFFFFFF;
-
fbp->parent = nullptr;
fblocks_.push_back(fbp);
@@ -910,8 +904,7 @@ namespace nana{ namespace widgets{ namespace skeletons
v.data_ptr = new data_text(idstr);
break;
default:
- int * debug = 0; //for debug
- *debug = 0;
+ break;
}
line.push_back(v);
@@ -928,7 +921,6 @@ namespace nana{ namespace widgets{ namespace skeletons
}
private:
- bool format_enabled_;
std::vector fblocks_;
std::list > lines_;
diff --git a/include/nana/gui/widgets/skeletons/textbase.hpp b/include/nana/gui/widgets/skeletons/textbase.hpp
index 3c1cae59..6bdcf105 100644
--- a/include/nana/gui/widgets/skeletons/textbase.hpp
+++ b/include/nana/gui/widgets/skeletons/textbase.hpp
@@ -1,7 +1,7 @@
/*
* A textbase class implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -511,6 +511,9 @@ namespace skeletons
_m_first_change();
changed_ = true;
}
+
+ if (evt_agent_)
+ evt_agent_->text_changed();
}
private:
std::deque text_cont_;
diff --git a/include/nana/gui/widgets/skeletons/textbase_export_interface.hpp b/include/nana/gui/widgets/skeletons/textbase_export_interface.hpp
index 6f474721..eeda5b45 100644
--- a/include/nana/gui/widgets/skeletons/textbase_export_interface.hpp
+++ b/include/nana/gui/widgets/skeletons/textbase_export_interface.hpp
@@ -1,7 +1,7 @@
/*
* Definitions of textbase export interfaces
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -25,6 +25,7 @@ namespace nana{ namespace widgets
virtual ~textbase_event_agent_interface() = default;
virtual void first_change() = 0; ///< An event for the text first change after text has been opened or stored.
+ virtual void text_changed() = 0; ///< An event for the change of text.
};
}//end namespace skeletons
}//end namespace widgets
diff --git a/include/nana/gui/widgets/slider.hpp b/include/nana/gui/widgets/slider.hpp
index 51ada7e5..ca1ab75a 100644
--- a/include/nana/gui/widgets/slider.hpp
+++ b/include/nana/gui/widgets/slider.hpp
@@ -1,7 +1,7 @@
/*
* A Slider Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -19,8 +19,11 @@ namespace nana
class slider;
struct arg_slider
+ : public event_arg
{
slider & widget;
+
+ arg_slider(slider&);
};
namespace drawerbase
@@ -41,7 +44,7 @@ namespace nana
class provider
{
public:
- virtual ~provider() = 0;
+ virtual ~provider() = default;
virtual nana::string adorn_trace(unsigned vmax, unsigned vadorn) const = 0;
};
@@ -74,7 +77,7 @@ namespace nana
unsigned vcur_scale; //pixels of vcur scale.
};
- virtual ~renderer() = 0;
+ virtual ~renderer() = default;
virtual void background(window, graph_reference, bool isglass) = 0;
virtual void adorn(window, graph_reference, const adorn_t&) = 0;
diff --git a/include/nana/gui/widgets/spinbox.hpp b/include/nana/gui/widgets/spinbox.hpp
new file mode 100644
index 00000000..a1a85021
--- /dev/null
+++ b/include/nana/gui/widgets/spinbox.hpp
@@ -0,0 +1,124 @@
+/*
+ * A Spin box widget
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
+ *
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * @file: nana/gui/widgets/spinbox.hpp
+ */
+
+#ifndef NANA_GUI_WIDGET_SPINBOX_HPP
+#define NANA_GUI_WIDGET_SPINBOX_HPP
+#include "widget.hpp"
+#include "skeletons/text_editor_scheme.hpp"
+
+namespace nana
+{
+ class spinbox;
+
+ struct arg_spinbox
+ : public event_arg
+ {
+ spinbox & widget;
+ arg_spinbox(spinbox&);
+ };
+
+ namespace drawerbase
+ {
+ namespace spinbox
+ {
+ struct spinbox_events
+ : public general_events
+ {
+ basic_event text_changed;
+ };
+
+ /// Declaration of internal spinbox implementation
+ class implementation;
+
+ /// Drawer of spinbox
+ class drawer
+ : public ::nana::drawer_trigger
+ {
+ drawer(const drawer&) = delete;
+ drawer(drawer&&) = delete;
+ drawer& operator=(const drawer&) = delete;
+ drawer& operator=(drawer&&) = delete;
+ public:
+ drawer();
+ ~drawer();
+ implementation * impl() const;
+ private:
+ //Overrides drawer_trigger
+ void attached(widget_reference, graph_reference) override;
+ void refresh(graph_reference) override;
+
+ void focus(graph_reference, const arg_focus&) override;
+ void mouse_wheel(graph_reference, const arg_wheel&) override;
+ void mouse_down(graph_reference, const arg_mouse&) override;
+ void mouse_move(graph_reference, const arg_mouse&) override;
+ void mouse_up(graph_reference, const arg_mouse& arg) override;
+ void mouse_leave(graph_reference, const arg_mouse&) override;
+ void key_press(graph_reference, const arg_keyboard&) override;
+ void key_char(graph_reference, const arg_keyboard&) override;
+ void resized(graph_reference, const arg_resized&) override;
+ private:
+ implementation * const impl_;
+ };
+ };
+ }//end namespace drawerbase
+
+ /// Spinbox Widget
+ class spinbox
+ : public widget_object
+ {
+ public:
+ /// Constructs a spinbox.
+ spinbox();
+ spinbox(window, bool visible);
+ spinbox(window, const nana::rectangle& = {}, bool visible = true);
+
+ /// Sets the widget whether it accepts user keyboard input.
+ /// @param accept Set to indicate whether it accepts uesr keyboard input.
+ void editable(bool accept);
+
+ /// Determines whether the widget accepts user keyboard input.
+ bool editable() const;
+
+ /// Sets the numeric spin values and step.
+ void range(int begin, int last, int step);
+ void range(double begin, double last, double step);
+
+ /// Sets the string spin values.
+ void range(std::initializer_list values_utf8);
+ void range(std::initializer_list values);
+
+ /// Gets the spined value
+ ::nana::string value() const;
+ void value(const ::nana::string&);
+ int to_int() const;
+ double to_double() const;
+
+ /// Sets the modifiers
+ void modifier(std::wstring prefix, std::wstring suffix);
+ void modifier(const std::string & prefix_utf8, const std::string& suffix_utf8);
+ private:
+ ::nana::string _m_caption() const;
+ void _m_caption(::nana::string&&);
+ }; //end class spinbox
+
+ namespace dev
+ {
+ template<>
+ struct widget_traits
+ {
+ using event_type = drawerbase::spinbox::spinbox_events;
+ using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
+ };
+ }
+}//end namespace nana
+
+#endif //NANA_GUI_WIDGET_SPINBOX_HPP
diff --git a/include/nana/gui/widgets/tabbar.hpp b/include/nana/gui/widgets/tabbar.hpp
index 3e265a55..4d641461 100644
--- a/include/nana/gui/widgets/tabbar.hpp
+++ b/include/nana/gui/widgets/tabbar.hpp
@@ -1,7 +1,7 @@
/*
* A Tabbar implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -24,9 +24,14 @@ namespace nana
template
struct arg_tabbar
+ : public event_arg
{
tabbar & widget;
T & value;
+
+ arg_tabbar(tabbar& wdg, T& v)
+ : widget{ wdg }, value{ v }
+ {}
};
template
@@ -57,7 +62,7 @@ namespace nana
class event_agent_interface
{
public:
- virtual ~event_agent_interface() = 0;
+ virtual ~event_agent_interface() = default;
virtual void added(std::size_t) = 0;
virtual void activated(std::size_t) = 0;
virtual bool removed(std::size_t) = 0;
@@ -67,18 +72,18 @@ namespace nana
{
public:
typedef item_renderer item_renderer_type;
- typedef nana::paint::graphics & graph_reference;
+ typedef ::nana::paint::graphics & graph_reference;
enum state_t{disable, normal, highlight, press};
struct item_t
{
- nana::rectangle r;
- nana::color_t bgcolor;
- nana::color_t fgcolor;
+ ::nana::rectangle r;
+ ::nana::color bgcolor;
+ ::nana::color fgcolor;
};
- virtual ~item_renderer() = 0;
- virtual void background(graph_reference, const nana::rectangle& r, nana::color_t bgcolor) = 0;
+ virtual ~item_renderer() = default;
+ virtual void background(graph_reference, const nana::rectangle& r, const ::nana::color& bgcolor) = 0;
virtual void item(graph_reference, const item_t&, bool active, state_t) = 0;
virtual void close_fly(graph_reference, const nana::rectangle&, bool active, state_t) = 0;
@@ -150,7 +155,7 @@ namespace nana
std::size_t length() const;
bool close_fly(bool);
void relate(size_t, window);
- void tab_color(std::size_t, bool is_bgcolor, nana::color_t);
+ void tab_color(std::size_t, bool is_bgcolor, const ::nana::color&);
void tab_image(size_t, const nana::paint::image&);
void text(std::size_t, const nana::string&);
nana::string text(std::size_t) const;
@@ -278,14 +283,14 @@ namespace nana
this->get_drawer_trigger().relate(pos, wd);
}
- void tab_bgcolor(std::size_t i, nana::color_t color)
+ void tab_bgcolor(std::size_t i, const ::nana::color& clr)
{
- this->get_drawer_trigger().tab_color(i, true, color);
+ this->get_drawer_trigger().tab_color(i, true, clr);
}
- void tab_fgcolor(std::size_t i, nana::color_t color)
+ void tab_fgcolor(std::size_t i, const ::nana::color& clr)
{
- this->get_drawer_trigger().tab_color(i, false, color);
+ this->get_drawer_trigger().tab_color(i, false, clr);
}
void tab_image(std::size_t i, const nana::paint::image& img)
diff --git a/include/nana/gui/widgets/textbox.hpp b/include/nana/gui/widgets/textbox.hpp
index 11528b35..045a05fc 100644
--- a/include/nana/gui/widgets/textbox.hpp
+++ b/include/nana/gui/widgets/textbox.hpp
@@ -1,7 +1,7 @@
/*
* A Textbox Implementation
* Nana C++ Library(http://www.nanapro.org)
- * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+ * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,14 +13,18 @@
#define NANA_GUI_WIDGET_TEXTBOX_HPP
#include
#include "skeletons/textbase_export_interface.hpp"
+#include "skeletons/text_editor_scheme.hpp"
namespace nana
{
class textbox;
struct arg_textbox
+ : public event_arg
{
textbox& widget;
+
+ arg_textbox(textbox&);
};
namespace widgets
@@ -39,14 +43,16 @@ namespace nana
: public general_events
{
basic_event first_change;
+ basic_event text_changed;
};
class event_agent
: public widgets::skeletons::textbase_event_agent_interface
{
public:
- event_agent(::nana::textbox& wdg);
+ event_agent(::nana::textbox&);
void first_change() override;
+ void text_changed() override;
private:
::nana::textbox & widget_;
};
@@ -56,12 +62,11 @@ namespace nana
: public drawer_trigger
{
public:
- typedef widgets::skeletons::text_editor text_editor;
+ using text_editor = widgets::skeletons::text_editor;
drawer();
text_editor * editor();
const text_editor * editor() const;
- void set_accept(std::function