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;
|
||||
}
|
||||
|
||||
nana::point window_position(window);
|
||||
point window_position(window);
|
||||
void move_window(window, int x, int y);
|
||||
void move_window(window wd, const rectangle&);
|
||||
|
||||
@ -203,9 +203,11 @@ namespace API
|
||||
void draw_through(window, std::function<void()>);
|
||||
void map_through_widgets(window, native_drawable_type);
|
||||
|
||||
nana::size window_size(window);
|
||||
size window_size(window);
|
||||
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.
|
||||
void window_enabled(window, bool);
|
||||
bool window_enabled(window);
|
||||
|
||||
@ -409,6 +409,16 @@ namespace nana
|
||||
{
|
||||
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:
|
||||
DrawerTrigger& get_drawer_trigger()
|
||||
{
|
||||
|
||||
@ -213,16 +213,6 @@ namespace nana{
|
||||
::RECT wd_area;
|
||||
::GetWindowRect(native_wd, &wd_area);
|
||||
|
||||
screen scr;
|
||||
auto & disp = scr.from_point({wd_area.left, wd_area.right});
|
||||
|
||||
if ((disp.area().width == r.width && disp.area().height == r.height) ||
|
||||
(disp.workarea().width == r.width && disp.workarea().height == r.height))
|
||||
{
|
||||
::MoveWindow(native_wd, r.x, r.y, r.width, r.height, true);
|
||||
}
|
||||
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
|
||||
@ -236,7 +226,6 @@ namespace nana{
|
||||
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);
|
||||
}
|
||||
|
||||
::GetClientRect(native_wd, &client);
|
||||
::GetWindowRect(native_wd, &wd_area);
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
/*
|
||||
* 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
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* @file: nana/gui/programming_interface.cpp
|
||||
* @author: Jinhao
|
||||
*/
|
||||
|
||||
#include <nana/gui/programming_interface.hpp>
|
||||
@ -598,7 +599,7 @@ namespace API
|
||||
nana::size window_size(window wd)
|
||||
{
|
||||
nana::rectangle r;
|
||||
API::window_rectangle(wd, r);
|
||||
API::get_window_rectangle(wd, r);
|
||||
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);
|
||||
internal_scope_guard lock;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user