remove deprecated code and debug code
This commit is contained in:
parent
9f1d015355
commit
bbc39906c0
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* A Date Time Implementation
|
* A Date Time Implementation
|
||||||
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Background Effects Implementation
|
* Background Effects Implementation
|
||||||
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
@ -59,21 +59,10 @@ namespace nana{ namespace widgets{ namespace detail
|
|||||||
|
|
||||||
/// Widget scheme.
|
/// Widget scheme.
|
||||||
typedef WidgetScheme widget_scheme_t;
|
typedef WidgetScheme widget_scheme_t;
|
||||||
|
|
||||||
//widget_scheme_t * wdg_scheme_ptr_{ nullptr }; //deprecated
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// The destructor.
|
/// The destructor.
|
||||||
virtual ~compset_placer(){}
|
virtual ~compset_placer(){}
|
||||||
|
|
||||||
/*
|
|
||||||
/// Init the scheme pointer
|
|
||||||
void init_scheme(widget_scheme_t* wdg_scheme_ptr) //deprecated
|
|
||||||
{
|
|
||||||
wdg_scheme_ptr_ = wdg_scheme_ptr;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// Enable/Disable the specified component.
|
/// Enable/Disable the specified component.
|
||||||
virtual void enable(component_t, bool) = 0;
|
virtual void enable(component_t, bool) = 0;
|
||||||
virtual bool enabled(component_t) const = 0;
|
virtual bool enabled(component_t) const = 0;
|
||||||
|
@ -105,15 +105,8 @@ namespace nana
|
|||||||
class trigger
|
class trigger
|
||||||
:public drawer_trigger
|
:public drawer_trigger
|
||||||
{
|
{
|
||||||
//template<typename Renderer>
|
|
||||||
//struct basic_implement; //deprecated
|
|
||||||
|
|
||||||
class implementation;
|
class implementation;
|
||||||
|
|
||||||
//class item_renderer; //deprecated
|
|
||||||
class item_locator;
|
class item_locator;
|
||||||
|
|
||||||
//typedef basic_implement<item_renderer> implement; //deprecated
|
|
||||||
public:
|
public:
|
||||||
struct treebox_node_type
|
struct treebox_node_type
|
||||||
{
|
{
|
||||||
@ -142,17 +135,12 @@ namespace nana
|
|||||||
|
|
||||||
pat::cloneable<renderer_interface>& renderer() const;
|
pat::cloneable<renderer_interface>& renderer() const;
|
||||||
|
|
||||||
//void renderer(::nana::pat::cloneable<renderer_interface>&&);
|
|
||||||
//const ::nana::pat::cloneable<renderer_interface>& renderer() const; //deprecated
|
|
||||||
void placer(::nana::pat::cloneable<compset_placer_interface>&&);
|
void placer(::nana::pat::cloneable<compset_placer_interface>&&);
|
||||||
const ::nana::pat::cloneable<compset_placer_interface>& placer() const;
|
const ::nana::pat::cloneable<compset_placer_interface>& placer() const;
|
||||||
|
|
||||||
node_type* insert(node_type*, const std::string& key, std::string&&);
|
node_type* insert(node_type*, const std::string& key, std::string&&);
|
||||||
node_type* insert(const std::string& path, std::string&&);
|
node_type* insert(const std::string& path, std::string&&);
|
||||||
|
|
||||||
//node_type * selected() const; //deprecated
|
|
||||||
//void selected(node_type*);
|
|
||||||
|
|
||||||
node_image_tag& icon(const ::std::string&);
|
node_image_tag& icon(const ::std::string&);
|
||||||
void icon_erase(const ::std::string&);
|
void icon_erase(const ::std::string&);
|
||||||
void node_icon(node_type*, const ::std::string& id);
|
void node_icon(node_type*, const ::std::string& id);
|
||||||
@ -314,15 +302,6 @@ namespace nana
|
|||||||
return *p;
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
template<typename T>
|
|
||||||
item_proxy & value(const T& t) //deprecated
|
|
||||||
{
|
|
||||||
_m_value() = t;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
item_proxy & value(T&& t)
|
item_proxy & value(T&& t)
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
#include "posix/msg_dispatcher.hpp"
|
#include "posix/msg_dispatcher.hpp"
|
||||||
|
|
||||||
#include <iostream> //debug
|
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -1121,12 +1119,7 @@ namespace detail
|
|||||||
platform_scope_guard lock;
|
platform_scope_guard lock;
|
||||||
if(0 != xdnd_.dragdrop.count(wd))
|
if(0 != xdnd_.dragdrop.count(wd))
|
||||||
return false;
|
return false;
|
||||||
#if 0 //deprecated
|
|
||||||
std::cout<<"ChangeProperty XdndAware"<<std::endl;
|
|
||||||
int dndver = 4;
|
|
||||||
::XChangeProperty(display_, reinterpret_cast<Window>(wd), atombase_.xdnd_aware, XA_ATOM, sizeof(int) * 8,
|
|
||||||
PropModeReplace, reinterpret_cast<unsigned char*>(&dndver), 1);
|
|
||||||
#endif
|
|
||||||
xdnd_.dragdrop[wd] = ddrop;
|
xdnd_.dragdrop[wd] = ddrop;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1140,7 +1133,6 @@ namespace detail
|
|||||||
new_val = (xdnd_.targets[wd] += count);
|
new_val = (xdnd_.targets[wd] += count);
|
||||||
if(1 == new_val)
|
if(1 == new_val)
|
||||||
{
|
{
|
||||||
std::cout<<"ChangeProperty XdndAware"<<std::endl;
|
|
||||||
int dndver = 5;
|
int dndver = 5;
|
||||||
::XChangeProperty(display_, reinterpret_cast<Window>(wd), atombase_.xdnd_aware, XA_ATOM, sizeof(int) * 8,
|
::XChangeProperty(display_, reinterpret_cast<Window>(wd), atombase_.xdnd_aware, XA_ATOM, sizeof(int) * 8,
|
||||||
PropModeReplace, reinterpret_cast<unsigned char*>(&dndver), 1);
|
PropModeReplace, reinterpret_cast<unsigned char*>(&dndver), 1);
|
||||||
@ -1235,7 +1227,6 @@ namespace detail
|
|||||||
}
|
}
|
||||||
else if(evt.xselection.property == self.atombase_.xdnd_selection)
|
else if(evt.xselection.property == self.atombase_.xdnd_selection)
|
||||||
{
|
{
|
||||||
std::cout<<"Platform SelectionNotfy by XdndSelection, type="<<type<<", good_type="<<self.xdnd_.good_type<<", bytes_left="<<bytes_left<<std::endl;
|
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
msg.kind = msg_packet_tag::pkt_family::mouse_drop;
|
msg.kind = msg_packet_tag::pkt_family::mouse_drop;
|
||||||
msg.u.mouse_drop.window = 0;
|
msg.u.mouse_drop.window = 0;
|
||||||
@ -1250,7 +1241,6 @@ namespace detail
|
|||||||
auto files = new std::vector<std::string>;
|
auto files = new std::vector<std::string>;
|
||||||
std::stringstream ss(reinterpret_cast<char*>(data));
|
std::stringstream ss(reinterpret_cast<char*>(data));
|
||||||
|
|
||||||
std::cout<<" data:["<<ss.str()<<"]"<<std::endl;
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
std::string file;
|
std::string file;
|
||||||
@ -1271,7 +1261,6 @@ namespace detail
|
|||||||
files->push_back(file);
|
files->push_back(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<" file size:"<<files->size()<<std::endl;
|
|
||||||
if(files->size())
|
if(files->size())
|
||||||
{
|
{
|
||||||
msg.u.mouse_drop.window = evt.xselection.requestor;
|
msg.u.mouse_drop.window = evt.xselection.requestor;
|
||||||
@ -1285,8 +1274,6 @@ namespace detail
|
|||||||
accepted = true;
|
accepted = true;
|
||||||
::XFree(data);
|
::XFree(data);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
std::cout<<" invalid property"<<std::endl;
|
|
||||||
}
|
}
|
||||||
::XEvent respond;
|
::XEvent respond;
|
||||||
::memset(respond.xclient.data.l, 0, sizeof(respond.xclient.data.l));
|
::memset(respond.xclient.data.l, 0, sizeof(respond.xclient.data.l));
|
||||||
@ -1313,15 +1300,9 @@ namespace detail
|
|||||||
}
|
}
|
||||||
else if(SelectionRequest == evt.type)
|
else if(SelectionRequest == evt.type)
|
||||||
{
|
{
|
||||||
std::cout<<"Event SelectionRequest in platform spec";
|
|
||||||
//Skip if it is requested by XDND, it will be processed by dragdrop's xdnd_protocol
|
//Skip if it is requested by XDND, it will be processed by dragdrop's xdnd_protocol
|
||||||
if(self.atombase_.xdnd_selection == evt.xselectionrequest.selection)
|
if(self.atombase_.xdnd_selection == evt.xselectionrequest.selection)
|
||||||
{
|
return 0;
|
||||||
std::cout<<", xdnd_selection"<<std::endl;
|
|
||||||
return 0; //
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout<<std::endl;
|
|
||||||
|
|
||||||
auto disp = evt.xselectionrequest.display;
|
auto disp = evt.xselectionrequest.display;
|
||||||
XEvent respond;
|
XEvent respond;
|
||||||
@ -1368,7 +1349,6 @@ namespace detail
|
|||||||
{
|
{
|
||||||
if(self.atombase_.xdnd_enter == evt.xclient.message_type)
|
if(self.atombase_.xdnd_enter == evt.xclient.message_type)
|
||||||
{
|
{
|
||||||
std::cout<<"Platform: XdndEnter";
|
|
||||||
const Atom * atoms = reinterpret_cast<const Atom*>(&(evt.xclient.data.l[2]));
|
const Atom * atoms = reinterpret_cast<const Atom*>(&(evt.xclient.data.l[2]));
|
||||||
unsigned long len = 3;
|
unsigned long len = 3;
|
||||||
unsigned char * data = 0;
|
unsigned char * data = 0;
|
||||||
@ -1380,32 +1360,19 @@ namespace detail
|
|||||||
Atom type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
unsigned long bytes_left;
|
unsigned long bytes_left;
|
||||||
auto status = ::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist, 0, 0, False,
|
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist, 0, 0, False,
|
||||||
XA_ATOM, &type, &format, &len, &bytes_left, &data);
|
XA_ATOM, &type, &format, &len, &bytes_left, &data);
|
||||||
|
|
||||||
std::cout<<", XGetWindowProperty xdnd_typelist = "<<status<<" bytes_left="<<bytes_left<<std::endl;
|
|
||||||
|
|
||||||
if(bytes_left > 0)
|
if(bytes_left > 0)
|
||||||
{
|
{
|
||||||
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist,
|
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist,
|
||||||
0, bytes_left, False, XA_ATOM,
|
0, bytes_left, False, XA_ATOM,
|
||||||
&type, &format, &len, &bytes_left, &data);
|
&type, &format, &len, &bytes_left, &data);
|
||||||
|
|
||||||
std::cout<<" format="<<format<<" len="<<len<<" bytes_left="<<bytes_left;
|
|
||||||
auto type_name = ::XGetAtomName(self.display_, type);
|
|
||||||
if(type_name)
|
|
||||||
{
|
|
||||||
std::cout<<" type="<<type_name;
|
|
||||||
::XFree(type_name);
|
|
||||||
}
|
|
||||||
std::cout<<std::endl;
|
|
||||||
|
|
||||||
if(XA_ATOM == type && len > 0)
|
if(XA_ATOM == type && len > 0)
|
||||||
atoms = reinterpret_cast<const Atom*>(data);
|
atoms = reinterpret_cast<const Atom*>(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
std::cout<<", less than 3 types"<<std::endl;
|
|
||||||
|
|
||||||
#define DEBUG_XdndDirectSave
|
#define DEBUG_XdndDirectSave
|
||||||
#ifdef DEBUG_XdndDirectSave
|
#ifdef DEBUG_XdndDirectSave
|
||||||
@ -1417,15 +1384,12 @@ namespace detail
|
|||||||
auto name = XGetAtomName(self.display_, atoms[i]); //debug
|
auto name = XGetAtomName(self.display_, atoms[i]); //debug
|
||||||
if(name)
|
if(name)
|
||||||
{
|
{
|
||||||
std::cout<<" Supported type: "<<name<<std::endl;
|
|
||||||
#ifdef DEBUG_XdndDirectSave
|
#ifdef DEBUG_XdndDirectSave
|
||||||
if(strstr(name, "XdndDirectSave"))
|
if(strstr(name, "XdndDirectSave"))
|
||||||
XdndDirectSave = atoms[i];
|
XdndDirectSave = atoms[i];
|
||||||
#endif
|
#endif
|
||||||
::XFree(name);
|
::XFree(name);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
std::cout<<" Supported type: no name("<<atoms[i]<<")"<<std::endl;
|
|
||||||
|
|
||||||
if(atoms[i] == self.atombase_.text_uri_list)
|
if(atoms[i] == self.atombase_.text_uri_list)
|
||||||
{
|
{
|
||||||
@ -1444,24 +1408,13 @@ namespace detail
|
|||||||
int format;
|
int format;
|
||||||
unsigned long bytes_left;
|
unsigned long bytes_left;
|
||||||
|
|
||||||
auto status = ::XGetWindowProperty(self.display_, self.xdnd_.wd_src, XdndDirectSave, 0, 0, False, XA_ATOM, &type, &format, &len, &bytes_left, &data);
|
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, XdndDirectSave, 0, 0, False, XA_ATOM, &type, &format, &len, &bytes_left, &data);
|
||||||
auto name = XGetAtomName(self.display_, type); //debug
|
|
||||||
if(name)
|
|
||||||
{
|
|
||||||
std::cout<<" XdndDirectSave text/plain Atom: "<<name<<std::endl;
|
|
||||||
::XFree(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout<<", XGetWindowProperty XdndDirectSave = "<<status<<" bytes_left="<<bytes_left<<std::endl;
|
|
||||||
|
|
||||||
if(bytes_left > 0)
|
if(bytes_left > 0)
|
||||||
{
|
{
|
||||||
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, XdndDirectSave,
|
::XGetWindowProperty(self.display_, self.xdnd_.wd_src, XdndDirectSave,
|
||||||
0, bytes_left, False, type,
|
0, bytes_left, False, type,
|
||||||
&type, &format, &len, &bytes_left, &data);
|
&type, &format, &len, &bytes_left, &data);
|
||||||
|
|
||||||
std::cout<<" XdndDirectSave Data:["<<(char*)data<<"]"<<std::endl;
|
|
||||||
std::system("cp xds.txt /home/jinhao/xds.txt");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1469,8 +1422,6 @@ namespace detail
|
|||||||
}
|
}
|
||||||
else if(self.atombase_.xdnd_position == evt.xclient.message_type)
|
else if(self.atombase_.xdnd_position == evt.xclient.message_type)
|
||||||
{
|
{
|
||||||
std::cout<<"Platform: XdndPosition"<<std::endl;
|
|
||||||
|
|
||||||
Window wd_src = evt.xclient.data.l[0];
|
Window wd_src = evt.xclient.data.l[0];
|
||||||
int x = (evt.xclient.data.l[2] >> 16);
|
int x = (evt.xclient.data.l[2] >> 16);
|
||||||
int y = (evt.xclient.data.l[2] & 0xFFFF);
|
int y = (evt.xclient.data.l[2] & 0xFFFF);
|
||||||
@ -1482,7 +1433,6 @@ namespace detail
|
|||||||
Window child;
|
Window child;
|
||||||
::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child);
|
::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child);
|
||||||
|
|
||||||
std::cout<<" find_window"<<std::endl;
|
|
||||||
auto wd = bedrock.wd_manager().find_window(reinterpret_cast<native_window_type>(evt.xclient.window), self.xdnd_.pos);
|
auto wd = bedrock.wd_manager().find_window(reinterpret_cast<native_window_type>(evt.xclient.window), self.xdnd_.pos);
|
||||||
if(wd && wd->flags.dropable)
|
if(wd && wd->flags.dropable)
|
||||||
{
|
{
|
||||||
@ -1491,8 +1441,6 @@ namespace detail
|
|||||||
self.xdnd_.pos = wd->pos_root;
|
self.xdnd_.pos = wd->pos_root;
|
||||||
accepted = 1;
|
accepted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<" return,"<<wd<<std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XEvent respond;
|
XEvent respond;
|
||||||
@ -1511,25 +1459,18 @@ namespace detail
|
|||||||
respond.xclient.data.l[3] = 0;
|
respond.xclient.data.l[3] = 0;
|
||||||
respond.xclient.data.l[4] = self.atombase_.xdnd_action_copy;
|
respond.xclient.data.l[4] = self.atombase_.xdnd_action_copy;
|
||||||
|
|
||||||
std::cout<<" Target XdndStatus begin to send. Accepted"<<accepted<<std::endl;
|
|
||||||
::XSendEvent(self.display_, wd_src, True, NoEventMask, &respond);
|
::XSendEvent(self.display_, wd_src, True, NoEventMask, &respond);
|
||||||
std::cout<<" Target XdndStatus ed"<<std::endl;
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
else if(self.atombase_.xdnd_status == evt.xclient.message_type)
|
else if(self.atombase_.xdnd_status == evt.xclient.message_type)
|
||||||
{
|
{
|
||||||
std::cout<<"Platform Recv XdndStatus"<<std::endl;
|
//Platform Recv XdndStatus
|
||||||
}
|
}
|
||||||
else if(self.atombase_.xdnd_drop == evt.xclient.message_type)
|
else if(self.atombase_.xdnd_drop == evt.xclient.message_type)
|
||||||
{
|
{
|
||||||
Window owner = ::XGetSelectionOwner(self.display_, self.atombase_.xdnd_selection);
|
|
||||||
std::cout<<"Platform XdndDrop: XdndSelectionOwner = "<<owner<<std::endl;
|
|
||||||
|
|
||||||
::XConvertSelection(self.display_, self.atombase_.xdnd_selection, self.xdnd_.good_type, self.atombase_.xdnd_selection,
|
::XConvertSelection(self.display_, self.atombase_.xdnd_selection, self.xdnd_.good_type, self.atombase_.xdnd_selection,
|
||||||
evt.xclient.window, self.xdnd_.timestamp);
|
evt.xclient.window, self.xdnd_.timestamp);
|
||||||
|
|
||||||
std::cout<<" XConvertSelection ed"<<std::endl;
|
|
||||||
|
|
||||||
//The XdndDrop should send a XdndFinished to source window.
|
//The XdndDrop should send a XdndFinished to source window.
|
||||||
//This operation is implemented in SelectionNotify, because
|
//This operation is implemented in SelectionNotify, because
|
||||||
//XdndFinished should be sent after retrieving data.
|
//XdndFinished should be sent after retrieving data.
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include <iostream> //debug
|
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -231,10 +229,6 @@ namespace detail
|
|||||||
if(keymap[event.xkey.keycode / 8] & (1 << (event.xkey.keycode % 8)))
|
if(keymap[event.xkey.keycode / 8] & (1 << (event.xkey.keycode % 8)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(SelectionRequest == event.type)
|
|
||||||
{
|
|
||||||
std::cout<<"Dispatcher SelectionRequest"<<std::endl; //debug
|
|
||||||
}
|
|
||||||
|
|
||||||
if(::XFilterEvent(&event, None))
|
if(::XFilterEvent(&event, None))
|
||||||
continue;
|
continue;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <iostream> //debug
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
@ -179,13 +178,7 @@ namespace nana
|
|||||||
auto name = find_kde_theme_name();
|
auto name = find_kde_theme_name();
|
||||||
|
|
||||||
if(name.empty())
|
if(name.empty())
|
||||||
{
|
|
||||||
name = find_gnome_theme_name();
|
|
||||||
std::cout<<"GNOME:"<<name<<std::endl;
|
|
||||||
return find_gnome_theme_name();
|
return find_gnome_theme_name();
|
||||||
}
|
|
||||||
|
|
||||||
std::cout<<"KDE:"<<name<<std::endl;
|
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -294,13 +287,6 @@ namespace nana
|
|||||||
std::vector<std::string> directories_;
|
std::vector<std::string> directories_;
|
||||||
};
|
};
|
||||||
|
|
||||||
void test()
|
|
||||||
{
|
|
||||||
theme thm;
|
|
||||||
auto png = thm.icon("folder", 30);
|
|
||||||
std::cout<<"Icon Theme="<<png<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
theme::theme():
|
theme::theme():
|
||||||
path_("/usr/share/icons/"),
|
path_("/usr/share/icons/"),
|
||||||
ifs_("/usr/share/icons/default/index.theme")
|
ifs_("/usr/share/icons/default/index.theme")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* X-Window XDND Protocol Implementation
|
* X-Window XDND Protocol Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* 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.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -23,12 +23,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_XDND_PROTOCOL
|
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
#include <iostream> //debug
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace nana{
|
namespace nana{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -58,15 +52,6 @@ namespace nana{
|
|||||||
detail::platform_scope_guard lock;
|
detail::platform_scope_guard lock;
|
||||||
::XSetSelectionOwner(disp, spec_.atombase().xdnd_selection, source, CurrentTime);
|
::XSetSelectionOwner(disp, spec_.atombase().xdnd_selection, source, CurrentTime);
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"XSetSelectionOwner "<<source<<std::endl;
|
|
||||||
#endif
|
|
||||||
/* //deprecated
|
|
||||||
theme icons;
|
|
||||||
cursor_.dnd_copy = ::XcursorFilenameLoadCursor(disp, icons.cursor("dnd-copy").c_str());
|
|
||||||
cursor_.dnd_move = ::XcursorFilenameLoadCursor(disp, icons.cursor("dnd-move").c_str());
|
|
||||||
cursor_.dnd_none = ::XcursorFilenameLoadCursor(disp, icons.cursor("dnd-none").c_str());
|
|
||||||
*/
|
|
||||||
cursor_.dnd_copy = ::XcursorLibraryLoadCursor(disp, "dnd-copy");
|
cursor_.dnd_copy = ::XcursorLibraryLoadCursor(disp, "dnd-copy");
|
||||||
cursor_.dnd_move = ::XcursorLibraryLoadCursor(disp, "dnd-move");
|
cursor_.dnd_move = ::XcursorLibraryLoadCursor(disp, "dnd-move");
|
||||||
cursor_.dnd_none = ::XcursorLibraryLoadCursor(disp, "dnd-none");
|
cursor_.dnd_none = ::XcursorLibraryLoadCursor(disp, "dnd-none");
|
||||||
@ -115,18 +100,12 @@ namespace nana{
|
|||||||
|
|
||||||
if(atombase.xdnd_status == xclient.message_type)
|
if(atombase.xdnd_status == xclient.message_type)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Event: XdndStatus"<<std::endl;
|
|
||||||
#endif
|
|
||||||
if(xdnd_status_state::position != xstate_ && xdnd_status_state::drop != xstate_)
|
if(xdnd_status_state::position != xstate_ && xdnd_status_state::drop != xstate_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Window target_wd = static_cast<Window>(xclient.data.l[0]);
|
Window target_wd = static_cast<Window>(xclient.data.l[0]);
|
||||||
bool is_accepted_by_target = (xclient.data.l[1] & 1);
|
bool is_accepted_by_target = (xclient.data.l[1] & 1);
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"XdndStatus: Accepted="<<is_accepted_by_target<<", target="<<target_wd<<std::endl;
|
|
||||||
#endif
|
|
||||||
if(xclient.data.l[1] & 0x2)
|
if(xclient.data.l[1] & 0x2)
|
||||||
{
|
{
|
||||||
rectangle rct{
|
rectangle rct{
|
||||||
@ -137,16 +116,8 @@ namespace nana{
|
|||||||
};
|
};
|
||||||
|
|
||||||
if(!rct.empty())
|
if(!rct.empty())
|
||||||
{
|
|
||||||
mvout_table_[target_wd] = rct;
|
mvout_table_[target_wd] = rct;
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<". rct=("<<rct.x<<","<<rct.y<<","<<rct.width<<","<<rct.height<<")";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<std::endl;
|
|
||||||
#endif
|
|
||||||
_m_cursor(is_accepted_by_target);
|
_m_cursor(is_accepted_by_target);
|
||||||
|
|
||||||
if((!is_accepted_by_target) && (xdnd_status_state::drop == xstate_))
|
if((!is_accepted_by_target) && (xdnd_status_state::drop == xstate_))
|
||||||
@ -156,11 +127,6 @@ namespace nana{
|
|||||||
}
|
}
|
||||||
|
|
||||||
executed_action_ = xclient.data.l[4];
|
executed_action_ = xclient.data.l[4];
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<" Assign ExecutedAction = "<<static_cast<int>(executed_action_)<<std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xstate_ = xdnd_status_state::normal;
|
xstate_ = xdnd_status_state::normal;
|
||||||
}
|
}
|
||||||
else if(atombase.xdnd_finished == xclient.message_type)
|
else if(atombase.xdnd_finished == xclient.message_type)
|
||||||
@ -173,9 +139,6 @@ namespace nana{
|
|||||||
{
|
{
|
||||||
if(spec_.atombase().xdnd_selection == xselectionrequest.selection)
|
if(spec_.atombase().xdnd_selection == xselectionrequest.selection)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Event SelectionRequest: XdndSelection"<<std::endl;
|
|
||||||
#endif
|
|
||||||
::XEvent evt;
|
::XEvent evt;
|
||||||
evt.xselection.type = SelectionNotify;
|
evt.xselection.type = SelectionNotify;
|
||||||
evt.xselection.display = xselectionrequest.display;
|
evt.xselection.display = xselectionrequest.display;
|
||||||
@ -185,23 +148,8 @@ namespace nana{
|
|||||||
evt.xselection.property = 0;
|
evt.xselection.property = 0;
|
||||||
evt.xselection.time = xselectionrequest.time;
|
evt.xselection.time = xselectionrequest.time;
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
auto property_name = ::XGetAtomName(spec_.open_display(), xselectionrequest.property); //debug
|
|
||||||
|
|
||||||
std::cout<<"SelectionRequest"<<std::endl;
|
|
||||||
std::cout<<" xdnd_selection:"<<spec_.atombase().xdnd_selection<<std::endl;
|
|
||||||
std::cout<<" text_uri_list :"<<spec_.atombase().text_uri_list<<std::endl;
|
|
||||||
std::cout<<" selection="<<xselectionrequest.selection<<std::endl;
|
|
||||||
std::cout<<" property ="<<xselectionrequest.property<<", name="<<property_name<<std::endl;
|
|
||||||
std::cout<<" target ="<<xselectionrequest.target<<std::endl;
|
|
||||||
::XFree(property_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(xselectionrequest.target == spec_.atombase().text_uri_list)
|
if(xselectionrequest.target == spec_.atombase().text_uri_list)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"SelectionRequest target = text_uri_list";
|
|
||||||
#endif
|
|
||||||
if(data.files.size())
|
if(data.files.size())
|
||||||
{
|
{
|
||||||
std::string uri_list;
|
std::string uri_list;
|
||||||
@ -211,9 +159,7 @@ namespace nana{
|
|||||||
uri_list += file.u8string();
|
uri_list += file.u8string();
|
||||||
uri_list += "\r\n";
|
uri_list += "\r\n";
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<". URIs="<<uri_list<<std::endl;
|
|
||||||
#endif
|
|
||||||
::XChangeProperty (spec_.open_display(),
|
::XChangeProperty (spec_.open_display(),
|
||||||
xselectionrequest.requestor,
|
xselectionrequest.requestor,
|
||||||
xselectionrequest.property,
|
xselectionrequest.property,
|
||||||
@ -226,10 +172,7 @@ namespace nana{
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
else
|
|
||||||
std::cout<<"SelectionRequest target = "<<xselectionrequest.target<<std::endl;
|
|
||||||
#endif
|
|
||||||
platform_scope_guard lock;
|
platform_scope_guard lock;
|
||||||
::XSendEvent(spec_.open_display(), xselectionrequest.requestor, False, 0, &evt);
|
::XSendEvent(spec_.open_display(), xselectionrequest.requestor, False, 0, &evt);
|
||||||
::XFlush(spec_.open_display());
|
::XFlush(spec_.open_display());
|
||||||
@ -247,9 +190,6 @@ namespace nana{
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
target_ = wd;
|
target_ = wd;
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Send XdndEnter, text/uri-list="<<spec_.atombase().text_uri_list<<std::endl;
|
|
||||||
#endif
|
|
||||||
_m_client_msg(spec_.atombase().xdnd_enter, (xdnd_ver << 24), spec_.atombase().text_uri_list, XA_STRING);
|
_m_client_msg(spec_.atombase().xdnd_enter, (xdnd_ver << 24), spec_.atombase().text_uri_list, XA_STRING);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -264,9 +204,6 @@ namespace nana{
|
|||||||
if(i != mvout_table_.end() && i->second.is_hit(pos))
|
if(i != mvout_table_.end() && i->second.is_hit(pos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Send: XdndPosition, RequestedAction="<<requested_action<<", XdndActionCopy="<<spec_.atombase().xdnd_action_copy<<std::endl;
|
|
||||||
#endif
|
|
||||||
xstate_ = xdnd_status_state::position;
|
xstate_ = xdnd_status_state::position;
|
||||||
//Send XdndPosition
|
//Send XdndPosition
|
||||||
long position = (pos.x << 16 | pos.y);
|
long position = (pos.x << 16 | pos.y);
|
||||||
@ -279,9 +216,6 @@ namespace nana{
|
|||||||
|
|
||||||
if(target_)
|
if(target_)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Send: XdndLeave, reset ExecutedAction"<<std::endl;
|
|
||||||
#endif
|
|
||||||
_m_client_msg(spec_.atombase().xdnd_leave, 0, 0, 0);
|
_m_client_msg(spec_.atombase().xdnd_leave, 0, 0, 0);
|
||||||
target_ = 0;
|
target_ = 0;
|
||||||
executed_action_ = 0;
|
executed_action_ = 0;
|
||||||
@ -294,12 +228,8 @@ namespace nana{
|
|||||||
xstate_ = xdnd_status_state::drop;
|
xstate_ = xdnd_status_state::drop;
|
||||||
|
|
||||||
if(executed_action_)
|
if(executed_action_)
|
||||||
{
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Send: XdndDrop"<<std::endl;
|
|
||||||
#endif
|
|
||||||
_m_client_msg(spec_.atombase().xdnd_drop, 0, CurrentTime, 0);
|
_m_client_msg(spec_.atombase().xdnd_drop, 0, CurrentTime, 0);
|
||||||
}
|
|
||||||
target_ = 0;
|
target_ = 0;
|
||||||
|
|
||||||
return (executed_action_ != 0);
|
return (executed_action_ != 0);
|
||||||
@ -338,16 +268,13 @@ namespace nana{
|
|||||||
0, 4, False, XA_ATOM, &actual, &format, &count, &remaining, &data);
|
0, 4, False, XA_ATOM, &actual, &format, &count, &remaining, &data);
|
||||||
|
|
||||||
int version = 0;
|
int version = 0;
|
||||||
if ((actual == XA_ATOM) && (format==32) && count && data)
|
|
||||||
{
|
|
||||||
version = int(*(Atom*)data);
|
|
||||||
#ifdef DEBUG_XDND_PROTOCOL
|
|
||||||
std::cout<<"Get:XdndAware version:"<<version<<std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
|
{
|
||||||
|
if ((actual == XA_ATOM) && (format==32) && count)
|
||||||
|
version = int(*(Atom*)data);
|
||||||
|
|
||||||
::XFree(data);
|
::XFree(data);
|
||||||
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "inner_fwd_implement.hpp"
|
#include "inner_fwd_implement.hpp"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream> //debug
|
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
@ -445,7 +444,6 @@ namespace detail
|
|||||||
case nana::detail::msg_packet_tag::pkt_family::mouse_drop:
|
case nana::detail::msg_packet_tag::pkt_family::mouse_drop:
|
||||||
msgwd = brock.wd_manager().find_window(native_window, {msg.u.mouse_drop.x, msg.u.mouse_drop.y});
|
msgwd = brock.wd_manager().find_window(native_window, {msg.u.mouse_drop.x, msg.u.mouse_drop.y});
|
||||||
|
|
||||||
std::cout<<" MouseDrop msgwd="<<msgwd<<", ("<<msg.u.mouse_drop.x<<","<<msg.u.mouse_drop.y<<")"<<std::endl;
|
|
||||||
if(msgwd)
|
if(msgwd)
|
||||||
{
|
{
|
||||||
arg_dropfiles arg;
|
arg_dropfiles arg;
|
||||||
|
@ -138,7 +138,7 @@ namespace nana
|
|||||||
|
|
||||||
void drawer_trigger::filter_event(const std::vector<event_code>& evt_codes, const bool bDisabled)
|
void drawer_trigger::filter_event(const std::vector<event_code>& evt_codes, const bool bDisabled)
|
||||||
{
|
{
|
||||||
for (const auto& evt_code : evt_codes)
|
for (auto evt_code : evt_codes)
|
||||||
{
|
{
|
||||||
filter_event(evt_code, bDisabled);
|
filter_event(evt_code, bDisabled);
|
||||||
}
|
}
|
||||||
|
@ -955,14 +955,6 @@ namespace nana{
|
|||||||
auto fm_extents = window_frame_extents(wd);
|
auto fm_extents = window_frame_extents(wd);
|
||||||
origin.x = -fm_extents.left;
|
origin.x = -fm_extents.left;
|
||||||
origin.y = -fm_extents.top;
|
origin.y = -fm_extents.top;
|
||||||
#if 0 //deprecated
|
|
||||||
if(reinterpret_cast<Window>(coord_wd) != restrict::spec.root_window())
|
|
||||||
{
|
|
||||||
fm_extents = window_frame_extents(coord_wd);
|
|
||||||
origin.x += fm_extents.left;
|
|
||||||
origin.y += fm_extents.top;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
coord_wd = get_window(wd, window_relationship::parent);
|
coord_wd = get_window(wd, window_relationship::parent);
|
||||||
@ -1601,10 +1593,6 @@ namespace nana{
|
|||||||
if(True == ::XTranslateCoordinates(restrict::spec.open_display(),
|
if(True == ::XTranslateCoordinates(restrict::spec.open_display(),
|
||||||
reinterpret_cast<Window>(wd), restrict::spec.root_window(), x, y, &pos.x, &pos.y, &child))
|
reinterpret_cast<Window>(wd), restrict::spec.root_window(), x, y, &pos.x, &pos.y, &child))
|
||||||
{
|
{
|
||||||
//deprecated
|
|
||||||
//auto fm_extents = window_frame_extents(wd);
|
|
||||||
//pos.x += fm_extents.left;
|
|
||||||
//pos.y += fm_extents.top;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1627,11 +1615,6 @@ namespace nana{
|
|||||||
Window child;
|
Window child;
|
||||||
if(True == ::XTranslateCoordinates(restrict::spec.open_display(), restrict::spec.root_window(), reinterpret_cast<Window>(wd), x, y, &pos.x, &pos.y, &child))
|
if(True == ::XTranslateCoordinates(restrict::spec.open_display(), restrict::spec.root_window(), reinterpret_cast<Window>(wd), x, y, &pos.x, &pos.y, &child))
|
||||||
{
|
{
|
||||||
//deprecated
|
|
||||||
//Now the origin of pos is the left-top corner of the window(including titlebar and border)
|
|
||||||
//auto fm_extents = window_frame_extents(wd);
|
|
||||||
//pos.x += fm_extents.left;
|
|
||||||
//pos.y += fm_extents.top;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -308,66 +308,6 @@ namespace nana
|
|||||||
|
|
||||||
class win32_dropdata : public win32com_iunknown<IDataObject, IID_IDataObject>
|
class win32_dropdata : public win32com_iunknown<IDataObject, IID_IDataObject>
|
||||||
{
|
{
|
||||||
#if 0 //deprecated
|
|
||||||
class enumer : public win32com_iunknown<IEnumFORMATETC, IID_IEnumFORMATETC>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enumer(drop_data& data) :
|
|
||||||
data_(data)
|
|
||||||
{}
|
|
||||||
|
|
||||||
enumer(const enumer& rhs):
|
|
||||||
data_(rhs.data_),
|
|
||||||
cursor_(rhs.cursor_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
// Implement IEnumFORMATETC
|
|
||||||
HRESULT Clone(IEnumFORMATETC **ppenum) override
|
|
||||||
{
|
|
||||||
*ppenum = new enumer{ *this };
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT Next(ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) override
|
|
||||||
{
|
|
||||||
HRESULT result = (cursor_ + celt <= data_.entries_.size() ? S_OK : S_FALSE);
|
|
||||||
|
|
||||||
auto const fetched = (std::min)(std::size_t(celt), data_.entries_.size() - cursor_);
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < fetched; ++i)
|
|
||||||
*rgelt++ = data_.entries_[cursor_++]->format;
|
|
||||||
|
|
||||||
if (pceltFetched)
|
|
||||||
*pceltFetched = static_cast<ULONG>(fetched);
|
|
||||||
else if (celt > 1)
|
|
||||||
return S_FALSE;
|
|
||||||
|
|
||||||
return (celt == fetched ? S_OK : S_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT Reset() override
|
|
||||||
{
|
|
||||||
cursor_ = 0;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT Skip(ULONG celt) override
|
|
||||||
{
|
|
||||||
if (cursor_ + celt < data_.entries_.size())
|
|
||||||
{
|
|
||||||
cursor_ += celt;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor_ = data_.entries_.size();
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
drop_data & data_;
|
|
||||||
std::size_t cursor_;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
public:
|
public:
|
||||||
struct data_entry
|
struct data_entry
|
||||||
{
|
{
|
||||||
@ -625,8 +565,6 @@ namespace nana
|
|||||||
|
|
||||||
|
|
||||||
#elif defined(NANA_X11)
|
#elif defined(NANA_X11)
|
||||||
constexpr int xdnd_version = 5;
|
|
||||||
|
|
||||||
class x11_dropdata
|
class x11_dropdata
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -839,17 +777,13 @@ namespace nana
|
|||||||
|
|
||||||
auto cur_wd = API::find_window(API::cursor_position());
|
auto cur_wd = API::find_window(API::cursor_position());
|
||||||
|
|
||||||
std::cout<<" Hovered="<<cur_wd;
|
|
||||||
if(hovered_.window_handle != cur_wd)
|
if(hovered_.window_handle != cur_wd)
|
||||||
{
|
{
|
||||||
hovered_.window_handle = cur_wd;
|
hovered_.window_handle = cur_wd;
|
||||||
|
|
||||||
icon = (((drag_wd == cur_wd) || ddrop->has(drag_wd, cur_wd)) ? "dnd-move" : "dnd-none");
|
icon = (((drag_wd == cur_wd) || ddrop->has(drag_wd, cur_wd)) ? "dnd-move" : "dnd-none");
|
||||||
std::cout<<" ICON="<<icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<std::endl;
|
|
||||||
|
|
||||||
if(icon)
|
if(icon)
|
||||||
{
|
{
|
||||||
_m_free_cursor();
|
_m_free_cursor();
|
||||||
@ -880,10 +814,9 @@ namespace nana
|
|||||||
nana::detail::xdnd_protocol xdnd_proto{native_source};
|
nana::detail::xdnd_protocol xdnd_proto{native_source};
|
||||||
|
|
||||||
//Not simple mode
|
//Not simple mode
|
||||||
_m_spec().msg_dispatch([this, ddrop, &data, drag_wd, &xdnd_proto, native_source, &atombase](const detail::msg_packet_tag& msg_pkt) mutable{
|
_m_spec().msg_dispatch([this, &data, drag_wd, &xdnd_proto](const detail::msg_packet_tag& msg_pkt) mutable{
|
||||||
if(detail::msg_packet_tag::pkt_family::xevent == msg_pkt.kind)
|
if(detail::msg_packet_tag::pkt_family::xevent == msg_pkt.kind)
|
||||||
{
|
{
|
||||||
auto const disp = _m_spec().open_display();
|
|
||||||
if (MotionNotify == msg_pkt.u.xevent.type)
|
if (MotionNotify == msg_pkt.u.xevent.type)
|
||||||
{
|
{
|
||||||
auto pos = API::cursor_position();
|
auto pos = API::cursor_position();
|
||||||
@ -906,10 +839,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
else if(msg_pkt.u.xevent.type == ButtonRelease)
|
else if(msg_pkt.u.xevent.type == ButtonRelease)
|
||||||
{
|
{
|
||||||
std::cout<<"ButtonRelease"<<std::endl;
|
|
||||||
API::release_capture(drag_wd);
|
API::release_capture(drag_wd);
|
||||||
|
|
||||||
std::cout<<"mouse_release"<<std::endl;
|
|
||||||
_m_free_cursor();
|
_m_free_cursor();
|
||||||
|
|
||||||
//Exits the msg loop if xdnd_proto doesn't send the XdndDrop because of refusal of the DND
|
//Exits the msg loop if xdnd_proto doesn't send the XdndDrop because of refusal of the DND
|
||||||
@ -1031,8 +961,7 @@ namespace nana
|
|||||||
if (API::is_window(window_handle))
|
if (API::is_window(window_handle))
|
||||||
{
|
{
|
||||||
dragging = true;
|
dragging = true;
|
||||||
using basic_window = ::nana::detail::basic_window;
|
auto real_wd = reinterpret_cast<detail::basic_window*>(window_handle);
|
||||||
auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(window_handle);
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::not_ready;
|
real_wd->other.dnd_state = dragdrop_status::not_ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,8 +1001,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
impl_->dragging = ((!impl_->predicate) || impl_->predicate());
|
impl_->dragging = ((!impl_->predicate) || impl_->predicate());
|
||||||
|
|
||||||
using basic_window = ::nana::detail::basic_window;
|
auto real_wd = reinterpret_cast<detail::basic_window*>(impl_->window_handle);
|
||||||
auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(impl_->window_handle);
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::ready;
|
real_wd->other.dnd_state = dragdrop_status::ready;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1082,8 +1010,7 @@ namespace nana
|
|||||||
if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle)))
|
if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using basic_window = ::nana::detail::basic_window;
|
auto real_wd = reinterpret_cast<detail::basic_window*>(arg.window_handle);
|
||||||
auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(arg.window_handle);
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::in_progress;
|
real_wd->other.dnd_state = dragdrop_status::in_progress;
|
||||||
|
|
||||||
std::unique_ptr<dragdrop_service::dropdata_type> dropdata{new dragdrop_service::dropdata_type};
|
std::unique_ptr<dragdrop_service::dropdata_type> dropdata{new dragdrop_service::dropdata_type};
|
||||||
@ -1190,8 +1117,7 @@ namespace nana
|
|||||||
{
|
{
|
||||||
impl_->dragging = ((!impl_->predicate) || impl_->predicate());
|
impl_->dragging = ((!impl_->predicate) || impl_->predicate());
|
||||||
|
|
||||||
using basic_window = ::nana::detail::basic_window;
|
auto real_wd = reinterpret_cast<detail::basic_window*>(impl_->source_handle);
|
||||||
auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(impl_->source_handle);
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::ready;
|
real_wd->other.dnd_state = dragdrop_status::ready;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1200,27 +1126,14 @@ namespace nana
|
|||||||
if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle)))
|
if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using basic_window = ::nana::detail::basic_window;
|
auto real_wd = reinterpret_cast<detail::basic_window*>(arg.window_handle);
|
||||||
auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(arg.window_handle);
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::in_progress;
|
real_wd->other.dnd_state = dragdrop_status::in_progress;
|
||||||
|
|
||||||
impl_->make_drop();
|
impl_->make_drop();
|
||||||
|
|
||||||
//deprecated
|
|
||||||
//auto has_dropped = dragdrop_service::instance().dragdrop(arg.window_handle);
|
|
||||||
|
|
||||||
real_wd->other.dnd_state = dragdrop_status::not_ready;
|
real_wd->other.dnd_state = dragdrop_status::not_ready;
|
||||||
impl_->dragging = false;
|
impl_->dragging = false;
|
||||||
|
|
||||||
/* //deprecated
|
|
||||||
if (has_dropped)
|
|
||||||
{
|
|
||||||
auto drop_wd = API::find_window(API::cursor_position());
|
|
||||||
//auto i = impl_->targets.find(drop_wd);
|
|
||||||
//if ((impl_->targets.end() != i) && i->second)
|
|
||||||
// i->second();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,19 +250,14 @@ namespace nana
|
|||||||
else if(event_code::mouse_up == arg.evt_code)
|
else if(event_code::mouse_up == arg.evt_code)
|
||||||
{
|
{
|
||||||
selection_.is_deselect_delayed = false;
|
selection_.is_deselect_delayed = false;
|
||||||
#if 0
|
|
||||||
this->_m_delay_deselect(true);
|
|
||||||
#endif
|
|
||||||
if(_m_sync_with_selection())
|
if(_m_sync_with_selection())
|
||||||
_m_display_target_filenames();
|
_m_display_target_filenames();
|
||||||
}
|
}
|
||||||
else if(event_code::mouse_move == arg.evt_code)
|
else if(event_code::mouse_move == arg.evt_code)
|
||||||
{
|
{
|
||||||
if(arg.left_button)
|
if(arg.left_button)
|
||||||
{
|
|
||||||
selection_.is_deselect_delayed = false;
|
selection_.is_deselect_delayed = false;
|
||||||
std::cout<<"MouseMove set is_deselect_delayed = true"<<std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(event_code::dbl_click == arg.evt_code)
|
else if(event_code::dbl_click == arg.evt_code)
|
||||||
_m_click_select_file(arg);
|
_m_click_select_file(arg);
|
||||||
@ -487,22 +482,6 @@ namespace nana
|
|||||||
cb_types_.anyobj(i, v);
|
cb_types_.anyobj(i, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool file(std::string& fs) const
|
|
||||||
{
|
|
||||||
if(selection_.type == kind::none)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto pos = selection_.target.find_last_of("\\/");
|
|
||||||
if(pos != selection_.target.npos)
|
|
||||||
saved_selected_path = selection_.target.substr(0, pos);
|
|
||||||
else
|
|
||||||
saved_selected_path.clear();
|
|
||||||
|
|
||||||
fs = selection_.target;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
std::vector<std::string> files() const
|
std::vector<std::string> files() const
|
||||||
{
|
{
|
||||||
if(kind::none == selection_.type)
|
if(kind::none == selection_.type)
|
||||||
@ -1005,53 +984,8 @@ namespace nana
|
|||||||
else
|
else
|
||||||
_m_load_cat_path(addr_.filesystem + m.name + "/");
|
_m_load_cat_path(addr_.filesystem + m.name + "/");
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if((mode::open_directory == mode_) || (false == m.directory))
|
|
||||||
{
|
|
||||||
if(ls_file_.is_single_enabled(true) || !arg.ctrl)
|
|
||||||
{
|
|
||||||
std::cout<<"assign by click select "<<m.name<<std::endl;
|
|
||||||
selection_.targets = {m.name};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout<<"insert by click select "<<m.name<<std::endl;
|
|
||||||
_m_insert_filename(m.name);
|
|
||||||
}
|
|
||||||
_m_display_target_filenames();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void _m_delay_deselect(bool only_clear_register)
|
|
||||||
{
|
|
||||||
if(!only_clear_register)
|
|
||||||
{
|
|
||||||
std::string filename_string;
|
|
||||||
for(auto i = selection_.targets.cbegin(); i != selection_.targets.cend();)
|
|
||||||
{
|
|
||||||
std::filesystem::path p{*i};
|
|
||||||
|
|
||||||
auto u = std::find(selection_.delay_deselect.cbegin(), selection_.delay_deselect.cend(), p.filename().u8string());
|
|
||||||
if(u == selection_.delay_deselect.cend())
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i = selection_.targets.erase(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
_m_display_target_filenames();
|
|
||||||
}
|
|
||||||
|
|
||||||
selection_.delay_deselect.clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void _m_select_file(const listbox::item_proxy& item)
|
void _m_select_file(const listbox::item_proxy& item)
|
||||||
{
|
{
|
||||||
item_fs mfs;
|
item_fs mfs;
|
||||||
@ -1064,7 +998,6 @@ namespace nana
|
|||||||
if(ls_file_.selected().size() < 2)
|
if(ls_file_.selected().size() < 2)
|
||||||
selection_.targets.clear();
|
selection_.targets.clear();
|
||||||
|
|
||||||
std::cout<<"insert by select file:"<<mfs.name<<std::endl;
|
|
||||||
_m_insert_filename(mfs.name);
|
_m_insert_filename(mfs.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,16 +1008,11 @@ namespace nana
|
|||||||
std::filesystem::path p{*i};
|
std::filesystem::path p{*i};
|
||||||
if(p.filename().u8string() == mfs.name)
|
if(p.filename().u8string() == mfs.name)
|
||||||
{
|
{
|
||||||
std::cout<<"_m_select_file delay deselect = "<<selection_.is_deselect_delayed<<std::endl;
|
|
||||||
if(!selection_.is_deselect_delayed)
|
if(!selection_.is_deselect_delayed)
|
||||||
{
|
{
|
||||||
i = selection_.targets.erase(i);
|
i = selection_.targets.erase(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
selection_.delay_deselect.push_back(mfs.name);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -1156,11 +1084,7 @@ namespace nana
|
|||||||
selection_.targets.clear();
|
selection_.targets.clear();
|
||||||
//auto file = tb_file_.caption();
|
//auto file = tb_file_.caption();
|
||||||
auto targets = _m_strip_files(files_text);
|
auto targets = _m_strip_files(files_text);
|
||||||
#if 1 //debug
|
|
||||||
std::cout<<"filebox OK: file="<<files_text<<std::endl;
|
|
||||||
for(auto t : targets)
|
|
||||||
std::cout<<"filebox OK stripped:"<<t<<std::endl;
|
|
||||||
#endif
|
|
||||||
if(targets.empty())
|
if(targets.empty())
|
||||||
{
|
{
|
||||||
//No file is selected
|
//No file is selected
|
||||||
@ -1252,179 +1176,6 @@ namespace nana
|
|||||||
_m_finish(kind::filesystem);
|
_m_finish(kind::filesystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void _m_ok()
|
|
||||||
{
|
|
||||||
selection_.targets.clear();
|
|
||||||
auto file = tb_file_.caption();
|
|
||||||
auto targets = _m_strip_files(file);
|
|
||||||
#if 1 //debug
|
|
||||||
std::cout<<"filebox OK: file="<<file<<std::endl;
|
|
||||||
for(auto t : targets)
|
|
||||||
std::cout<<"filebox OK stripped:"<<t<<std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//No file is selected
|
|
||||||
if(targets.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::string tar;
|
|
||||||
if(selection_.targets.empty())
|
|
||||||
{
|
|
||||||
if(file.size())
|
|
||||||
{
|
|
||||||
internationalization i18n;
|
|
||||||
if(file[0] == '.')
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption());
|
|
||||||
mb.icon(msgbox::icon_warning);
|
|
||||||
mb<<file<<std::endl<<i18n("NANA_FILEBOX_ERROR_INVALID_FILENAME");
|
|
||||||
mb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file[0] == '/')
|
|
||||||
tar = file;
|
|
||||||
else
|
|
||||||
tar = addr_.filesystem + file;
|
|
||||||
|
|
||||||
auto fattr = fs::status(tar);
|
|
||||||
auto ftype = static_cast<fs::file_type>(fattr.type());
|
|
||||||
|
|
||||||
//Check if the selected name is a directory
|
|
||||||
auto is_dir = fs::is_directory(fattr);
|
|
||||||
|
|
||||||
if(!is_dir && _m_append_def_extension(tar))
|
|
||||||
{
|
|
||||||
//Add the extension, then check if it is a directory again.
|
|
||||||
fattr = fs::status(tar);
|
|
||||||
ftype = static_cast<fs::file_type>(fattr.type());
|
|
||||||
is_dir = fs::is_directory(fattr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_dir)
|
|
||||||
{
|
|
||||||
_m_load_cat_path(tar);
|
|
||||||
tb_file_.caption(std::string{});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode::write_file != mode_)
|
|
||||||
{
|
|
||||||
if(fs::file_type::not_found == ftype)
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption());
|
|
||||||
mb.icon(msgbox::icon_information);
|
|
||||||
if(mode::open_file == mode_)
|
|
||||||
mb << i18n("NANA_FILEBOX_ERROR_NOT_EXISTING_AND_RETRY", tar);
|
|
||||||
else
|
|
||||||
mb << i18n("NANA_FILEBOX_ERROR_DIRECTORY_NOT_EXISTING_AND_RETRY", tar);
|
|
||||||
mb();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(fs::file_type::not_found != ftype)
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption(), msgbox::yes_no);
|
|
||||||
mb.icon(msgbox::icon_question);
|
|
||||||
mb<<i18n("NANA_FILEBOX_ERROR_QUERY_REWRITE_BECAUSE_OF_EXISTING");
|
|
||||||
if(msgbox::pick_no == mb())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selection_.targets = {tar};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
internationalization i18n;
|
|
||||||
|
|
||||||
//the position of tar in targets
|
|
||||||
int tar_idx = -1;
|
|
||||||
|
|
||||||
//Check whether the selected files are valid.
|
|
||||||
for(auto tar : targets)
|
|
||||||
{
|
|
||||||
++tar_idx;
|
|
||||||
if(tar[0] == '.')
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption());
|
|
||||||
mb.icon(msgbox::icon_warning);
|
|
||||||
mb<<file<<std::endl<<i18n("NANA_FILEBOX_ERROR_INVALID_FILENAME");
|
|
||||||
mb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tar[0] != '/')
|
|
||||||
tar = addr_.filesystem + tar;
|
|
||||||
|
|
||||||
auto fattr = fs::status(tar);
|
|
||||||
auto ftype = static_cast<fs::file_type>(fattr.type());
|
|
||||||
|
|
||||||
//Check if the selected name is a directory
|
|
||||||
auto is_dir = fs::is_directory(fattr);
|
|
||||||
|
|
||||||
if(!is_dir && _m_append_def_extension(tar))
|
|
||||||
{
|
|
||||||
//Add the extension, then check if it is a directory again.
|
|
||||||
fattr = fs::status(tar);
|
|
||||||
ftype = static_cast<fs::file_type>(fattr.type());
|
|
||||||
is_dir = fs::is_directory(fattr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_dir)
|
|
||||||
{
|
|
||||||
//Enter the directory if this is the first tar.
|
|
||||||
if(0 == tar_idx)
|
|
||||||
{
|
|
||||||
_m_load_cat_path(tar);
|
|
||||||
tb_file_.caption(std::string{});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Other folders are ignored
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode::write_file != mode_)
|
|
||||||
{
|
|
||||||
if(fs::file_type::not_found == ftype)
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption());
|
|
||||||
mb.icon(msgbox::icon_information);
|
|
||||||
if(mode::open_file == mode_)
|
|
||||||
mb << i18n("NANA_FILEBOX_ERROR_NOT_EXISTING_AND_RETRY", tar);
|
|
||||||
else
|
|
||||||
mb << i18n("NANA_FILEBOX_ERROR_DIRECTORY_NOT_EXISTING_AND_RETRY", tar);
|
|
||||||
mb();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(fs::file_type::not_found != ftype)
|
|
||||||
{
|
|
||||||
msgbox mb(*this, caption(), msgbox::yes_no);
|
|
||||||
mb.icon(msgbox::icon_question);
|
|
||||||
mb<<i18n("NANA_FILEBOX_ERROR_QUERY_REWRITE_BECAUSE_OF_EXISTING");
|
|
||||||
if(msgbox::pick_no == mb())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selection_.targets.push_back(tar);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_m_finish(kind::filesystem);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void _m_tr_expand(item_proxy node, bool exp)
|
void _m_tr_expand(item_proxy node, bool exp)
|
||||||
{
|
{
|
||||||
if(false == exp) return;
|
if(false == exp) return;
|
||||||
@ -1505,9 +1256,6 @@ namespace nana
|
|||||||
{
|
{
|
||||||
kind::t type;
|
kind::t type;
|
||||||
std::vector<std::string> targets;
|
std::vector<std::string> targets;
|
||||||
#if 0
|
|
||||||
std::vector<std::string> delay_deselect;
|
|
||||||
#endif
|
|
||||||
bool is_deselect_delayed{ false };
|
bool is_deselect_delayed{ false };
|
||||||
}selection_;
|
}selection_;
|
||||||
|
|
||||||
|
@ -144,8 +144,6 @@ namespace nana
|
|||||||
const std::string&, nana::any*, bool reverse)> weak_ordering;
|
const std::string&, nana::any*, bool reverse)> weak_ordering;
|
||||||
|
|
||||||
std::shared_ptr<paint::font> font; ///< The exclusive column font
|
std::shared_ptr<paint::font> font; ///< The exclusive column font
|
||||||
|
|
||||||
column() = default;
|
|
||||||
|
|
||||||
column(const column&) = default;
|
column(const column&) = default;
|
||||||
|
|
||||||
@ -6186,10 +6184,9 @@ namespace nana
|
|||||||
const nana::any *rowval,
|
const nana::any *rowval,
|
||||||
bool reverse)> comp)
|
bool reverse)> comp)
|
||||||
{
|
{
|
||||||
if (first_col<0 || last_col<=first_col)
|
if (last_col <= first_col || last_col >= column_size())
|
||||||
return;
|
|
||||||
if (last_col >= column_size())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<size_type> new_idx;
|
std::vector<size_type> new_idx;
|
||||||
for(size_type i=first_col; i<=last_col; ++i) new_idx.push_back(i);
|
for(size_type i=first_col; i<=last_col; ++i) new_idx.push_back(i);
|
||||||
|
|
||||||
@ -6207,7 +6204,7 @@ namespace nana
|
|||||||
//Only change the view position of columns
|
//Only change the view position of columns
|
||||||
for(size_t i=0; i<new_idx.size(); ++i)
|
for(size_t i=0; i<new_idx.size(); ++i)
|
||||||
{
|
{
|
||||||
move_column(new_idx[i],i+first_col);
|
_m_ess().header.move_to_view_pos(new_idx[i], i + first_col, true);
|
||||||
}
|
}
|
||||||
_m_ess().update();
|
_m_ess().update();
|
||||||
}
|
}
|
||||||
|
@ -3382,7 +3382,6 @@ namespace nana {
|
|||||||
::nana::paint::graphics canvas;
|
::nana::paint::graphics canvas;
|
||||||
canvas.make({ px_w, px_h });
|
canvas.make({ px_w, px_h });
|
||||||
canvas.typeface(graph_.typeface());
|
canvas.typeface(graph_.typeface());
|
||||||
::nana::point canvas_text_pos;
|
|
||||||
|
|
||||||
auto ent_pos = pos;
|
auto ent_pos = pos;
|
||||||
const auto str_end = str + len;
|
const auto str_end = str + len;
|
||||||
|
@ -1370,17 +1370,9 @@ namespace nana
|
|||||||
{
|
{
|
||||||
auto m = std::max((enable_crook_ ? scheme_.crook_size : 0), (enable_icon_ ? scheme_.icon_size : 0));
|
auto m = std::max((enable_crook_ ? scheme_.crook_size : 0), (enable_icon_ ? scheme_.icon_size : 0));
|
||||||
|
|
||||||
#if 1
|
|
||||||
unsigned as = 0, ds = 0, il;
|
unsigned as = 0, ds = 0, il;
|
||||||
graph.text_metrics(as, ds, il);
|
graph.text_metrics(as, ds, il);
|
||||||
return std::max(as + ds + 8, m);
|
return std::max(as + ds + 8, m);
|
||||||
#else
|
|
||||||
#ifdef _nana_std_has_string_view
|
|
||||||
return std::max(m, graph.text_extent_size(std::wstring_view{ L"jH{", 3 }).height + 8);
|
|
||||||
#else
|
|
||||||
return std::max(m, graph.text_extent_size(L"jH{", 3).height + 8);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned item_width(graph_reference graph, const item_attribute_t& attr) const override
|
virtual unsigned item_width(graph_reference graph, const item_attribute_t& attr) const override
|
||||||
@ -1586,8 +1578,6 @@ namespace nana
|
|||||||
|
|
||||||
int trigger::item_locator::operator()(node_type &node, int affect)
|
int trigger::item_locator::operator()(node_type &node, int affect)
|
||||||
{
|
{
|
||||||
auto & node_desc = impl_->shape;
|
|
||||||
|
|
||||||
switch(affect)
|
switch(affect)
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0: break;
|
||||||
@ -1692,7 +1682,6 @@ namespace nana
|
|||||||
{
|
{
|
||||||
impl_->data.trigger_ptr = this;
|
impl_->data.trigger_ptr = this;
|
||||||
impl_->data.renderer = nana::pat::cloneable<renderer_interface>(internal_renderer());
|
impl_->data.renderer = nana::pat::cloneable<renderer_interface>(internal_renderer());
|
||||||
//impl_->data.comp_placer = nana::pat::cloneable<compset_placer_interface>(internal_placer()); //deprecated
|
|
||||||
|
|
||||||
impl_->adjust.timer.elapse([this]
|
impl_->adjust.timer.elapse([this]
|
||||||
{
|
{
|
||||||
@ -1827,18 +1816,6 @@ namespace nana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* //deprecated
|
|
||||||
void trigger::renderer(::nana::pat::cloneable<renderer_interface>&& r)
|
|
||||||
{
|
|
||||||
impl_->data.renderer = std::move(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
const ::nana::pat::cloneable<renderer_interface>& trigger::renderer() const
|
|
||||||
{
|
|
||||||
return impl_->data.renderer;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
::nana::pat::cloneable<renderer_interface>& trigger::renderer() const
|
::nana::pat::cloneable<renderer_interface>& trigger::renderer() const
|
||||||
{
|
{
|
||||||
return impl_->data.renderer;
|
return impl_->data.renderer;
|
||||||
@ -1876,21 +1853,6 @@ namespace nana
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
trigger::node_type* trigger::selected() const //deprecated
|
|
||||||
{
|
|
||||||
return impl_->node_state.selected;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
void trigger::selected(node_type* node) //deprecated
|
|
||||||
{
|
|
||||||
if(impl_->attr.tree_cont.verify(node) && impl_->set_selected(node))
|
|
||||||
impl_->draw(true);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
node_image_tag& trigger::icon(const std::string& id)
|
node_image_tag& trigger::icon(const std::string& id)
|
||||||
{
|
{
|
||||||
auto i = impl_->shape.image_table.find(id);
|
auto i = impl_->shape.image_table.find(id);
|
||||||
@ -1958,7 +1920,6 @@ namespace nana
|
|||||||
widget.bgcolor(colors::white);
|
widget.bgcolor(colors::white);
|
||||||
impl_->data.widget_ptr = static_cast<::nana::treebox*>(&widget);
|
impl_->data.widget_ptr = static_cast<::nana::treebox*>(&widget);
|
||||||
impl_->data.scheme_ptr = static_cast<::nana::treebox::scheme_type*>(API::dev::get_scheme(widget));
|
impl_->data.scheme_ptr = static_cast<::nana::treebox::scheme_type*>(API::dev::get_scheme(widget));
|
||||||
//impl_->data.comp_placer->init_scheme(impl_->data.scheme_ptr); //deprecated
|
|
||||||
impl_->data.comp_placer = nana::pat::cloneable<compset_placer_interface>(internal_placer{ *impl_->data.scheme_ptr });
|
impl_->data.comp_placer = nana::pat::cloneable<compset_placer_interface>(internal_placer{ *impl_->data.scheme_ptr });
|
||||||
|
|
||||||
widget.caption("nana treebox");
|
widget.caption("nana treebox");
|
||||||
@ -2386,7 +2347,6 @@ namespace nana
|
|||||||
|
|
||||||
treebox::item_proxy treebox::selected() const
|
treebox::item_proxy treebox::selected() const
|
||||||
{
|
{
|
||||||
//return item_proxy(const_cast<drawer_trigger_t*>(&get_drawer_trigger()), get_drawer_trigger().selected()); //deprecated
|
|
||||||
auto dw = &get_drawer_trigger();
|
auto dw = &get_drawer_trigger();
|
||||||
return item_proxy(const_cast<drawer_trigger_t*>(dw), dw->impl()->node_state.selected);
|
return item_proxy(const_cast<drawer_trigger_t*>(dw), dw->impl()->node_state.selected);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user