multiple display monitors support
Added a new class screen
This commit is contained in:
parent
aa12254844
commit
b827e0aa82
@ -69,6 +69,7 @@
|
|||||||
<Unit filename="../../source/gui/notifier.cpp" />
|
<Unit filename="../../source/gui/notifier.cpp" />
|
||||||
<Unit filename="../../source/gui/place.cpp" />
|
<Unit filename="../../source/gui/place.cpp" />
|
||||||
<Unit filename="../../source/gui/programming_interface.cpp" />
|
<Unit filename="../../source/gui/programming_interface.cpp" />
|
||||||
|
<Unit filename="../../source/gui/screen.cpp" />
|
||||||
<Unit filename="../../source/gui/state_cursor.cpp" />
|
<Unit filename="../../source/gui/state_cursor.cpp" />
|
||||||
<Unit filename="../../source/gui/timer.cpp" />
|
<Unit filename="../../source/gui/timer.cpp" />
|
||||||
<Unit filename="../../source/gui/tooltip.cpp" />
|
<Unit filename="../../source/gui/tooltip.cpp" />
|
||||||
|
|||||||
@ -1,76 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<CodeBlocks_layout_file>
|
<CodeBlocks_layout_file>
|
||||||
<ActiveTarget name="Debug" />
|
<ActiveTarget name="Debug" />
|
||||||
<File name="..\..\source\gui\detail\native_window_interface.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="4901" topLine="171" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\widgets\listbox.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="12428" topLine="532" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\detail\window_layout.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="5198" topLine="161" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\widgets\menu.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="27717" topLine="1044" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\detail\window_manager.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="30124" topLine="1046" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\dragger.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="1316" topLine="59" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\audio\detail\audio_device.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="6256" topLine="215" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\paint\image.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="3714" topLine="168" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\audio\detail\buffer_preparation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="1924" topLine="62" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\element.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\element.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="20890" topLine="542" />
|
<Cursor1 position="20890" topLine="542" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="18615" topLine="760" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\filebox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\filebox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="22934" topLine="871" />
|
<Cursor1 position="22934" topLine="871" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
|
<File name="..\..\source\audio\detail\buffer_preparation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="1924" topLine="62" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\msgbox.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="48249" topLine="407" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="18615" topLine="760" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\audio\detail\audio_device.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="6256" topLine="215" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
<File name="..\..\source\gui\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="11188" topLine="459" />
|
<Cursor1 position="11188" topLine="459" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="..\..\source\paint\text_renderer.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="5894" topLine="205" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\charset.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\charset.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="412" topLine="15" />
|
<Cursor1 position="412" topLine="15" />
|
||||||
@ -81,11 +46,6 @@
|
|||||||
<Cursor1 position="2244" topLine="84" />
|
<Cursor1 position="2244" topLine="84" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="..\..\source\gui\msgbox.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="48249" topLine="407" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\widgets\treebox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\widgets\treebox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="15535" topLine="539" />
|
<Cursor1 position="15535" topLine="539" />
|
||||||
@ -101,26 +61,21 @@
|
|||||||
<Cursor1 position="5022" topLine="159" />
|
<Cursor1 position="5022" topLine="159" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="..\..\source\threads\pool.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="5569" topLine="249" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\filesystem\fs_utility.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\filesystem\fs_utility.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="1562" topLine="57" />
|
<Cursor1 position="1562" topLine="57" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="..\..\source\gui\tooltip.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="4739" topLine="194" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="..\..\source\gui\animation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\animation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="1164" topLine="43" />
|
<Cursor1 position="1164" topLine="43" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
|
<File name="..\..\source\gui\tooltip.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="4739" topLine="194" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
<File name="..\..\source\gui\widgets\button.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\widgets\button.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="7080" topLine="291" />
|
<Cursor1 position="7080" topLine="291" />
|
||||||
@ -136,6 +91,11 @@
|
|||||||
<Cursor1 position="6160" topLine="196" />
|
<Cursor1 position="6160" topLine="196" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
|
<File name="..\..\source\paint\image.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="3714" topLine="168" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
<File name="..\..\source\gui\widgets\checkbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="..\..\source\gui\widgets\checkbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="6998" topLine="275" />
|
<Cursor1 position="6998" topLine="275" />
|
||||||
@ -151,4 +111,44 @@
|
|||||||
<Cursor1 position="457" topLine="3" />
|
<Cursor1 position="457" topLine="3" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
|
<File name="..\..\source\paint\text_renderer.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="5894" topLine="205" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\threads\pool.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="5569" topLine="249" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\detail\native_window_interface.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="4901" topLine="171" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\detail\window_layout.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="5198" topLine="161" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\widgets\listbox.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="12428" topLine="532" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\detail\window_manager.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="30124" topLine="1046" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\widgets\menu.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="27717" topLine="1044" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="..\..\source\gui\dragger.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="1316" topLine="59" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
</CodeBlocks_layout_file>
|
</CodeBlocks_layout_file>
|
||||||
|
|||||||
Binary file not shown.
@ -117,6 +117,7 @@
|
|||||||
<ClCompile Include="..\..\source\gui\notifier.cpp" />
|
<ClCompile Include="..\..\source\gui\notifier.cpp" />
|
||||||
<ClCompile Include="..\..\source\gui\place.cpp" />
|
<ClCompile Include="..\..\source\gui\place.cpp" />
|
||||||
<ClCompile Include="..\..\source\gui\programming_interface.cpp" />
|
<ClCompile Include="..\..\source\gui\programming_interface.cpp" />
|
||||||
|
<ClCompile Include="..\..\source\gui\screen.cpp" />
|
||||||
<ClCompile Include="..\..\source\gui\state_cursor.cpp" />
|
<ClCompile Include="..\..\source\gui\state_cursor.cpp" />
|
||||||
<ClCompile Include="..\..\source\gui\timer.cpp" />
|
<ClCompile Include="..\..\source\gui\timer.cpp" />
|
||||||
<ClCompile Include="..\..\source\gui\tooltip.cpp" />
|
<ClCompile Include="..\..\source\gui\tooltip.cpp" />
|
||||||
|
|||||||
@ -294,5 +294,8 @@
|
|||||||
<ClCompile Include="..\..\source\gui\detail\color_schemes.cpp">
|
<ClCompile Include="..\..\source\gui\detail\color_schemes.cpp">
|
||||||
<Filter>Source Files\nana\gui\detail</Filter>
|
<Filter>Source Files\nana\gui\detail</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\source\gui\screen.cpp">
|
||||||
|
<Filter>Source Files\nana\gui</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -378,8 +378,9 @@ namespace nana
|
|||||||
|
|
||||||
struct size
|
struct size
|
||||||
{
|
{
|
||||||
|
using value_type = unsigned;
|
||||||
size();
|
size();
|
||||||
size(unsigned width, unsigned height);
|
size(value_type width, value_type height);
|
||||||
size(const rectangle&);
|
size(const rectangle&);
|
||||||
|
|
||||||
size& operator=(const rectangle&);
|
size& operator=(const rectangle&);
|
||||||
@ -390,8 +391,8 @@ namespace nana
|
|||||||
bool operator!=(const size& rhs) const;
|
bool operator!=(const size& rhs) const;
|
||||||
size operator+(const size&) const;
|
size operator+(const size&) const;
|
||||||
|
|
||||||
unsigned width;
|
value_type width;
|
||||||
unsigned height;
|
value_type height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rectangle
|
struct rectangle
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Platform Implementation
|
* 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.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (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
|
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 rectangle screen_area_from_point(const point&);
|
||||||
static window_result create_window(native_window_type, bool nested, const rectangle&, const appearance&);
|
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&);
|
static native_window_type create_child_window(native_window_type, const rectangle&);
|
||||||
|
|||||||
@ -87,8 +87,6 @@ namespace API
|
|||||||
bool register_shortkey(window, unsigned long);
|
bool register_shortkey(window, unsigned long);
|
||||||
void unregister_shortkey(window);
|
void unregister_shortkey(window);
|
||||||
|
|
||||||
nana::size screen_size();
|
|
||||||
rectangle screen_area_from_point(const point&);
|
|
||||||
nana::point cursor_position();
|
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(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
|
rectangle make_center(window, unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the window
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nana GUI Library Definition
|
* 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.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -15,6 +16,7 @@
|
|||||||
#define NANA_GUI_WVL_HPP
|
#define NANA_GUI_WVL_HPP
|
||||||
|
|
||||||
#include "programming_interface.hpp"
|
#include "programming_interface.hpp"
|
||||||
|
#include "screen.hpp"
|
||||||
#include "widgets/form.hpp"
|
#include "widgets/form.hpp"
|
||||||
#include "drawing.hpp"
|
#include "drawing.hpp"
|
||||||
#include "msgbox.hpp"
|
#include "msgbox.hpp"
|
||||||
|
|||||||
@ -323,7 +323,7 @@ namespace nana
|
|||||||
|
|
||||||
//struct size
|
//struct size
|
||||||
size::size():width(0), height(0){}
|
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)
|
size::size(const rectangle& r)
|
||||||
: width(r.width), height(r.height)
|
: width(r.width), height(r.height)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -146,7 +146,7 @@ namespace nana{
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//struct native_interface
|
//struct native_interface
|
||||||
nana::size native_interface::screen_size()
|
nana::size native_interface::primary_monitor_size()
|
||||||
{
|
{
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
return nana::size(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
|
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);
|
mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(NANA_X11)
|
|
||||||
#endif
|
#endif
|
||||||
return screen_size();
|
return primary_monitor_size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//platform-dependent
|
//platform-dependent
|
||||||
native_interface::window_result native_interface::create_window(native_window_type owner, bool nested, const rectangle& r, const appearance& app)
|
native_interface::window_result native_interface::create_window(native_window_type owner, bool nested, const rectangle& r, const appearance& app)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -307,16 +307,6 @@ namespace API
|
|||||||
restrict::window_manager.unregister_shortkey(reinterpret_cast<restrict::core_window_t*>(wd), false);
|
restrict::window_manager.unregister_shortkey(reinterpret_cast<restrict::core_window_t*>(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()
|
nana::point cursor_position()
|
||||||
{
|
{
|
||||||
return restrict::interface_type::cursor_position();
|
return restrict::interface_type::cursor_position();
|
||||||
@ -324,7 +314,7 @@ namespace API
|
|||||||
|
|
||||||
nana::rectangle make_center(unsigned width, unsigned height)
|
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(
|
nana::rectangle result(
|
||||||
width > screen.width? 0: (screen.width - width)>>1,
|
width > screen.width? 0: (screen.width - width)>>1,
|
||||||
height > screen.height? 0: (screen.height - height)>> 1,
|
height > screen.height? 0: (screen.height - height)>> 1,
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#include <nana/gui/tooltip.hpp>
|
#include <nana/gui/tooltip.hpp>
|
||||||
#include <nana/gui/widgets/label.hpp>
|
#include <nana/gui/widgets/label.hpp>
|
||||||
#include <nana/gui/timer.hpp>
|
#include <nana/gui/timer.hpp>
|
||||||
|
#include <nana/gui/screen.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
@ -33,7 +34,7 @@ namespace nana
|
|||||||
|
|
||||||
nana::point pos_by_screen(nana::point pos, const nana::size& sz, bool overlap_allowed)
|
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)
|
if (pos.x + sz.width > scr_area.x + scr_area.width)
|
||||||
pos.x = static_cast<int>(scr_area.x + scr_area.width - sz.width);
|
pos.x = static_cast<int>(scr_area.x + scr_area.width - sz.width);
|
||||||
if (pos.x < scr_area.x)
|
if (pos.x < scr_area.x)
|
||||||
@ -76,7 +77,7 @@ namespace nana
|
|||||||
void tooltip_text(const nana::string& text) override
|
void tooltip_text(const nana::string& text) override
|
||||||
{
|
{
|
||||||
label_.caption(text);
|
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 });
|
this->size(nana::size{ text_s.width + 10, text_s.height + 10 });
|
||||||
label_.move(rectangle{ 5, 5, text_s.width, text_s.height });
|
label_.move(rectangle{ 5, 5, text_s.width, text_s.height });
|
||||||
|
|
||||||
|
|||||||
@ -177,7 +177,7 @@ namespace nana
|
|||||||
|
|
||||||
menu_builder()
|
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;
|
root_.item_pixels = 24;
|
||||||
renderer_ = pat::cloneable<renderer_interface>(internal_renderer());
|
renderer_ = pat::cloneable<renderer_interface>(internal_renderer());
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@ namespace nana
|
|||||||
API::calc_screen_point(*widget_, pos);
|
API::calc_screen_point(*widget_, pos);
|
||||||
|
|
||||||
//get the screen coordinates of the 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)
|
if(pos.x + size.width > scr_area.x + scr_area.width)
|
||||||
pos.x = static_cast<int>(scr_area.x + scr_area.width - size.width);
|
pos.x = static_cast<int>(scr_area.x + scr_area.width - size.width);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user