xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
mouse_event_args.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <xtd/event_args.h>
7 #include <xtd/drawing/point.h>
8 #include "message.h"
9 #include "mouse_buttons.h"
10 
12 namespace xtd {
14  namespace forms {
16  class button;
17  class control;
18  class check_box;
19  class radio_button;
20  class toggle_button;
22 
29  class forms_export_ mouse_event_args : public event_args {
30  public:
32 
35  mouse_event_args() = default;
42  mouse_event_args(mouse_buttons button, int32_t clicks, int32_t x, int32_t y, int32_t delta) : button_(button), location_(x, y), clicks_(clicks), delta_(delta) {}
48  mouse_event_args(mouse_buttons button, int32_t clicks, const drawing::point& location, int32_t delta) : button_(button), location_(location), clicks_(clicks), delta_(delta) {}
50 
53  mouse_event_args& operator=(const mouse_event_args& mouse_event_args) = default;
55 
57 
61  mouse_buttons button() const {return button_;}
62 
65  int32_t clicks() const {return clicks_;}
66 
69  int32_t delta() const {return delta_;}
70 
73  const drawing::point& location() const {return location_;}
74 
77  int32_t x() const {return location().x();}
78 
81  int32_t y() const {return location().y();}
83 
84  private:
85  friend class button;
86  friend class control;
87  friend class check_box;
88  friend class radio_button;
89  friend class toggle_button;
90  static mouse_event_args create(const message& message, bool double_click_fired = false, int32_t delta = 0);
92  drawing::point location_;
93  int32_t clicks_ = 0;
94  int32_t delta_ = 0;
95  };
96  }
97 }
Contains xtd::event_args event args.
int32_t x() const
Gets the x-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:77
mouse_buttons
Specifies constants that define which mouse button was pressed. This enumeration has a flag attribute...
Definition: mouse_buttons.h:18
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The appearance of a button.
mouse_event_args(mouse_buttons button, int32_t clicks, const drawing::point &location, int32_t delta)
Initializes a new instance of the MouseEventArgs class.
Definition: mouse_event_args.h:48
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:48
Contains xtd::drawing::point class.
Specifies that the top edge of the control is defined.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
int32_t clicks() const
Gets the number of times the mouse button was pressed and released.
Definition: mouse_event_args.h:65
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition: radio_button.h:26
Contains xtd::forms::message class.
Specifies that the left edge of the control is defined.
No mouse button was pressed.
const drawing::point & location() const
Gets the location of the mouse during the generating mouse event.
Definition: mouse_event_args.h:73
Contains xtd::forms::mouse_buttons enum class.
int32_t delta() const
Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DEL...
Definition: mouse_event_args.h:69
Implements a Windows message.
Definition: message.h:25
Defines the base class for controls, which are components with visual representation.
Definition: control.h:68
Represents a Windows check_box.
Definition: check_box.h:52
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down, and xtd::forms::control::mouse_move events.
Definition: mouse_event_args.h:29
mouse_buttons button() const
Gets which mouse button was pressed.
Definition: mouse_event_args.h:61
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Specifies that both the x and y coordinates of the control are defined.
int32_t y() const
Gets the y-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:81
Represents a Windows button control.
Definition: button.h:54
Represents a Windows toggle_button.
Definition: toggle_button.h:30
The left or right CTRL modifier key.
mouse_event_args(mouse_buttons button, int32_t clicks, int32_t x, int32_t y, int32_t delta)
Initializes a new instance of the MouseEventArgs class.
Definition: mouse_event_args.h:42