Merge branch 'besh81-hotfix-1.6.2' into hotfix-1.6.2
This commit is contained in:
commit
f49a2e1e44
@ -35,6 +35,19 @@ namespace nana
|
||||
{}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct arg_tabbar_adding
|
||||
: public event_arg
|
||||
{
|
||||
arg_tabbar_adding(tabbar<T>& wdg, std::size_t pos)
|
||||
: widget(wdg), where(pos)
|
||||
{}
|
||||
|
||||
tabbar<T> & widget;
|
||||
mutable bool add = true; ///< determines whether to add the item
|
||||
std::size_t where; ///< position where to add the item
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct arg_tabbar_removed : public arg_tabbar<T>
|
||||
{
|
||||
@ -56,6 +69,7 @@ namespace nana
|
||||
{
|
||||
using value_type = T;
|
||||
|
||||
basic_event<arg_tabbar_adding<value_type>> adding;
|
||||
basic_event<arg_tabbar<value_type>> added;
|
||||
basic_event<arg_tabbar<value_type>> activated;
|
||||
basic_event<arg_tabbar_removed<value_type>> removed;
|
||||
@ -65,6 +79,7 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
virtual ~event_agent_interface() = default;
|
||||
virtual bool adding(std::size_t) = 0;
|
||||
virtual void added(std::size_t) = 0;
|
||||
virtual void activated(std::size_t) = 0;
|
||||
virtual bool removed(std::size_t, bool & close_attached) = 0;
|
||||
@ -107,6 +122,13 @@ namespace nana
|
||||
: tabbar_(tb), drawer_trigger_(dtr)
|
||||
{}
|
||||
|
||||
bool adding(std::size_t pos) override
|
||||
{
|
||||
::nana::arg_tabbar_adding<T> arg(tabbar_, pos);
|
||||
tabbar_.events().adding.emit(arg, tabbar_);
|
||||
return arg.add;
|
||||
}
|
||||
|
||||
void added(std::size_t pos) override
|
||||
{
|
||||
if(pos != npos)
|
||||
|
@ -1257,7 +1257,7 @@ namespace nana
|
||||
IShellItem *init_path{ nullptr };
|
||||
hr = SHCreateItemFromParsingName(impl_->init_path.wstring().c_str(), nullptr, IID_PPV_ARGS(&init_path));
|
||||
if (SUCCEEDED(hr))
|
||||
fd->SetDefaultFolder(init_path);
|
||||
fd->SetFolder(init_path);
|
||||
|
||||
fd->SetOptions(FOS_PICKFOLDERS);
|
||||
fd->Show(reinterpret_cast<HWND>(API::root(impl_->owner))); // the native handle of the parent nana form goes here
|
||||
|
@ -751,15 +751,27 @@ namespace nana
|
||||
if((pos == npos) || (pos >= list_.size()))
|
||||
{
|
||||
pos = list_.size();
|
||||
|
||||
if(evt_agent_)
|
||||
if(!evt_agent_->adding(pos))
|
||||
return false;
|
||||
|
||||
this->list_.emplace_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(evt_agent_)
|
||||
if(!evt_agent_->adding(pos))
|
||||
return false;
|
||||
|
||||
list_.emplace(iterator_at(pos));
|
||||
}
|
||||
|
||||
basis_.active = pos;
|
||||
if(evt_agent_)
|
||||
{
|
||||
evt_agent_->added(pos);
|
||||
erase(pos);
|
||||
evt_agent_->activated(pos);
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user