xtd 1.0.0
Loading...
Searching...
No Matches
cursor.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../forms_export.hpp"
6#include <xtd/drawing/bitmap>
7#include <xtd/drawing/point>
8#include <xtd/drawing/size>
9#include <xtd/any>
10#include <xtd/iequatable>
11#include <xtd/object>
12#include <cstdint>
13#include <memory>
14
16namespace xtd {
18 namespace forms {
20 class cursors;
22
40 class forms_export_ cursor : public xtd::object, public xtd::iequatable<cursor> {
41 struct data;
42
43 public:
45
48 static cursor none;
50
52
59 explicit cursor(intptr handle);
61
63 cursor(const cursor& value) = default;
64 auto operator =(const cursor& value) -> cursor& = default;
65 ~cursor();
67
69
74 [[nodiscard]] auto handle() const noexcept -> xtd::intptr;
75
79 [[nodiscard]] auto hot_spot() const noexcept -> xtd::drawing::point;
80
83 [[nodiscard]] auto size() const noexcept -> xtd::drawing::size;
84
88 [[nodiscard]] auto tag() const noexcept -> const xtd::any_object&;
89
93 auto tag(xtd::any_object value) -> cursor&;
95
97
102 [[nodiscard]] static auto current() -> cursor;
106 static auto current(const cursor& cursor) -> void;
107
111 [[nodiscard]] static auto position() -> xtd::drawing::point;
115 static auto position(const xtd::drawing::point& position) -> void;
117
119
124 [[nodiscard]] auto copy_handle() const -> xtd::intptr;
125
129 [[nodiscard]] auto equals(const xtd::object& obj) const noexcept -> bool override;
133 [[nodiscard]] bool equals(const cursor& value) const noexcept override;
134
137 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override;
138
141 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
143
145
151 [[nodiscard]] static cursor from_bitmap(const xtd::drawing::bitmap& bitmap, const xtd::drawing::point& hot_spot);
156 [[nodiscard]] static cursor from_bitmap(const xtd::drawing::bitmap& bitmap);
157
160 static void hide();
161
164 static void show();
166
167 private:
168 friend class xtd::forms::cursors;
169 cursor(const xtd::drawing::bitmap& bitmap, const xtd::drawing::point& hot_spot);
170 cursor(xtd::intptr handle, bool destroyable, const xtd::string& name);
171
172 xtd::sptr<data> data_;
173 };
174 }
175}
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
static auto current() -> cursor
Gets a cursor object that represents the mouse cursor.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
auto copy_handle() const -> xtd::intptr
Copies the handle of this cursor.
cursor()
Initializes a new instance of the cursor class.
static void show()
Displays the cursor.
static auto position() -> xtd::drawing::point
Gets the cursor's position.
auto to_string() const noexcept -> xtd::string override
Returns a string containing the name of the cursor.
cursor(intptr handle)
Initializes a new instance of the Cursor class from the specified Windows handle.
auto hot_spot() const noexcept -> xtd::drawing::point
Gets the cursor hot spot.
static void hide()
Hides the cursor.
auto size() const noexcept -> xtd::drawing::size
Gets the size of the cursor object.
static cursor none
Represent none cursor.
Definition cursor.hpp:48
auto tag() const noexcept -> const xtd::any_object &
Gets the object that contains data about the control.
auto equals(const xtd::object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
static cursor from_bitmap(const xtd::drawing::bitmap &bitmap, const xtd::drawing::point &hot_spot)
Create a cursor form a specified bitmap with specified hot spot.
auto handle() const noexcept -> xtd::intptr
Gets the handle of the cursor.
Provides a collection of xtd::forms::cursor objects for use by a Windows Forms application.
Definition cursors.hpp:25
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains forms_export_ keyword.
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197