Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial Dev dpi system -> do not merge #703

Open
wants to merge 155 commits into
base: develop-1.8
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
3bedcb4
dpi scale the original rectangle in native_interface::create_window b…
qPCR4vir May 2, 2024
8505cee
move dpi_debugging to <nana/config.hpp>
qPCR4vir May 2, 2024
41acac6
use less static_cast
qPCR4vir May 2, 2024
8e75193
return unscale to App scale from create_window
qPCR4vir May 3, 2024
ba4d02c
dpi scale create_child_window
qPCR4vir May 3, 2024
845afed
helper functions to scale to dpi
qPCR4vir May 3, 2024
cf06fe7
more helpers
qPCR4vir May 3, 2024
3da32fc
scale move_window
qPCR4vir May 3, 2024
f1425a5
debug
qPCR4vir May 3, 2024
f4f2bbd
screen_area_from_point return unscale_dpi rectangle
qPCR4vir May 3, 2024
429cf57
window_position return unscale_dpi(wd, pos.x, pos.y)
qPCR4vir May 3, 2024
2125faa
window_frame_extents return unscaled
qPCR4vir May 3, 2024
e0d71a4
get_window_rect return unscale_dpi
qPCR4vir May 3, 2024
5382760
move_window print caption
qPCR4vir May 3, 2024
15dc6dd
caret_create caret_sz scaled
qPCR4vir May 3, 2024
28cbcd5
caret_pos scale_to_dpi
qPCR4vir May 3, 2024
8306515
calc_screen_point scale_to_dpi
qPCR4vir May 3, 2024
1e9e033
calc_window_point unscale_dpi
qPCR4vir May 3, 2024
1f5f762
need unscaled? wd_manager().find_window(native_handle, pos)
qPCR4vir May 3, 2024
734c463
nana size helpers scale_to_dpi/unscale_dpi
qPCR4vir May 6, 2024
3f575c0
temporally move helpers scale_to_dpi/unscale_dpi to .hpp: todo implem…
qPCR4vir May 6, 2024
c45b331
graphics::set_dpi(int dpi)
qPCR4vir May 6, 2024
e5c0709
WM_DPICHANGED: wd_manager.update_dpi(msgwnd); todo: pass dpi = dpi_x…
qPCR4vir May 6, 2024
b915a65
use int dpi to avoid problematic unsigned
qPCR4vir May 7, 2024
aa2d123
todo dpi related tasks
qPCR4vir May 7, 2024
72f2f94
graphics.get_dpi() for internal scaling
qPCR4vir May 7, 2024
4df0675
font size take dpi for unscaling to user-side
qPCR4vir May 7, 2024
a439f83
add dpi_scale/unscale_dpi for various types
qPCR4vir May 7, 2024
a1adf0f
using platform_abstraction::dpi_scale
qPCR4vir May 7, 2024
4ce82b9
fix font size take int dpi
qPCR4vir May 7, 2024
f391d16
init platform_runtime dpi{ 96 }; not 0
qPCR4vir May 7, 2024
1503562
graphics::text_extent_size unscale_dpi
qPCR4vir May 7, 2024
f0175e8
graphics::glyph_pixels unscale_dpi
qPCR4vir May 7, 2024
2d5a31f
text_renderer.cpp uses unscaled user pos/size with graph_.text_extent…
qPCR4vir May 7, 2024
a36acee
graphics::bidi_extent_size unscale_dpi
qPCR4vir May 7, 2024
da5b7cd
graphics::text_metrics unscale_dpi
qPCR4vir May 7, 2024
493339f
graphics::line_begin dpi_scale
qPCR4vir May 7, 2024
d722608
graphics::bitblt dpi_scale
qPCR4vir May 7, 2024
079526f
graphics::bitblt dpi_scale r_dst (todo src?)
qPCR4vir May 8, 2024
79f7918
constexpr basic_types
qPCR4vir May 8, 2024
365fff1
graphics::size(), width and height unscale_dpi
qPCR4vir May 8, 2024
c2ded31
docs
qPCR4vir May 8, 2024
68da4b8
native_interface::cursor_screen_position()
qPCR4vir May 8, 2024
677cc3f
native_window_type find_cursor_window(nana::point& point);
qPCR4vir May 8, 2024
4774a68
native_interface::primary_monitor_size() review
qPCR4vir May 8, 2024
67e7384
docs
qPCR4vir May 10, 2024
1e2c813
combox reverse dpiScale
qPCR4vir May 10, 2024
098580d
docs
qPCR4vir May 10, 2024
363c18f
window find_window_cursor(::nana::point& pos) ///<Finds a window whic…
qPCR4vir May 11, 2024
6eea3ed
cache the dpi in basic_window
qPCR4vir May 11, 2024
f3c5c51
revert place_parts dpi val
qPCR4vir May 11, 2024
74305a0
use point in WM_MOVE
qPCR4vir May 11, 2024
d5dc912
platform_abstraction::unscale_dp use in graphics::set_dpi(int dpi)
qPCR4vir May 11, 2024
013cee0
fix ? return unscale_dpi (user-side) the size_pt of graph font
qPCR4vir May 11, 2024
517ff63
revert dpi scaling of menubar
qPCR4vir May 11, 2024
7ae9420
revert dpi scaling of menu
qPCR4vir May 11, 2024
c3f94d3
re-implement size window_size(wd) as wd->dimension;
qPCR4vir May 11, 2024
527b93f
use reimplemented api::find_window_cursor(pos) in menubar
qPCR4vir May 11, 2024
ad94e11
WM_MOUSEMOVE untransform_dpi pos from window
qPCR4vir May 11, 2024
37dd9c7
docs
qPCR4vir May 11, 2024
fa03d35
dpi_scale graphics::line
qPCR4vir May 11, 2024
a20ef99
docs
qPCR4vir May 11, 2024
13510c9
fix/implement bool transform_window_system_point_into_screen_sytem_po…
qPCR4vir May 11, 2024
70fa6e4
bedrock::flush_surface uses *update_area for direct call to PostMessa…
qPCR4vir May 11, 2024
48cdfb2
assign_arg(arg_mouse& arg untransform_dpi from system-side dpi to use…
qPCR4vir May 11, 2024
ac973e2
assign_arg(arg_wheel& arg untransform_dpi from system-side dpi to use…
qPCR4vir May 11, 2024
7902b0b
temp, reddef scale_to_dpi_ to avoid including windef.h in native_wind…
qPCR4vir May 12, 2024
a4f8527
reset MINMAXINFO pointed by lParam to the new values, system-side dpi
qPCR4vir May 12, 2024
d7140bb
docs
qPCR4vir May 12, 2024
2d4c571
WM_LBUTTONDBLCLK, WM_LBUTTONDOWN, WM_RBUTTONUP, WM_MOUSEMOVE untransf…
qPCR4vir May 12, 2024
975de74
docs
qPCR4vir May 13, 2024
27fe349
docs
qPCR4vir May 13, 2024
1081c4a
Merge branch 'develop-1.8' into dev_dpi_system
qPCR4vir May 13, 2024
4de2478
docs
qPCR4vir May 14, 2024
cde5566
basic_window take the dpi of owner or parent
qPCR4vir May 14, 2024
f25f423
graphics(size&, dpi = 96); take the dpi before setting the size
qPCR4vir May 14, 2024
6ff9c01
root_misc take a size
qPCR4vir May 14, 2024
c245d09
fix using size and dpi in result of window creation
qPCR4vir May 14, 2024
f829326
experimental -force graphics(size) to take a dpi too: but from where?
qPCR4vir May 15, 2024
be7e803
Merge branch 'develop-1.8' into dev_dpi_system
qPCR4vir May 15, 2024
7637cb6
api::window_dpi(window) return int
qPCR4vir May 15, 2024
5783a1e
docs
qPCR4vir May 16, 2024
4a37a3b
fix? window_manager::destroy(basic_window* wd) do not unscale_dpi(u…
qPCR4vir May 16, 2024
81fbfdc
basic_window constr get dpi = api::window_dpi(this) if not parent
qPCR4vir May 16, 2024
d0cbe42
fix graphics set sz and trick set dpi anyway ??
qPCR4vir May 16, 2024
b15bfa9
(not really) force explicit graphics(int dpi = 96);
qPCR4vir May 16, 2024
ff4ff0c
listbox force explicit graphics(int dpi = 96);
qPCR4vir May 16, 2024
4fa26c8
fix #include <nana/gui/programming_interface.hpp>
qPCR4vir May 16, 2024
601b6a4
docs
qPCR4vir May 17, 2024
e71505e
Merge branch 'develop-1.8' into dev_dpi_system
qPCR4vir May 17, 2024
eba052b
docs
qPCR4vir May 21, 2024
2b23202
fix no integer division
qPCR4vir May 21, 2024
ff4a154
basic_window constructor take dpi
qPCR4vir May 21, 2024
9f8e2c3
dpi_scale to System side dpi before ::BitBlt(
qPCR4vir May 21, 2024
647aeef
dpi_scale before rectangle draw
qPCR4vir May 21, 2024
3d8f8f0
dpi_scale before graphics::set_pixel
qPCR4vir May 21, 2024
5d75f3a
add dpi/scaling to screen & display: example screen.cpp is the first …
qPCR4vir May 21, 2024
dce08bc
Merge remote-tracking branch 'cnjinhao/develop-1.8' into dev_dpi_system
qPCR4vir May 21, 2024
2294b92
static_cast<long long>
qPCR4vir May 21, 2024
ff7f24e
more static_cast<long long> for gcc++13
qPCR4vir May 21, 2024
6b61d1e
fix returning temp
qPCR4vir May 21, 2024
bc742cf
use find_window_from_system_screen_point
qPCR4vir May 21, 2024
fd13205
find_window_from_system_screen_point(pos)
qPCR4vir May 21, 2024
c5d2efd
docs
qPCR4vir May 22, 2024
1745404
use named fields to initialize font_style{.italic=true};
qPCR4vir May 22, 2024
f6f031f
graphics(int dpi) : implementation{.dpi{dpi}, .scale{dpi/96.0f}})
qPCR4vir May 22, 2024
1dd8c9d
docs
qPCR4vir May 22, 2024
9e83616
re implement to int platform_abstraction::screen_dpi(bool x_requested…
qPCR4vir May 22, 2024
c0b6e42
init platform_runtime{.dpi{screen_dpi()}};
qPCR4vir May 22, 2024
2c30869
dpi scaling font and resizing in graphics
qPCR4vir May 22, 2024
0a2720d
fix ? graphics{nana::size{1, 1}, api::window_dpi(this)}
qPCR4vir May 23, 2024
4aecb54
fix
qPCR4vir May 23, 2024
12b573e
fix passing dpi to glass_buffer and construction order warning
qPCR4vir May 23, 2024
e0cb039
fix order warning
qPCR4vir May 23, 2024
a943ba0
fix use api
qPCR4vir May 23, 2024
2560505
fix use api::find_window_cursor
qPCR4vir May 23, 2024
c3429e5
fix take native_window_type
qPCR4vir May 23, 2024
79154fa
fix use native_interface
qPCR4vir May 23, 2024
a6cc214
fix use native_interface::find_cursor_window
qPCR4vir May 23, 2024
b60382a
fix use point
qPCR4vir May 23, 2024
eada26f
fix warning maybe_unused
qPCR4vir May 23, 2024
41715ec
use platform_abstraction::dpi_scale to include X11
qPCR4vir May 23, 2024
4ac9b01
fix use platform_abstraction::dpi_scale
qPCR4vir May 23, 2024
39a32c7
clean code
qPCR4vir May 23, 2024
cb94ac2
fix scaled_r & screen_system_point
qPCR4vir May 23, 2024
10b83eb
\todo use scheme
qPCR4vir May 23, 2024
2ec5295
static_cast<int>(menubar_size.height) & creation order warnings
qPCR4vir May 23, 2024
d068c81
make treebox_node_type a simple struct
qPCR4vir May 23, 2024
c1697bf
docs
qPCR4vir May 23, 2024
2d2fe4c
fix typo/bug
qPCR4vir May 23, 2024
3376052
fix bug ()
qPCR4vir May 23, 2024
4d6b9ae
fix already in user-side
qPCR4vir May 23, 2024
85592f9
dpi_scale graphics::blend, blur, paste, stretch, string, gradual_rect…
qPCR4vir May 23, 2024
0899565
fix string_view construction
qPCR4vir May 23, 2024
530de9c
fix use of treebox_node_type
qPCR4vir May 23, 2024
b71b30f
fix conversions
qPCR4vir May 23, 2024
b96e86f
dev_dpi_system use nana-demo dev_dpi_system
qPCR4vir May 23, 2024
b8b38b5
# include <windef.h> for MinGW gcc++13
qPCR4vir May 23, 2024
f3fa4a6
exclude windef due to complex configurations problems
qPCR4vir May 24, 2024
57ba6b4
paste dpi dpi_scale to dst
qPCR4vir May 24, 2024
8a7d9c9
docs
qPCR4vir May 24, 2024
baf7dbc
WM_DPICHANGED: wd_manager.refresh_tree(msgwnd);
qPCR4vir May 24, 2024
319039c
docs
qPCR4vir May 26, 2024
c0e731e
docs
qPCR4vir May 26, 2024
0887ecc
drawer(int dpi = 96);
qPCR4vir May 26, 2024
429c1c8
init dpi in cntpart_ graph
qPCR4vir May 26, 2024
7f2192e
init dpi in content_extent temp_graph
qPCR4vir May 26, 2024
97ffed3
init dpi in label::measure graphics substitute
qPCR4vir May 26, 2024
a4f55ae
restore GUI testing
qPCR4vir May 26, 2024
37f70e5
use def api::screen_dpi() instead of 96 & avoid copy old graphics??
qPCR4vir May 26, 2024
043ba2c
untransform_dpi rect before send to pixbuf
qPCR4vir May 26, 2024
960dc9b
docs
qPCR4vir May 26, 2024
ccaca80
avoid a SysFunct call
qPCR4vir May 27, 2024
91f6329
'fix' warnings
qPCR4vir Jun 5, 2024
a9398c1
Merge remote-tracking branch 'cnjinhao/develop-1.8' into dev_dpi_system
qPCR4vir Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4
# we are in /home/runner/work/nana/nana
- run: git clone --depth=1 --branch=develop https://github.com/qPCR4vir/nana-demo.git nana-demo
- run: git clone --depth=1 --branch=dev_dpi_system https://github.com/qPCR4vir/nana-demo.git nana-demo
working-directory: ../
- run: mkdir nana-demo-build
working-directory: ../
Expand Down
10 changes: 5 additions & 5 deletions include/nana/basic_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace nana
{
/// A constant value for the invalid position.
const std::size_t npos = static_cast<std::size_t>(-1);
constexpr std::size_t npos = static_cast<std::size_t>(-1);


template<typename CharT>
Expand All @@ -30,17 +30,17 @@ namespace nana
{
typedef CharT char_type;

static bool eq(char_type c1, char_type c2) noexcept
static constexpr bool eq(char_type c1, char_type c2) noexcept
{
return std::toupper(c1) == std::toupper(c2);
}

static bool lt(char_type c1, char_type c2) noexcept
static constexpr bool lt(char_type c1, char_type c2) noexcept
{
return std::toupper(c1) < std::toupper(c2);
}

static int compare(const char_type* s1, const char_type* s2, std::size_t n)
static constexpr int compare(const char_type* s1, const char_type* s2, std::size_t n)
{
while(n--)
{
Expand All @@ -54,7 +54,7 @@ namespace nana
return 0;
}

static const char_type* find(const char_type* s, std::size_t n, const char_type& a)
static constexpr const char_type* find(const char_type* s, std::size_t n, const char_type& a)
{
auto ua = std::toupper(a);
const char_type * end = s + n;
Expand Down
6 changes: 3 additions & 3 deletions include/nana/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@


#ifndef NANA_dpi_aware // uncomment your option: true to try experimental DPI aware nana
#define NANA_dpi_aware false
//#define NANA_dpi_aware true
//#define NANA_dpi_aware false
#define NANA_dpi_aware true
#endif // NANA_dpi_aware
inline bool config_dpi_aware = NANA_dpi_aware;

/// \todo: replace by #ifdef DPI_DEBUGGING or just fully eliminate
static constexpr bool dpi_debugging = false; ///< set to true to print DPI relates values for debugging
static constexpr bool dpi_debugging = true; ///< set to true to print DPI relates values for debugging

#include "c++defines.hpp"

Expand Down
4 changes: 2 additions & 2 deletions include/nana/deploy.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**
* The Deploy Implementation
* Nana C++ Library(https://nana.acemind.cn)
* Copyright(C) 2003-2020 Jinhao([email protected])
Expand All @@ -7,7 +7,7 @@
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/deploy.hpp
* @file nana/deploy.hpp
*
* What follows is dependent on what defined in nana/config.hpp
*/
Expand Down
18 changes: 9 additions & 9 deletions include/nana/gui/basis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ namespace nana
{
enum class flags
{
super,
widget = 0x1,
lite_widget = 0x3,
root = 0x5
super, // 000
widget = 0x1, // 001
lite_widget = 0x3, // 011
root = 0x5 // 101
};
//wait for constexpr
struct widget_tag{ static const flags value = flags::widget; };
struct widget_tag { static const flags value = flags::widget; };
struct lite_widget_tag : public widget_tag{ static const flags value = flags::lite_widget; };
struct root_tag : public widget_tag{ static const flags value = flags::root; };
struct root_tag : public widget_tag{ static const flags value = flags::root; };
}// end namespace category

using window = detail::basic_window*; ///< The window handle type representing nana window objects
using window = detail::basic_window*; ///< The window handle type representing nana window objects
using native_window_type = detail::native_window_handle_impl*; ///< The native window handle type representing system native windows. E.g, HWND in windows, Window in X11

using event_handle = detail::event_handle_impl*; ///< The event handle type representing nana window events
using native_drawable_type = detail::native_drawable_impl*; ///< The drawable handle type representing system native drawable objects. E.g. HDC in windows, Drawable in X11
using event_handle = detail::event_handle_impl*; ///< The event handle type representing nana window events
using native_drawable_type = detail::native_drawable_impl*; ///< The drawable handle type representing system native drawable objects. E.g. HDC in windows, Drawable in X11


struct keyboard
Expand Down
7 changes: 4 additions & 3 deletions include/nana/gui/detail/bedrock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#ifndef NANA_GUI_DETAIL_BEDROCK_HPP
#define NANA_GUI_DETAIL_BEDROCK_HPP

#include "general_events.hpp"
#include "color_schemes.hpp"
#include "virtual_keyboard.hpp"
Expand All @@ -28,7 +29,7 @@ namespace nana::detail

struct window_platform_assoc;

/// @brief fundamental core component, it provides an abstraction to the OS platform and some basic functions.
/// fundamental core component, it provides an abstraction to the OS platform and some basic functions.
class bedrock
{
bedrock();
Expand Down Expand Up @@ -67,7 +68,7 @@ namespace nana::detail

void set_menubar_taken(basic_window*);

//Delay Restores focus when a menu which attached to menubar is closed
/// Delay Restores focus when a menu which attached to menubar is closed
void delay_restore(int);
bool close_menu_if_focus_other_window(native_window_type focus);
void set_menu(native_window_type menu_window, bool is_keyboard_condition);
Expand Down Expand Up @@ -111,7 +112,7 @@ namespace nana::detail

void manage_form_loader(basic_window*, bool insert_or_remove);
public:
// if 'bForce__EmitInternal', then ONLY internal (widget's) events are processed (even through explicit filtering)
/// if 'bForce__EmitInternal', then ONLY internal (widget's) events are processed (even through explicit filtering)
bool emit(event_code, basic_window*, const event_arg&, bool ask_update, thread_context*, const bool bForce__EmitInternal = false);
private:
void _m_emit_core(event_code, basic_window*, bool draw_only, const event_arg&, const bool bForce__EmitInternal);
Expand Down
4 changes: 2 additions & 2 deletions include/nana/gui/detail/drawer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace nana
not_overridden
};
public:
drawer();
drawer(int dpi = 96);
~drawer();

void bind(basic_window*);
Expand Down Expand Up @@ -195,7 +195,7 @@ namespace nana
}
}
public:
nana::paint::graphics graphics;
nana::paint::graphics graphics; ///< The graphics object for drawing \todo: set dpi
private:
struct data_implement;

Expand Down
2 changes: 1 addition & 1 deletion include/nana/gui/detail/general_events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ namespace nana
{
event_code evt_code; ///< what kind of mouse event?
::nana::window window_handle; ///< A handle to the event window
::nana::point pos; ///< cursor position in the event window
::nana::point pos; ///< cursor position in the event window, dpi user-side coordinate
::nana::mouse button; ///< indicates a button which triggers the event

bool left_button; ///< true if mouse left button is pressed
Expand Down
132 changes: 84 additions & 48 deletions include/nana/gui/detail/native_window_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,59 @@
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file nana/gui/detail/native_window_interface.hpp
* @contributors Jinhao, Ariel Vina-Rodriguez
*/

#ifndef NANA_GUI_DETAIL_NATIVE_WINDOW_INTERFACE_HPP
#define NANA_GUI_DETAIL_NATIVE_WINDOW_INTERFACE_HPP

#include <functional>
#include <iostream>

#include "../basis.hpp"
#include <nana/paint/image.hpp>

//#if defined(NANA_WINDOWS)
//#include <windef.h>
//#endif

namespace nana
{
namespace detail
{
#if defined(NANA_WINDOWS)
nana::point scale_to_dpi(int x, int y, int dpi);
nana::point scale_to_dpi(native_window_type wd, int x, int y);
nana::point unscale_dpi(native_window_type wd, int x, int y);

// create helper function to scale nana::rectangle to dpi
nana::rectangle scale_to_dpi(const nana::rectangle& r, int dpi);
nana::rectangle scale_to_dpi(native_window_type wd, const nana::rectangle& r);
nana::rectangle unscale_dpi(const nana::rectangle& r, int dpi);

// create helper function to scale ::RECT to dpi
//::RECT scale_to_dpi(const ::RECT& r, int dpi);
//::RECT scale_to_dpi(native_window_type wd, const ::RECT& r);
//::RECT unscale_dpi(const ::RECT& r, int dpi);

nana::size scale_to_dpi(const nana::size& sz, int dpi);
nana::size scale_to_dpi(native_window_type wd, const nana::size& sz);
nana::size unscale_dpi(const nana::size& sz, int dpi);
nana::size unscale_dpi(native_window_type wd, const nana::size& sz);
#endif

struct native_interface
{
struct window_result
{
native_window_type native_handle;

unsigned width; ///< client size
unsigned height; ///< client size
size client_size; ///< client size

unsigned extra_width; ///< 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

int owner_dpi, dpi; ///< owner_dpi is the DPI of the owner window, dpi is the DPI of the window
};

struct frame_extents
Expand All @@ -47,65 +74,74 @@ namespace detail
using native_string_type = ::nana::detail::native_string_type;

/// Invokes a function in the thread of the specified window.
static void affinity_execute(native_window_type, bool post, std::function<void()>&&);
static void affinity_execute(native_window_type native_handle, bool post, std::function<void()>&& fn);

static nana::size primary_monitor_size(); ///< already 'DPI' scaled size
/// \todo: generalize dpi to v2 awareness
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&);
static nana::size primary_monitor_size(); ///< return 'DPI' unscaled size (user-side)
static rectangle screen_area_from_system_point(const point& system_point); ///< unused ?

static window_result create_window(native_window_type owner, bool nested, const rectangle& r, const appearance& ap);
static native_window_type create_child_window(native_window_type owner, const rectangle& r); ///< unused ?

#if defined(NANA_X11)
static void set_modal(native_window_type);
#endif
static void enable_dropfiles(native_window_type, bool);
static void enable_window(native_window_type, bool);
// (On Windows) The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.
static bool window_icon(native_window_type, const paint::image& big_icon, const paint::image& small_icon);
static void activate_owner(native_window_type);
static void activate_window(native_window_type);
static void close_window(native_window_type);
static void show_window(native_window_type, bool show, bool active);
static void restore_window(native_window_type);
static void zoom_window(native_window_type, bool ask_for_max);
static void refresh_window(native_window_type);
static bool is_window(native_window_type);
static bool is_window_visible(native_window_type);
static bool is_window_zoomed(native_window_type, bool ask_for_max);

static nana::point window_position(native_window_type);
static void move_window(native_window_type, int x, int y);
static bool move_window(native_window_type, const rectangle&);
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 frame_extents window_frame_extents(native_window_type);
static bool window_size(native_window_type, const size&);
static void get_window_rect(native_window_type, rectangle&);
static void window_caption(native_window_type, const native_string_type&);
static native_string_type window_caption(native_window_type);
static void capture_window(native_window_type, bool);
static nana::point cursor_position();

static native_window_type get_window(native_window_type wd, window_relationship);
static void enable_dropfiles(native_window_type wd, bool enable);
static void enable_window (native_window_type wd, bool enable);

/// (On Windows) The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.
static bool window_icon(native_window_type wd, const paint::image& big_icon, const paint::image& small_icon);
static void activate_owner (native_window_type wd);
static void activate_window(native_window_type wd);
static void close_window (native_window_type wd); ///< close the window, destroy the window
static void show_window (native_window_type wd, bool show, bool active);
static void restore_window (native_window_type wd);
static void zoom_window (native_window_type wd, bool ask_for_max);
static void refresh_window (native_window_type wd);
static bool is_window (native_window_type wd);
static bool is_window_visible(native_window_type wd);
static bool is_window_zoomed(native_window_type wd, bool ask_for_max);

static nana::point window_position(native_window_type wd); ///< return 'DPI' unscaled size (user-side)
static void move_window (native_window_type wd, int x, int y);
static bool move_window (native_window_type wd, const rectangle&);
static void bring_top (native_window_type wd, bool activated);
static void set_window_z_order(native_window_type wd, native_window_type wd_after, z_order_action action_if_no_wd_after);

static frame_extents window_frame_extents(native_window_type wd);
static bool window_size (native_window_type wd, const size& new_size); ///< change to new_size if possible
static void get_window_rect(native_window_type wd, rectangle& r); ///< unused ?
static void window_caption (native_window_type wd, const native_string_type& title);
static native_string_type window_caption(native_window_type wd);
static void capture_window (native_window_type wd, bool capture);
static nana::point cursor_sytem_position (); ///< return system point, scaled system-side
static nana::point cursor_screen_position(); ///< return unscaled point (user-side) for whole screen
static nana::point cursor_window_position(native_window_type wd); ///< return unscaled point (user-side) for wd

static native_window_type get_window (native_window_type wd, window_relationship);
static native_window_type parent_window(native_window_type child, native_window_type new_parent, bool returns_previous);

//For Caret
static void caret_create(native_window_type, const ::nana::size&);
static void caret_destroy(native_window_type);
static void caret_pos(native_window_type, const ::nana::point&);
static void caret_visible(native_window_type, bool);
static void caret_create (native_window_type wd, const ::nana::size&);
static void caret_destroy (native_window_type wd);
static void caret_pos (native_window_type wd, const ::nana::point&);
static void caret_visible (native_window_type wd, bool);

static void set_focus(native_window_type);
static void set_focus (native_window_type wd);
static native_window_type get_focus_window();
static bool calc_screen_point(native_window_type, nana::point&);
static bool calc_window_point(native_window_type, nana::point&);
static bool calc_screen_point(native_window_type wd, nana::point& window_point); ///< from client, user-side
static bool calc_window_point(native_window_type wd, nana::point& screen_point); ///< to client, user-side
static bool transform_window_system_point_into_screen_sytem_point(native_window_type wd, nana::point& system_system_point); ///< from client, system-side
static bool transform_screen_system_point_into_window_sytem_point(native_window_type wd, nana::point& screen_system_point); ///< to client, system-side

static native_window_type find_window_from_system_screen_point(const nana::point& system_screen_point);
/// point will be the position of cursor the returned window, but if no window under cursor, the point will be on screen point
static native_window_type find_cursor_window(nana::point& point);

static native_window_type find_window(int x, int y);
static nana::size check_track_size(nana::size sz, unsigned extra_width, unsigned extra_height, bool true_for_max);

static void start_dpi_awareness(bool aware = false);
static std::size_t window_dpi(native_window_type); ///< if the window is not DPI aware return the system DPI
static std::size_t system_dpi(); ///< get the DPI of the main monitor
static int window_dpi(native_window_type, bool x_requested = true); ///< if the window is not DPI aware return the system DPI (usually x_dpi = y_dpi)
static int system_dpi(bool x_requested = true); ///< get the DPI of the main monitor (usually x_dpi = y_dpi)
};


Expand Down
18 changes: 8 additions & 10 deletions include/nana/gui/detail/window_layout.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
/**
* Window Layout Implementation
* Copyright(C) 2003-2017 Jinhao([email protected])
*
* 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/detail/window_layout.hpp
* @file nana/gui/detail/window_layout.hpp
*
*/

Expand Down Expand Up @@ -53,20 +53,18 @@ namespace detail

static void paste_children_to_graphics(basic_window*, nana::paint::graphics& graph);

//read_visual_rectangle
//@brief: Reads the visual rectangle of a window, the visual rectangle's reference frame is to root widget,
// the visual rectangle is a rectangular block that a window should be displayed on screen.
// The result is a rectangle that is a visible area for its ancesters.
///read_visual_rectangle
///@brief: Reads the visual rectangle of a window, the visual rectangle's reference frame is to root widget,
/// the visual rectangle is a rectangular block that a window should be displayed on screen.
/// The result is a rectangle that is a visible area for its ancesters.
static bool read_visual_rectangle(basic_window*, nana::rectangle& visual);

//read_overlaps
// reads the overlaps that are overlapped a rectangular block
/// reads the overlaps that are overlapped a rectangular block
static bool read_overlaps(basic_window*, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks);

static bool enable_effects_bground(basic_window *, bool enabled);

//make_bground
// update the glass buffer of a glass window.
/// update the glass buffer of a glass window.
static void make_bground(basic_window* const);
private:

Expand Down
Loading
Loading