xtd 0.2.0
mouse_event_args.h
Go to the documentation of this file.
1 #pragma once
5 #include "message.h"
6 #include "mouse_buttons.h"
7 #include <xtd/drawing/point>
8 #include <xtd/event_args>
9 #include <cstdint>
10 
12 namespace xtd {
14  namespace forms {
16  class button;
17  class control;
18  class check_box;
19  class light_button;
20  class radio_button;
21  class toggle_button;
23 
32  class forms_export_ mouse_event_args : public event_args {
33  public:
35 
38  mouse_event_args() = default;
45  mouse_event_args(mouse_buttons button, int32 clicks, int32 x, int32 y, int32 delta) : button_(button), location_(x, y), clicks_(clicks), delta_(delta) {}
51  mouse_event_args(mouse_buttons button, int32 clicks, const drawing::point& location, int32 delta) : button_(button), location_(location), clicks_(clicks), delta_(delta) {}
53 
56  mouse_event_args& operator =(const mouse_event_args& mouse_event_args) = default;
58 
60 
64  mouse_buttons button() const noexcept {return button_;}
65 
68  int32 clicks() const noexcept {return clicks_;}
69 
72  int32 delta() const noexcept {return delta_;}
73 
76  const drawing::point& location() const noexcept {return location_;}
77 
80  int32 x() const noexcept {return location().x();}
81 
84  int32 y() const noexcept {return location().y();}
86 
87  private:
88  friend class button;
89  friend class control;
90  friend class check_box;
91  friend class light_button;
92  friend class radio_button;
93  friend class toggle_button;
94  static mouse_event_args create(const message& message, bool double_click_fired = false, int32 delta = 0);
96  drawing::point location_;
97  int32 clicks_ = 0;
98  int32 delta_ = 0;
99  };
100  }
101 }
int32 clicks() const noexcept
Gets the number of times the mouse button was pressed and released.
Definition: mouse_event_args.h:68
mouse_buttons button() const noexcept
Gets which mouse button was pressed.
Definition: mouse_event_args.h:64
mouse_buttons
Specifies constants that define which mouse button was pressed. This enumeration has a flag attribute...
Definition: mouse_buttons.h:20
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
xtd::forms::style_sheets::control button
The buttton data allows you to specify the box of a button control.
Definition: button.h:23
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
mouse_event_args(mouse_buttons button, int32 clicks, int32 x, int32 y, int32 delta)
Initializes a new instance of the MouseEventArgs class.
Definition: mouse_event_args.h:45
int32 delta() const noexcept
Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DEL...
Definition: mouse_event_args.h:72
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
const drawing::point & location() const noexcept
Gets the location of the mouse during the generating mouse event.
Definition: mouse_event_args.h:76
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition: radio_button.h:38
Contains xtd::forms::message class.
mouse_event_args(mouse_buttons button, int32 clicks, const drawing::point &location, int32 delta)
Initializes a new instance of the MouseEventArgs class.
Definition: mouse_event_args.h:51
Specifies that the left edge of the control is defined.
Represents a Windows light_button.
Definition: light_button.h:43
No mouse button was pressed.
Contains xtd::forms::mouse_buttons enum class.
Implements a Windows message.
Definition: message.h:26
xtd::forms::style_sheets::control toggle_button
The buttton data allows you to specify the box of a toggle_button control.
Definition: toggle_button.h:23
int32 y() const noexcept
Gets the y-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:84
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Represents a Windows check_box.
Definition: check_box.h:43
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
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:32
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.
Represents a Windows button control.
Definition: button.h:47
Represents a Windows toggle_button.
Definition: toggle_button.h:42
int32 x() const noexcept
Gets the x-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:80
The left or right CTRL modifier key.