diff --git a/build/codeblocks/nana.cbp b/build/codeblocks/nana.cbp index b2a80a96..973b633f 100644 --- a/build/codeblocks/nana.cbp +++ b/build/codeblocks/nana.cbp @@ -69,6 +69,7 @@ + diff --git a/build/codeblocks/nana.layout b/build/codeblocks/nana.layout index f332844d..f410278c 100644 --- a/build/codeblocks/nana.layout +++ b/build/codeblocks/nana.layout @@ -1,76 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - @@ -81,11 +46,6 @@ - - - - - @@ -101,26 +61,21 @@ - - - - - - - - - - + + + + + @@ -136,6 +91,11 @@ + + + + + @@ -151,4 +111,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2013/nana.v12.suo b/build/vc2013/nana.v12.suo deleted file mode 100644 index 55c501ac..00000000 Binary files a/build/vc2013/nana.v12.suo and /dev/null differ diff --git a/build/vc2013/nana.vcxproj b/build/vc2013/nana.vcxproj index c5c19e78..89c4ae25 100644 --- a/build/vc2013/nana.vcxproj +++ b/build/vc2013/nana.vcxproj @@ -117,6 +117,7 @@ + diff --git a/build/vc2013/nana.vcxproj.filters b/build/vc2013/nana.vcxproj.filters index 5d2bb2ae..c4738ee4 100644 --- a/build/vc2013/nana.vcxproj.filters +++ b/build/vc2013/nana.vcxproj.filters @@ -294,5 +294,8 @@ Source Files\nana\gui\detail + + Source Files\nana\gui + \ No newline at end of file diff --git a/include/nana/basic_types.hpp b/include/nana/basic_types.hpp index 074da654..177baf4a 100644 --- a/include/nana/basic_types.hpp +++ b/include/nana/basic_types.hpp @@ -378,8 +378,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&); @@ -390,8 +391,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 diff --git a/include/nana/gui/detail/native_window_interface.hpp b/include/nana/gui/detail/native_window_interface.hpp index 6dc86b68..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&); diff --git a/include/nana/gui/programming_interface.hpp b/include/nana/gui/programming_interface.hpp index b55e4c40..9bcf2842 100644 --- a/include/nana/gui/programming_interface.hpp +++ b/include/nana/gui/programming_interface.hpp @@ -87,8 +87,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 diff --git a/include/nana/gui/wvl.hpp b/include/nana/gui/wvl.hpp index a69f350a..e9855208 100644 --- a/include/nana/gui/wvl.hpp +++ b/include/nana/gui/wvl.hpp @@ -1,6 +1,7 @@ /* * Nana GUI Library Definition - * 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 @@ -15,6 +16,7 @@ #define NANA_GUI_WVL_HPP #include "programming_interface.hpp" +#include "screen.hpp" #include "widgets/form.hpp" #include "drawing.hpp" #include "msgbox.hpp" diff --git a/source/basic_types.cpp b/source/basic_types.cpp index b2b17a42..c7c5cbd4 100644 --- a/source/basic_types.cpp +++ b/source/basic_types.cpp @@ -323,7 +323,7 @@ namespace nana //struct size size::size():width(0), height(0){} - size::size(unsigned width, unsigned height):width(width), height(height){} + size::size(value_type width, value_type height) : width(width), height(height){} size::size(const rectangle& r) : width(r.width), height(r.height) {} diff --git a/source/gui/detail/native_window_interface.cpp b/source/gui/detail/native_window_interface.cpp index 0e7a46bf..2a20fd78 100644 --- a/source/gui/detail/native_window_interface.cpp +++ b/source/gui/detail/native_window_interface.cpp @@ -146,7 +146,7 @@ namespace nana{ #endif //struct native_interface - nana::size native_interface::screen_size() + nana::size native_interface::primary_monitor_size() { #if defined(NANA_WINDOWS) return nana::size(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN)); @@ -176,13 +176,10 @@ namespace nana{ mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top); } } -#elif defined(NANA_X11) #endif - return screen_size(); + return primary_monitor_size(); } - - //platform-dependent native_interface::window_result native_interface::create_window(native_window_type owner, bool nested, const rectangle& r, const appearance& app) { diff --git a/source/gui/programming_interface.cpp b/source/gui/programming_interface.cpp index 797df632..286aafc1 100644 --- a/source/gui/programming_interface.cpp +++ b/source/gui/programming_interface.cpp @@ -307,16 +307,6 @@ namespace API restrict::window_manager.unregister_shortkey(reinterpret_cast(wd), false); } - nana::size screen_size() - { - return restrict::interface_type::screen_size(); - } - - rectangle screen_area_from_point(const point& pos) - { - return restrict::interface_type::screen_area_from_point(pos); - } - nana::point cursor_position() { return restrict::interface_type::cursor_position(); @@ -324,7 +314,7 @@ namespace API nana::rectangle make_center(unsigned width, unsigned height) { - nana::size screen = restrict::interface_type::screen_size(); + nana::size screen = restrict::interface_type::primary_monitor_size(); nana::rectangle result( width > screen.width? 0: (screen.width - width)>>1, height > screen.height? 0: (screen.height - height)>> 1, diff --git a/source/gui/tooltip.cpp b/source/gui/tooltip.cpp index 47ff28c3..02eae44d 100644 --- a/source/gui/tooltip.cpp +++ b/source/gui/tooltip.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace nana @@ -33,7 +34,7 @@ namespace nana nana::point pos_by_screen(nana::point pos, const nana::size& sz, bool overlap_allowed) { - auto scr_area = API::screen_area_from_point(pos); + auto scr_area = screen::from_point(pos)->area(); if (pos.x + sz.width > scr_area.x + scr_area.width) pos.x = static_cast(scr_area.x + scr_area.width - sz.width); if (pos.x < scr_area.x) @@ -76,7 +77,7 @@ namespace nana void tooltip_text(const nana::string& text) override { label_.caption(text); - auto text_s = label_.measure(API::screen_size().width * 2 / 3); + auto text_s = label_.measure(screen::from_window(label_)->area().width * 2 / 3); this->size(nana::size{ text_s.width + 10, text_s.height + 10 }); label_.move(rectangle{ 5, 5, text_s.width, text_s.height }); diff --git a/source/gui/widgets/menu.cpp b/source/gui/widgets/menu.cpp index ed7b72c5..02dfa28a 100644 --- a/source/gui/widgets/menu.cpp +++ b/source/gui/widgets/menu.cpp @@ -177,7 +177,7 @@ namespace nana menu_builder() { - root_.max_pixels = API::screen_size().width * 2 / 3; + root_.max_pixels = screen::primary_monitor_size().width * 2 / 3; root_.item_pixels = 24; renderer_ = pat::cloneable(internal_renderer()); } @@ -657,7 +657,7 @@ namespace nana API::calc_screen_point(*widget_, pos); //get the screen coordinates of the widget pos. - auto scr_area = API::screen_area_from_point(detail_.monitor_pos); + auto scr_area = screen::from_point(detail_.monitor_pos)->area(); if(pos.x + size.width > scr_area.x + scr_area.width) pos.x = static_cast(scr_area.x + scr_area.width - size.width);