Skip to content

Commit

Permalink
remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
cnjinhao committed Feb 20, 2019
1 parent e89ee5d commit 240fb82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 269 deletions.
12 changes: 8 additions & 4 deletions include/nana/gui/dragdrop.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Drag and Drop Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2018 Jinhao([email protected])
* Copyright(C) 2018-2019 Jinhao([email protected])
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
136 changes: 0 additions & 136 deletions source/gui/detail/bedrock_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
129 changes: 0 additions & 129 deletions source/gui/detail/bedrock_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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

0 comments on commit 240fb82

Please sign in to comment.