xtd 0.2.0
Loading...
Searching...
No Matches
mouse_events.cpp

demonstrates some events received by form.

Windows

macOS

Gnome

#define TRACE
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/trace_form>
#include <xtd/diagnostics/trace>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object & sender, const mouse_event_args & e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
auto main() -> int {
application::run(form1 {});
}
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition trace.h:343
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:34
Represents a form that displays trace form. This class cannot be inherited.
Definition trace_form.h:36
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10