some improvements

improved resizing performance
removed frame widget
refactoring
This commit is contained in:
Jinhao
2019-02-16 00:55:02 +08:00
parent bbc39906c0
commit e89ee5d18b
25 changed files with 307 additions and 521 deletions

View File

@@ -1,7 +1,7 @@
/*
* A Basic Window Widget Definition
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -216,40 +216,14 @@ namespace nana
basic_window::other_tag::other_tag(category::flags categ)
: category(categ), active_window(nullptr), upd_state(update_state::none)
{
#ifndef WIDGET_FRAME_DEPRECATED
switch(categ)
{
case category::flags::root:
attribute.root = new attr_root_tag;
break;
case category::flags::frame:
attribute.frame = new attr_frame_tag;
break;
default:
attribute.root = nullptr;
}
#else
if (category::flags::root == categ)
attribute.root = new attr_root_tag;
else
attribute.root = nullptr;
#endif
}
basic_window::other_tag::~other_tag()
{
#ifndef WIDGET_FRAME_DEPRECATED
switch(category)
{
case category::flags::root:
delete attribute.root;
break;
case category::flags::frame:
delete attribute.frame;
break;
default: break;
}
#endif
if (category::flags::root == category)
delete attribute.root;
}
@@ -290,14 +264,6 @@ namespace nana
}
}
#ifndef WIDGET_FRAME_DEPRECATED
void basic_window::frame_window(native_window_type wd)
{
if(category::flags::frame == this->other.category)
other.attribute.frame->container = wd;
}
#endif
bool basic_window::is_ancestor_of(const basic_window* wd) const
{
while (wd)
@@ -424,6 +390,7 @@ namespace nana
flags.ignore_menubar_focus = false;
flags.ignore_mouse_focus = false;
flags.space_click_enabled = false;
flags.ignore_child_mapping = false;
visible = false;

View File

@@ -1,7 +1,7 @@
/*
* A Bedrock Platform-Independent Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -11,7 +11,7 @@
*/
#include "../../detail/platform_spec_selector.hpp"
#include <nana/gui/detail/bedrock_pi_data.hpp>
#include "bedrock_types.hpp"
#include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp>
#include <sstream>
@@ -94,6 +94,12 @@ namespace nana
};
bedrock::core_window_t* bedrock::focus()
{
auto wd = wd_manager().root(native_interface::get_focus_window());
return (wd ? wd->other.attribute.root->focus : nullptr);
}
events_operation& bedrock::evt_operation()
{
return pi_data_->evt_operation;
@@ -164,17 +170,10 @@ namespace nana
caret_wd->annex.caret_ptr->visible(false);
}
if (!exposed)
if ((!exposed) && (category::flags::root != wd->other.category))
{
if (category::flags::root != wd->other.category)
{
//find an ancestor until it is not a lite_widget
wd = wd->seek_non_lite_widget_ancestor();
}
#ifndef WIDGET_FRAME_DEPRECATED
else if (category::flags::frame == wd->other.category)
wd = wd_manager().find_window(wd->root, wd->pos_root.x, wd->pos_root.y);
#endif
//find an ancestor until it is not a lite_widget
wd = wd->seek_non_lite_widget_ancestor();
}
wd_manager().refresh_tree(wd);
@@ -609,5 +608,93 @@ namespace nana
throw std::runtime_error("Invalid event code");
}
}
void bedrock::thread_context_destroy(core_window_t * wd)
{
auto ctx = get_thread_context(0);
if(ctx && ctx->event_window == wd)
ctx->event_window = nullptr;
}
void bedrock::thread_context_lazy_refresh()
{
auto ctx = get_thread_context(0);
if(ctx && ctx->event_window)
ctx->event_window->other.upd_state = core_window_t::update_state::refreshed;
}
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
{
if(wd_manager().available(wd) == false)
return false;
core_window_t * prev_wd = nullptr;
if(thrd)
{
prev_wd = thrd->event_window;
thrd->event_window = wd;
_m_event_filter(evt_code, wd, thrd);
}
using update_state = basic_window::update_state;
if (update_state::none == wd->other.upd_state)
wd->other.upd_state = update_state::lazy;
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
wd->flags.ignore_child_mapping = true;
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
wd->flags.ignore_child_mapping = ignore_mapping_value;
bool good_wd = false;
if(wd_manager().available(wd))
{
//A child of wd may not be drawn if it was out of wd's range before wd resized,
//so refresh all children of wd when a resized occurs.
if(ask_update || (event_code::resized == evt_code) || (update_state::refreshed == wd->other.upd_state))
{
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
}
else
{
wd_manager().map_requester(wd);
wd->other.upd_state = update_state::none;
}
good_wd = true;
}
if(thrd) thrd->event_window = prev_wd;
return good_wd;
}
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
{
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
switch(event_id)
{
case event_code::mouse_enter:
if (not_state_cur)
set_cursor(wd, wd->predef_cursor, thrd);
break;
case event_code::mouse_leave:
if (not_state_cur && (wd->predef_cursor != cursor::arrow))
set_cursor(wd, nana::cursor::arrow, thrd);
break;
case event_code::destroy:
if (wd->root_widget->other.attribute.root->state_cursor_window == wd)
undefine_state_cursor(wd, thrd);
if(wd == thrd->cursor.window)
set_cursor(wd, cursor::arrow, thrd);
break;
default:
break;
}
}
}//end namespace detail
}//end namespace nana

View File

@@ -1,7 +1,7 @@
/*
* A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,7 +12,6 @@
#include "../../detail/platform_spec_selector.hpp"
#if defined(NANA_POSIX) && defined(NANA_X11)
#include <nana/gui/detail/bedrock_pi_data.hpp>
#include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp>
#include <nana/gui/detail/native_window_interface.hpp>
@@ -22,6 +21,8 @@
#include <errno.h>
#include <algorithm>
#include "bedrock_types.hpp"
namespace nana
{
namespace detail
@@ -52,6 +53,7 @@ namespace detail
};
#pragma pack()
#if 0 //deprecated
struct bedrock::thread_context
{
unsigned event_pump_ref_count{0};
@@ -83,6 +85,7 @@ namespace detail
cursor.handle = 0;
}
};
#endif
struct bedrock::private_impl
{
@@ -247,12 +250,14 @@ namespace detail
return bedrock_object;
}
#if 0 //deprecated
bedrock::core_window_t* bedrock::focus()
{
core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
return (wd ? wd->other.attribute.root->focus : 0);
}
#endif
void bedrock::get_key_state(arg_keyboard& arg)
{
XKeyEvent xkey;
@@ -289,6 +294,7 @@ namespace detail
//No implementation for Linux
}
#if 0 //deprecated
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
{
if(wd_manager().available(wd) == false)
@@ -304,11 +310,16 @@ namespace detail
using update_state = basic_window::update_state;
if(wd->other.upd_state == update_state::none)
if (update_state::none == wd->other.upd_state)
wd->other.upd_state = update_state::lazy;
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
wd->flags.ignore_child_mapping = true;
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
wd->flags.ignore_child_mapping = ignore_mapping_value;
bool good_wd = false;
if(wd_manager().available(wd))
{
@@ -319,7 +330,10 @@ namespace detail
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
}
else
{
wd_manager().map_requester(wd);
wd->other.upd_state = update_state::none;
}
good_wd = true;
}
@@ -328,6 +342,7 @@ namespace detail
if(thrd) thrd->event_window = prev_wd;
return good_wd;
}
#endif
void assign_arg(arg_mouse& arg, basic_window* wd, unsigned msg, const XEvent& evt)
{
@@ -1346,6 +1361,7 @@ namespace detail
}//end bedrock::event_loop
#if 0 //deprecated
void bedrock::thread_context_destroy(core_window_t * wd)
{
bedrock::thread_context * thr = get_thread_context(0);
@@ -1359,6 +1375,7 @@ namespace detail
if(thrd && thrd->event_window)
thrd->event_window->other.upd_state = core_window_t::update_state::refreshed;
}
#endif
//Dynamically set a cursor for a window
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
@@ -1430,6 +1447,7 @@ namespace detail
set_cursor(rev_wd, rev_wd->predef_cursor, thrd);
}
#if 0 //deprecated
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
{
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
@@ -1455,6 +1473,7 @@ namespace detail
break;
}
}
#endif
}//end namespace detail
}//end namespace nana
#endif //NANA_POSIX && NANA_X11

View File

@@ -0,0 +1,101 @@
#ifndef NANA_GUI_DETAIL_BEDROCK_TYPES_INCLUDED
#define NANA_GUI_DETAIL_BEDROCK_TYPES_INCLUDED
#include <nana/push_ignore_diagnostic>
#include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/color_schemes.hpp>
#include <nana/gui/detail/events_operation.hpp>
#include <nana/gui/detail/window_manager.hpp>
#include <set>
namespace nana
{
namespace detail
{
struct bedrock::pi_data
{
color_schemes scheme;
events_operation evt_operation;
window_manager wd_manager;
std::set<core_window_t*> auto_form_set;
bool shortkey_occurred{ false };
struct menu_rep
{
core_window_t* taken_window{ nullptr };
bool delay_restore{ false };
native_window_type window{ nullptr };
native_window_type owner{ nullptr };
bool has_keyboard{ false };
}menu;
};
#ifdef NANA_WINDOWS
struct bedrock::thread_context
{
unsigned event_pump_ref_count{0};
int window_count{0}; //The number of windows
core_window_t* event_window{nullptr};
struct platform_detail_tag
{
wchar_t keychar;
}platform;
struct cursor_tag
{
core_window_t * window;
native_window_type native_handle;
nana::cursor predef_cursor;
HCURSOR handle;
}cursor;
thread_context()
{
cursor.window = nullptr;
cursor.native_handle = nullptr;
cursor.predef_cursor = nana::cursor::arrow;
cursor.handle = nullptr;
}
};
#else
struct bedrock::thread_context
{
unsigned event_pump_ref_count{0};
int window_count{0}; //The number of windows
core_window_t* event_window{nullptr};
bool is_alt_pressed{false};
bool is_ctrl_pressed{false};
struct platform_detail_tag
{
native_window_type motion_window;
nana::point motion_pointer_pos;
}platform;
struct cursor_tag
{
core_window_t * window;
native_window_type native_handle;
nana::cursor predef_cursor;
Cursor handle;
}cursor;
thread_context()
{
cursor.window = nullptr;
cursor.native_handle = nullptr;
cursor.predef_cursor = nana::cursor::arrow;
cursor.handle = 0;
}
};
#endif
}
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -1,7 +1,7 @@
/**
* A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -14,8 +14,8 @@
#include "../../detail/platform_spec_selector.hpp"
#if defined(NANA_WINDOWS)
#include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/bedrock_pi_data.hpp>
//#include <nana/gui/detail/bedrock.hpp> //deprecated
#include "bedrock_types.hpp"
#include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp>
#include <nana/system/timepiece.hpp>
@@ -36,6 +36,8 @@
#define WM_MOUSEHWHEEL 0x020E
#endif
#include "bedrock_types.hpp"
typedef void (CALLBACK *win_event_proc_t)(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
namespace nana
@@ -135,6 +137,7 @@ namespace detail
};
#pragma pack()
#if 0 //deprecated
struct bedrock::thread_context
{
unsigned event_pump_ref_count{0};
@@ -162,6 +165,7 @@ namespace detail
cursor.handle = nullptr;
}
};
#endif
struct bedrock::private_impl
{
@@ -1594,11 +1598,13 @@ namespace detail
return ::DefWindowProc(root_window, message, wParam, lParam);
}
#if 0 //deprecated
auto bedrock::focus() ->core_window_t*
{
core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
return (wd ? wd->other.attribute.root->focus : nullptr);
}
#endif
void bedrock::get_key_state(arg_keyboard& kb)
{
@@ -1677,6 +1683,7 @@ namespace detail
}
}
#if 0 //deprecated
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
{
if (wd_manager().available(wd) == false)
@@ -1695,16 +1702,27 @@ namespace detail
if (update_state::none == wd->other.upd_state)
wd->other.upd_state = update_state::lazy;
auto ignore_mapping_value = wd->flags.ignore_child_mapping;
wd->flags.ignore_child_mapping = true;
_m_emit_core(evt_code, wd, false, arg, bForce__EmitInternal);
wd->flags.ignore_child_mapping = ignore_mapping_value;
bool good_wd = false;
if (wd_manager().available(wd))
{
//Ignore ask_update if update state is refreshed.
if (ask_update || (update_state::refreshed == wd->other.upd_state))
wd_manager().do_lazy_refresh(wd, false);
//A child of wd may not be drawn if it was out of wd's range before wd resized,
//so refresh all children of wd when a resized occurs.
if(ask_update || (event_code::resized == evt_code) || (update_state::refreshed == wd->other.upd_state))
{
wd_manager().do_lazy_refresh(wd, false, (event_code::resized == evt_code));
}
else
{
wd_manager().map_requester(wd);
wd->other.upd_state = update_state::none;
}
good_wd = true;
}
@@ -1712,6 +1730,7 @@ namespace detail
if (thrd) thrd->event_window = prev_event_wd;
return good_wd;
}
#endif
const wchar_t* translate(cursor id)
{
@@ -1740,7 +1759,7 @@ namespace detail
}
return name;
}
#if 0 //deprecated
void bedrock::thread_context_destroy(core_window_t * wd)
{
auto * thr = get_thread_context(0);
@@ -1754,7 +1773,7 @@ namespace detail
if (thrd && thrd->event_window)
thrd->event_window->other.upd_state = core_window_t::update_state::refreshed;
}
#endif
//Dynamically set a cursor for a window
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
{
@@ -1847,7 +1866,7 @@ namespace detail
::ShowCursor(FALSE);
::SetCursor(rev_handle);
}
#if 0 //deprecated
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
{
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
@@ -1873,6 +1892,7 @@ namespace detail
break;
}
}
#endif
}//end namespace detail
}//end namespace nana
#endif //NANA_WINDOWS

View File

@@ -1,7 +1,7 @@
/*
* Window Layout Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -66,20 +66,9 @@ namespace nana
nana::point p_src;
for (auto & el : blocks)
{
#ifndef WIDGET_FRAME_DEPRECATED
if (category::flags::frame == el.window->other.category)
{
native_window_type container = el.window->other.attribute.frame->container;
native_interface::refresh_window(container);
graph.bitblt(el.r, container);
}
else
#endif
{
p_src.x = el.r.x - el.window->pos_root.x;
p_src.y = el.r.y - el.window->pos_root.y;
graph.bitblt(el.r, (el.window->drawer.graphics), p_src);
}
p_src.x = el.r.x - el.window->pos_root.x;
p_src.y = el.r.y - el.window->pos_root.y;
graph.bitblt(el.r, (el.window->drawer.graphics), p_src);
_m_paste_children(el.window, false, req_refresh_children, el.r, graph, nana::point{});
}

View File

@@ -1,7 +1,7 @@
/*
* Window Manager Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -513,12 +513,7 @@ namespace detail
if (owner->flags.destroying)
throw std::runtime_error("the specified owner is destoryed");
#ifndef WIDGET_FRAME_DEPRECATED
native = (category::flags::frame == owner->other.category ?
owner->other.attribute.frame->container : owner->root_widget->root);
#else
native = owner->root_widget->root;
#endif
r.x += owner->pos_root.x;
r.y += owner->pos_root.y;
}
@@ -550,11 +545,6 @@ namespace detail
wd->bind_native_window(result.native_handle, result.width, result.height, result.extra_width, result.extra_height, value->root_graph);
impl_->wd_register.insert(wd);
#ifndef WIDGET_FRAME_DEPRECATED
if (owner && (category::flags::frame == owner->other.category))
insert_frame(owner, wd);
#endif
bedrock::inc_window(wd->thread_id);
this->icon(wd, impl_->default_icon_small, impl_->default_icon_big);
return wd;
@@ -562,56 +552,6 @@ namespace detail
return nullptr;
}
#ifndef WIDGET_FRAME_DEPRECATED
window_manager::core_window_t* window_manager::create_frame(core_window_t* parent, const rectangle& r, widget* wdg)
{
//Thread-Safe Required!
std::lock_guard<mutex_type> lock(mutex_);
if (impl_->wd_register.available(parent) == false) return nullptr;
core_window_t * wd = new core_window_t(parent, widget_notifier_interface::get_notifier(wdg), r, (category::frame_tag**)nullptr);
wd->frame_window(native_interface::create_child_window(parent->root, rectangle(wd->pos_root.x, wd->pos_root.y, r.width, r.height)));
impl_->wd_register.insert(wd, wd->thread_id);
//Insert the frame_widget into its root frames container.
wd->root_widget->other.attribute.root->frames.push_back(wd);
return (wd);
}
bool window_manager::insert_frame(core_window_t* frame, native_window wd)
{
if(frame)
{
//Thread-Safe Required!
std::lock_guard<mutex_type> lock(mutex_);
if(category::flags::frame == frame->other.category)
frame->other.attribute.frame->attach.push_back(wd);
return true;
}
return false;
}
bool window_manager::insert_frame(core_window_t* frame, core_window_t* wd)
{
if(frame)
{
//Thread-Safe Required!
std::lock_guard<mutex_type> lock(mutex_);
if(category::flags::frame == frame->other.category)
{
if (impl_->wd_register.available(wd) && (category::flags::root == wd->other.category) && wd->root != frame->root)
{
frame->other.attribute.frame->attach.push_back(wd->root);
return true;
}
}
}
return false;
}
#endif
window_manager::core_window_t* window_manager::create_widget(core_window_t* parent, const rectangle& r, bool is_lite, widget* wdg)
{
//Thread-Safe Required!
@@ -706,11 +646,7 @@ namespace detail
std::lock_guard<mutex_type> lock(mutex_);
if (impl_->wd_register.available(wd) == false) return;
#ifndef WIDGET_FRAME_DEPRECATED
if((category::flags::root == wd->other.category) || (category::flags::frame != wd->other.category))
#else
if (category::flags::root == wd->other.category)
#endif
{
impl_->misc_register.erase(wd->root);
impl_->wd_register.remove(wd);
@@ -749,20 +685,7 @@ namespace detail
if(visible != wd->visible)
{
#ifndef WIDGET_FRAME_DEPRECATED
native_window_type nv = nullptr;
switch(wd->other.category)
{
case category::flags::root:
nv = wd->root; break;
case category::flags::frame:
nv = wd->other.attribute.frame->container; break;
default: //category::widget_tag, category::lite_widget_tag
break;
}
#else
auto nv = (category::flags::root == wd->other.category ? wd->root : nullptr);
#endif
if(visible && wd->effect.bground)
window_layer::make_bground(wd);
@@ -1012,22 +935,11 @@ namespace detail
return false;
}
}
#ifndef WIDGET_FRAME_DEPRECATED
else if(category::flags::frame == wd->other.category)
{
native_interface::window_size(wd->other.attribute.frame->container, sz);
for(auto natwd : wd->other.attribute.frame->attach)
native_interface::window_size(natwd, sz);
}
#endif
else
else if(wd->effect.bground && wd->parent)
{
//update the bground buffer of glass window.
if(wd->effect.bground && wd->parent)
{
wd->other.glass_buffer.make(sz);
window_layer::make_bground(wd);
}
wd->other.glass_buffer.make(sz);
window_layer::make_bground(wd);
}
}
@@ -1072,8 +984,19 @@ namespace detail
auto parent = wd->parent;
while (parent)
{
if (parent->flags.refreshing)
if(parent->flags.ignore_child_mapping || parent->flags.refreshing)
{
auto top = parent;
while(parent->parent)
{
parent = parent->parent;
if(parent->flags.ignore_child_mapping || parent->flags.refreshing)
top = parent;
}
top->other.mapping_requester.push_back(wd);
return;
}
parent = parent->parent;
}
@@ -1168,7 +1091,24 @@ namespace detail
window_layer::paint(wd, paint_operation::try_refresh, refresh_tree); //only refreshing if it has an invisible parent
}
wd->other.upd_state = core_window_t::update_state::none;
return;
wd->other.mapping_requester.clear();
}
void window_manager::map_requester(core_window_t* wd)
{
//Thread-Safe Required!
std::lock_guard<mutex_type> lock(mutex_);
if (false == impl_->wd_register.available(wd))
return;
if (wd->visible_parents())
{
for(auto requestor : wd->other.mapping_requester)
this->map(requestor, true);
}
wd->other.mapping_requester.clear();
}
//get_graphics
@@ -1758,17 +1698,6 @@ namespace detail
}
}
#ifndef WIDGET_FRAME_DEPRECATED
if (category::flags::frame == wd->other.category)
{
//remove the frame handle from the WM frames manager.
utl::erase(root_attr->frames, wd);
if (established)
pa_root_attr->frames.push_back(wd);
}
#endif
if (established)
{
wd->parent = for_new;
@@ -1857,18 +1786,6 @@ namespace detail
wd->drawer.detached();
wd->widget_notifier->destroy();
#ifndef WIDGET_FRAME_DEPRECATED
if(category::flags::frame == wd->other.category)
{
//The frame widget does not have an owner, and close their element windows without activating owner.
//close the frame container window, it's a native window.
for(auto i : wd->other.attribute.frame->attach)
native_interface::close_window(i);
native_interface::close_window(wd->other.attribute.frame->container);
}
#endif
if(wd->other.category != category::flags::root) //Not a root window
impl_->wd_register.remove(wd);
@@ -1881,18 +1798,9 @@ namespace detail
if(category::flags::root != wd->other.category) //A root widget always starts at (0, 0) and its childs are not to be changed
{
wd->pos_root += delta;
#ifndef WIDGET_FRAME_DEPRECATED
if (category::flags::frame != wd->other.category)
{
if (wd->annex.caret_ptr && wd->annex.caret_ptr->visible())
wd->annex.caret_ptr->update();
}
else
native_interface::move_window(wd->other.attribute.frame->container, wd->pos_root.x, wd->pos_root.y);
#else
if (wd->annex.caret_ptr && wd->annex.caret_ptr->visible())
wd->annex.caret_ptr->update();
#endif
if (wd->displayed() && wd->effect.bground)
window_layer::make_bground(wd);

View File

@@ -1,7 +1,7 @@
/*
* Nana GUI Programming Interface Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -303,13 +303,6 @@ namespace API
return reinterpret_cast<window>(restrict::wd_manager().create_widget(reinterpret_cast<basic_window*>(parent), r, true, wdg));
}
#ifndef WIDGET_FRAME_DEPRECATED
window create_frame(window parent, const rectangle& r, widget* wdg)
{
return reinterpret_cast<window>(restrict::wd_manager().create_frame(reinterpret_cast<basic_window*>(parent), r, wdg));
}
#endif
paint::graphics* window_graphics(window wd)
{
internal_scope_guard isg;
@@ -600,34 +593,6 @@ namespace API
reinterpret_cast<basic_window*>(wd)->flags.fullscreen = v;
}
#ifndef WIDGET_FRAME_DEPRECATED
bool insert_frame(window frame, native_window_type native_window)
{
return restrict::wd_manager().insert_frame(reinterpret_cast<basic_window*>(frame), native_window);
}
native_window_type frame_container(window frame)
{
auto frm = reinterpret_cast<basic_window*>(frame);
internal_scope_guard lock;
if (restrict::wd_manager().available(frm) && (frm->other.category == category::flags::frame))
return frm->other.attribute.frame->container;
return nullptr;
}
native_window_type frame_element(window frame, unsigned index)
{
auto frm = reinterpret_cast<basic_window*>(frame);
internal_scope_guard lock;
if (restrict::wd_manager().available(frm) && (frm->other.category == category::flags::frame))
{
if (index < frm->other.attribute.frame->attach.size())
return frm->other.attribute.frame->attach.at(index);
}
return nullptr;
}
#endif
void close_window(window wd)
{
restrict::wd_manager().close(reinterpret_cast<basic_window*>(wd));

View File

@@ -1,51 +0,0 @@
/*
* A Frame Implementation
* Copyright(C) 2003-2013 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/widgets/frame.cpp
*
* A frame provides a way to contain the platform window in a stdex GUI Window
*/
#include <nana/gui/widgets/frame.hpp>
#ifndef WIDGET_FRAME_DEPRECATED
namespace nana
{
//class frame:: public widget_object<category::frame_tag>
frame::frame(){}
frame::frame(window wd, bool visible)
{
create(wd, rectangle(), visible);
}
frame::frame(window wd, const nana::rectangle& r, bool visible)
{
create(wd, r, visible);
}
bool frame::insert(native_window_type wd)
{
return API::insert_frame(handle(), wd);
}
native_window_type frame::element(unsigned index)
{
return API::frame_element(handle(), index);
}
native_window_type frame::container() const
{
return API::frame_container(handle());
}
//end class frame
}//end namespace nana
#endif