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.
icon.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <memory>
7 #include <xtd/object.h>
8 #include <xtd/ustring.h>
9 #include "../drawing_export.h"
10 #include "bitmap.h"
11 
13 namespace xtd {
15  namespace drawing {
22  class drawing_export_ icon : public object {
23  public:
24  icon() = default;
25  ~icon();
26 
27  explicit icon(const xtd::ustring& filename);
28 
29  explicit icon(std::istream& stream);
30 
31  explicit icon(const char* const* bits);
32 
33  icon(const icon& icon, int32_t width, int32_t height);
34 
36  icon(const icon& icon) = default;
37  icon& operator=(const icon& icon) = default;
38  bool operator==(const icon& icon) const {return data_->handle_ == icon.data_->handle_;}
39  bool operator!=(const icon& icon) const {return !operator==(icon);}
41 
44  intptr_t handle() const {return data_->handle_;}
45 
46  static icon empty;
47 
48  void save(const xtd::ustring& filename) const;
49  void save(std::ostream& stream) const;
50 
51  static icon from_bitmap(const bitmap& bitmap);
52 
53  bitmap to_bitmap() const;
54 
55  private:
56  explicit icon(const bitmap& bitmap);
57  struct data {
58  intptr_t handle_ = 0;
59  };
60 
61  std::shared_ptr<data> data_ = std::make_shared<data>();
62  };
63  }
64 }
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:50
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes...
Definition: bitmap.h:19
Contains xtd::ustring class.
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
Contains xtd::drawing::bitmap class.
intptr_t handle() const
Get the handle of this image.
Definition: icon.h:44
Represents a Windows icon, which is a small bitmap image that is used to represent an object...
Definition: icon.h:22