remove deprecated code

This commit is contained in:
Jinhao 2019-02-20 23:04:03 +08:00
parent e89ee5d18b
commit 240fb82ab3
3 changed files with 8 additions and 269 deletions

View File

@ -1,7 +1,7 @@
/**
* Drag and Drop Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2018 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2018-2019 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -43,7 +43,11 @@ namespace nana
simple_dragdrop(window source);
~simple_dragdrop();
/// Sets a condition that determines whether the drag&drop can start
/// Condition checker
/**
* Sets a condition checker that determines whether the drag-and-drop operation can start. If a condition checker is not set, it always start drag-and-drop operation.
* @param predicate_fn Unary predicate which returns #true# for starting drag-and-drop operation.
*/
void condition(std::function<bool()> predicate_fn);
void make_drop(window target, std::function<void()> drop_fn);
private:
@ -94,9 +98,9 @@ namespace nana
dragdrop(window source);
~dragdrop();
/// Condition of dragging
/// Condition checker
/***
* The preciate function is called when press mouse button on the source window, it returns true to indicate the start of dragging. If the predicate is not set, it always start to drag.
* Sets a condition checker that determines whether the drag-and-drop operation can start. If a condition checker is not set, it always start drag-and-drop operation.
* @param predicate_fn A predicate function to be set.
*/
void condition(std::function<bool()> predicate_fn);

View File

@ -53,40 +53,6 @@ namespace detail
};
#pragma pack()
#if 0 //deprecated
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
struct bedrock::private_impl
{
typedef std::map<unsigned, thread_context> thr_context_container;
@ -249,14 +215,6 @@ 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)
{
@ -294,56 +252,6 @@ 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)
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;
}
#endif
void assign_arg(arg_mouse& arg, basic_window* wd, unsigned msg, const XEvent& evt)
{
arg.window_handle = reinterpret_cast<window>(wd);
@ -1361,22 +1269,6 @@ 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);
if(thr && thr->event_window == wd)
thr->event_window = nullptr;
}
void bedrock::thread_context_lazy_refresh()
{
thread_context* thrd = get_thread_context(0);
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)
{
@ -1446,34 +1338,6 @@ namespace detail
if (rev_wd)
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);
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;
}
}
#endif
}//end namespace detail
}//end namespace nana
#endif //NANA_POSIX && NANA_X11

View File

@ -14,7 +14,6 @@
#include "../../detail/platform_spec_selector.hpp"
#if defined(NANA_WINDOWS)
//#include <nana/gui/detail/bedrock.hpp> //deprecated
#include "bedrock_types.hpp"
#include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp>
@ -137,36 +136,6 @@ namespace detail
};
#pragma pack()
#if 0 //deprecated
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;
}
};
#endif
struct bedrock::private_impl
{
typedef std::map<unsigned, thread_context> thr_context_container;
@ -1598,14 +1567,6 @@ 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)
{
kb.alt = (0 != (::GetKeyState(VK_MENU) & 0x80));
@ -1683,55 +1644,6 @@ 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)
return false;
basic_window* prev_event_wd = nullptr;
if (thrd)
{
prev_event_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_event_wd;
return good_wd;
}
#endif
const wchar_t* translate(cursor id)
{
const wchar_t* name = IDC_ARROW;
@ -1759,21 +1671,7 @@ namespace detail
}
return name;
}
#if 0 //deprecated
void bedrock::thread_context_destroy(core_window_t * wd)
{
auto * thr = get_thread_context(0);
if (thr && thr->event_window == wd)
thr->event_window = nullptr;
}
void bedrock::thread_context_lazy_refresh()
{
auto* thrd = get_thread_context(0);
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)
{
@ -1866,33 +1764,6 @@ 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);
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, 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;
}
}
#endif
}//end namespace detail
}//end namespace nana
#endif //NANA_WINDOWS