init dragdrop
contains a new class simple_dragdrop and changes of listbox for dragdrop
This commit is contained in:
@@ -65,6 +65,13 @@ namespace nana
|
||||
blend
|
||||
};
|
||||
|
||||
enum class dragdrop_status
|
||||
{
|
||||
not_ready,
|
||||
ready,
|
||||
in_progress
|
||||
};
|
||||
|
||||
namespace category
|
||||
{
|
||||
enum class flags
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Basic Window Widget Definition
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -179,7 +179,8 @@ namespace detail
|
||||
bool ignore_menubar_focus : 1; ///< A flag indicates whether the menubar sets the focus.
|
||||
bool ignore_mouse_focus : 1; ///< A flag indicates whether the widget accepts focus when clicking on it
|
||||
bool space_click_enabled : 1; ///< A flag indicates whether enable mouse_down/click/mouse_up when pressing and releasing whitespace key.
|
||||
unsigned Reserved :18;
|
||||
bool draggable : 1;
|
||||
unsigned Reserved :17;
|
||||
unsigned char tab; ///< indicate a window that can receive the keyboard TAB
|
||||
mouse_action action;
|
||||
mouse_action action_before;
|
||||
@@ -234,6 +235,7 @@ namespace detail
|
||||
///< if the active_window is null, the parent of this window keeps focus.
|
||||
paint::graphics glass_buffer; ///< if effect.bground is avaiable. Refer to window_layout::make_bground.
|
||||
update_state upd_state;
|
||||
dragdrop_status dnd_state{ dragdrop_status::not_ready };
|
||||
|
||||
union
|
||||
{
|
||||
|
||||
45
include/nana/gui/dragdrop.hpp
Normal file
45
include/nana/gui/dragdrop.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Drag and Drop Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2018 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/dragdrop.hpp
|
||||
* @author: Jinhao(cnjinhao@hotmail.com)
|
||||
*/
|
||||
#ifndef NANA_GUI_DRAGDROP_INCLUDED
|
||||
#define NANA_GUI_DRAGDROP_INCLUDED
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <functional>
|
||||
#include "basis.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace nana
|
||||
{
|
||||
class simple_dragdrop
|
||||
{
|
||||
struct implementation;
|
||||
|
||||
simple_dragdrop(const simple_dragdrop&) = delete;
|
||||
simple_dragdrop& operator=(const simple_dragdrop&) = delete;
|
||||
|
||||
simple_dragdrop(simple_dragdrop&&) = delete;
|
||||
simple_dragdrop& operator=(simple_dragdrop&&) = delete;
|
||||
public:
|
||||
simple_dragdrop(window drag_wd);
|
||||
~simple_dragdrop();
|
||||
|
||||
/// Sets a condition that determines whether the drag&drop can start
|
||||
void condition(std::function<bool()> predicate_fn);
|
||||
void make_drop(window target, std::function<void()> drop_fn);
|
||||
private:
|
||||
implementation* const impl_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Nana GUI Programming Interface Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -117,6 +117,9 @@ namespace API
|
||||
void lazy_refresh();
|
||||
|
||||
void draw_shortkey_underline(paint::graphics&, const std::string& text, wchar_t shortkey, std::size_t shortkey_position, const point& text_pos, const color&);
|
||||
|
||||
void window_draggable(window, bool enabled);
|
||||
bool window_draggable(window);
|
||||
}//end namespace dev
|
||||
|
||||
|
||||
@@ -476,6 +479,8 @@ namespace API
|
||||
::std::optional<std::pair<::nana::size, ::nana::size>> content_extent(window wd, unsigned limited_px, bool limit_width);
|
||||
|
||||
unsigned screen_dpi(bool x_requested);
|
||||
|
||||
dragdrop_status window_dragdrop_status(::nana::window);
|
||||
}//end namespace API
|
||||
|
||||
}//end namespace nana
|
||||
|
||||
@@ -1497,6 +1497,9 @@ the nana::detail::basic_window member pointer scheme
|
||||
void erase(index_pairs indexes); ///<Erases specified items.
|
||||
item_proxy erase(item_proxy);
|
||||
|
||||
/// Returns the item which is hovered
|
||||
index_pair hovered() const;
|
||||
|
||||
bool sortable() const;
|
||||
void sortable(bool enable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user