add new outline size
API::window_outline_size changes the window size(not client area size) for a native window
This commit is contained in:
parent
82ee570691
commit
58b206cb93
@ -193,7 +193,7 @@ namespace API
|
|||||||
return *comp_wdg_colors;
|
return *comp_wdg_colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
nana::point window_position(window);
|
point window_position(window);
|
||||||
void move_window(window, int x, int y);
|
void move_window(window, int x, int y);
|
||||||
void move_window(window wd, const rectangle&);
|
void move_window(window wd, const rectangle&);
|
||||||
|
|
||||||
@ -203,9 +203,11 @@ namespace API
|
|||||||
void draw_through(window, std::function<void()>);
|
void draw_through(window, std::function<void()>);
|
||||||
void map_through_widgets(window, native_drawable_type);
|
void map_through_widgets(window, native_drawable_type);
|
||||||
|
|
||||||
nana::size window_size(window);
|
size window_size(window);
|
||||||
void window_size(window, const size&);
|
void window_size(window, const size&);
|
||||||
bool window_rectangle(window, rectangle&);
|
size window_outline_size(window);
|
||||||
|
void window_outline_size(window, const size&);
|
||||||
|
bool get_window_rectangle(window, rectangle&);
|
||||||
bool track_window_size(window, const size&, bool true_for_max); ///< Sets the minimum or maximum tracking size of a window.
|
bool track_window_size(window, const size&, bool true_for_max); ///< Sets the minimum or maximum tracking size of a window.
|
||||||
void window_enabled(window, bool);
|
void window_enabled(window, bool);
|
||||||
bool window_enabled(window);
|
bool window_enabled(window);
|
||||||
|
|||||||
@ -409,6 +409,16 @@ namespace nana
|
|||||||
{
|
{
|
||||||
API::map_through_widgets(handle(), drawable);
|
API::map_through_widgets(handle(), drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void outline_size(const ::nana::size& sz)
|
||||||
|
{
|
||||||
|
API::window_outline_size(handle(), sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
::nana::size outline_size() const
|
||||||
|
{
|
||||||
|
return API::window_outline_size(handle());
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
DrawerTrigger& get_drawer_trigger()
|
DrawerTrigger& get_drawer_trigger()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -213,30 +213,19 @@ namespace nana{
|
|||||||
::RECT wd_area;
|
::RECT wd_area;
|
||||||
::GetWindowRect(native_wd, &wd_area);
|
::GetWindowRect(native_wd, &wd_area);
|
||||||
|
|
||||||
screen scr;
|
//a dimension with borders and caption title
|
||||||
auto & disp = scr.from_point({wd_area.left, wd_area.right});
|
wd_area.right -= wd_area.left; //wd_area.right = width
|
||||||
|
wd_area.bottom -= wd_area.top; //wd_area.bottom = height
|
||||||
if ((disp.area().width == r.width && disp.area().height == r.height) ||
|
if (nested)
|
||||||
(disp.workarea().width == r.width && disp.workarea().height == r.height))
|
|
||||||
{
|
{
|
||||||
::MoveWindow(native_wd, r.x, r.y, r.width, r.height, true);
|
wd_area.left = pt.x;
|
||||||
|
wd_area.top = pt.y;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//a dimension with borders and caption title
|
|
||||||
wd_area.right -= wd_area.left; //wd_area.right = width
|
|
||||||
wd_area.bottom -= wd_area.top; //wd_area.bottom = height
|
|
||||||
if (nested)
|
|
||||||
{
|
|
||||||
wd_area.left = pt.x;
|
|
||||||
wd_area.top = pt.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
int delta_w = static_cast<int>(r.width) - client.right;
|
int delta_w = static_cast<int>(r.width) - client.right;
|
||||||
int delta_h = static_cast<int>(r.height) - client.bottom;
|
int delta_h = static_cast<int>(r.height) - client.bottom;
|
||||||
|
|
||||||
::MoveWindow(native_wd, wd_area.left, wd_area.top, wd_area.right + delta_w, wd_area.bottom + delta_h, true);
|
::MoveWindow(native_wd, wd_area.left, wd_area.top, wd_area.right + delta_w, wd_area.bottom + delta_h, true);
|
||||||
}
|
|
||||||
|
|
||||||
::GetClientRect(native_wd, &client);
|
::GetClientRect(native_wd, &client);
|
||||||
::GetWindowRect(native_wd, &wd_area);
|
::GetWindowRect(native_wd, &wd_area);
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Nana GUI Programming Interface Implementation
|
* Nana GUI Programming Interface Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* 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.
|
* 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
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
*
|
||||||
* @file: nana/gui/programming_interface.cpp
|
* @file: nana/gui/programming_interface.cpp
|
||||||
|
* @author: Jinhao
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nana/gui/programming_interface.hpp>
|
#include <nana/gui/programming_interface.hpp>
|
||||||
@ -598,7 +599,7 @@ namespace API
|
|||||||
nana::size window_size(window wd)
|
nana::size window_size(window wd)
|
||||||
{
|
{
|
||||||
nana::rectangle r;
|
nana::rectangle r;
|
||||||
API::window_rectangle(wd, r);
|
API::get_window_rectangle(wd, r);
|
||||||
return{ r.width, r.height };
|
return{ r.width, r.height };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +619,46 @@ namespace API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool window_rectangle(window wd, rectangle& r)
|
::nana::size window_outline_size(window wd)
|
||||||
|
{
|
||||||
|
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
|
||||||
|
internal_scope_guard lock;
|
||||||
|
if (!restrict::window_manager.available(iwd))
|
||||||
|
return{};
|
||||||
|
|
||||||
|
auto sz = window_size(wd);
|
||||||
|
sz.width += iwd->extra_width;
|
||||||
|
sz.height += iwd->extra_height;
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_outline_size(window wd, const size& sz)
|
||||||
|
{
|
||||||
|
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
|
||||||
|
internal_scope_guard lock;
|
||||||
|
if (restrict::window_manager.available(iwd))
|
||||||
|
{
|
||||||
|
if (category::flags::root == iwd->other.category)
|
||||||
|
{
|
||||||
|
size inner_size = sz;
|
||||||
|
if (inner_size.width < iwd->extra_width)
|
||||||
|
inner_size.width = 0;
|
||||||
|
else
|
||||||
|
inner_size.width -= iwd->extra_width;
|
||||||
|
|
||||||
|
if (inner_size.height < iwd->extra_height)
|
||||||
|
inner_size.height = 0;
|
||||||
|
else
|
||||||
|
inner_size.height -= iwd->extra_height;
|
||||||
|
|
||||||
|
window_size(wd, inner_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
window_size(wd, sz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get_window_rectangle(window wd, rectangle& r)
|
||||||
{
|
{
|
||||||
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
|
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
|
||||||
internal_scope_guard lock;
|
internal_scope_guard lock;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user