xtd - Reference Guide  0.1.1
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 
30  public:
32  mouse_event_args() = default;
39  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) {}
45  mouse_event_args(mouse_buttons button, int32_t clicks, const drawing::point& location, int32_t delta) : button_(button), location_(location), clicks_(clicks), delta_(delta) {}
46 
49  mouse_event_args& operator=(const mouse_event_args& mouse_event_args) = default;
51 
54  mouse_buttons button() const {return button_;}
55 
58  int32_t clicks() const {return clicks_;}
59 
62  int32_t delta() const {return delta_;}
63 
66  const drawing::point& location() const {return location_;}
67 
70  int32_t x() const {return location().x();}
71 
74  int32_t y() const {return location().y();}
75 
76  private:
77  friend class button;
78  friend class control;
79  friend class check_box;
80  friend class radio_button;
81  friend class toggle_button;
82  static mouse_event_args create(const message& message, bool double_click_fired = false, int32_t delta = 0);
84  drawing::point location_;
85  int32_t clicks_ = 0;
86  int32_t delta_ = 0;
87  };
88  }
89 }
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:48
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents a Windows button control.
Definition: button.h:54
Represents a Windows check_box.
Definition: check_box.h:52
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Implements a Windows message.
Definition: message.h:25
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition: mouse_event_args.h:29
int32_t clicks() const
Gets the number of times the mouse button was pressed and released.
Definition: mouse_event_args.h:58
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:62
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:45
mouse_buttons button() const
Gets which mouse button was pressed.
Definition: mouse_event_args.h:54
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:39
const drawing::point & location() const
Gets the location of the mouse during the generating mouse event.
Definition: mouse_event_args.h:66
mouse_event_args()=default
Initializes a new instance of the MouseEventArgs class.
int32_t y() const
Gets the y-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:74
int32_t x() const
Gets the x-coordinate of the mouse during the generating mouse event.
Definition: mouse_event_args.h:70
Enables the user to select a single option from a group of choices when paired with other xtd::forms:...
Definition: radio_button.h:26
Represents a Windows toggle_button.
Definition: toggle_button.h:30
Contains xtd::event_args event args.
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
@ control
The left or right CTRL modifier key.
@ y
The Y key.
@ x
The X key.
mouse_buttons
Specifies constants that define which mouse button was pressed. This enumeration has a flag attribute...
Definition: mouse_buttons.h:18
@ location
Specifies that both the x and y coordinates of the control are defined.
@ none
No mouse button was pressed.
@ button
The appearance of a button.
Contains xtd::forms::message class.
Contains xtd::forms::mouse_buttons enum class.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::drawing::point class.