libfilezilla
Toggle main menu visibility
Loading...
Searching...
No Matches
lib
libfilezilla
glue
wxinvoker.hpp
Go to the documentation of this file.
1
#ifndef LIBFILEZILLA_GLUE_WXINVOKER_HEADER
2
#define LIBFILEZILLA_GLUE_WXINVOKER_HEADER
3
7
8
#include "
../invoker.hpp
"
9
10
#include <wx/event.h>
11
12
namespace
fz
{
13
15
template
<
typename
... Args>
16
std::function<void(Args...)> do_make_invoker(wxEvtHandler& handler, std::function<
void
(Args...)> && f)
17
{
18
return
[&handler, cf = f](Args&&... args)
mutable
{
19
auto
cb = [cf, targs = std::make_tuple(std::forward<Args>(args)...)] {
20
std::apply(cf, targs);
21
};
22
handler.CallAfter(cb);
23
};
24
}
25
27
template
<
typename
F>
28
auto
make_invoker
(wxEvtHandler& handler, F && f)
29
{
30
return
do_make_invoker(handler,
decltype
(get_func_type(&F::operator()))(std::forward<F>(f)));
31
}
32
34
inline
invoker_factory
get_invoker_factory
(wxEvtHandler& handler)
35
{
36
return
[&handler](std::function<void()>
const
& cb)
mutable
{
37
handler.CallAfter(cb);
38
};
39
}
40
41
}
42
43
#endif
invoker.hpp
Declares fz::make_invoker and assorted machinery.
fz
The namespace used by libfilezilla.
Definition
apply.hpp:17
fz::get_invoker_factory
invoker_factory get_invoker_factory(event_loop &loop)
Creates an invoker factory.
fz::make_invoker
auto make_invoker(event_loop &loop, F &&f)
Wraps the passed function, so that it is always invoked in the context of the loop.
Definition
invoker.hpp:54
Generated by
1.17.0