xtd 0.2.0
cursor.h
Go to the documentation of this file.
1 #pragma once
5 #include "../forms_export.h"
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 
16 namespace xtd {
18  namespace forms {
20  class cursors;
22 
38  class forms_export_ cursor : public object, public xtd::iequatable<cursor> {
39  struct data;
40 
41  public:
43 
46  static cursor none;
48 
50 
53  cursor();
57  explicit cursor(intptr handle);
59 
61  cursor(const cursor& value) = default;
62  cursor& operator =(const cursor& value) = default;
63  ~cursor();
65 
69  static xtd::forms::cursor current();
73  static void current(const xtd::forms::cursor& cursor);
74 
78  intptr handle() const noexcept;
79 
83  drawing::point hot_spot() const noexcept;
84 
88  static drawing::point position();
92  static void position(const drawing::point& position);
93 
96  drawing::size size() const noexcept;
97 
101  std::any tag() const noexcept;
102 
106  void tag(std::any tag);
108 
110 
115  intptr copy_handle() const;
116 
117  bool equals(const cursor& value) const noexcept override;
118 
123  static cursor from_bitmap(const xtd::drawing::bitmap& bitmap, const xtd::drawing::point& hot_spot);
128  static cursor from_bitmap(const xtd::drawing::bitmap& bitmap);
129 
132  static void hide();
133 
136  static void show();
137 
140  xtd::ustring to_string() const noexcept override;
142 
143  private:
144  friend class xtd::forms::cursors;
145  cursor(const xtd::drawing::bitmap& bitmap, const xtd::drawing::point& hot_spot);
146  cursor(intptr handle, bool destroyable, const xtd::ustring& name);
147 
148  std::shared_ptr<data> data_;
149  };
150  }
151 }
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Represents the image used to paint the mouse pointer.
Definition: cursor.h:38
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
Provides a collection of xtd::forms::cursor objects for use by a Windows Forms application.
Definition: cursors.h:23
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Hides minimized windows by moving them off the visible area of the screen.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static cursor none
Represent none cursor.
Definition: cursor.h:46
size_t size
Represents a size of any object in bytes.
Definition: types.h:195