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.
resources.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/environment.h>
6 #include "../control.h"
7 
9 namespace xtd {
11  namespace forms::properties {
18  class resources final static_ {
19  public:
21 
25  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("arrow{}.png", get_os_postfix())))) return xtd::drawing::bitmap::empty;
26  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("arrow{}.png", get_os_postfix())));
27  return bitmap;
28  }
29 
32  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("cursor_no_move_2d{}.png", get_os_postfix())))) return xtd::drawing::bitmap::empty;
33  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("cursor_no_move_2d{}.png", get_os_postfix())));
34  return bitmap;
35  }
36 
38  static const xtd::drawing::bitmap& gammasoft() {
39  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "gammasoft.png"))) return xtd::drawing::bitmap::empty;
40  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "gammasoft.png"));
41  return bitmap;
42  }
43 
45  static const xtd::drawing::bitmap& xtd() {
46  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd.png"))) return xtd::drawing::bitmap::empty;
47  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd.png"));
48  return bitmap;
49  }
50 
53  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_console.png"))) return xtd::drawing::bitmap::empty;
54  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_console.png"));
55  return bitmap;
56  }
57 
59  static const xtd::drawing::bitmap& xtd_forms() {
60  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_forms.png"))) return xtd::drawing::bitmap::empty;
61  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_forms.png"));
62  return bitmap;
63  }
65 
66  private:
67  static std::string get_os_postfix() noexcept {return xtd::environment::os_version().is_windows_platform() ? "_w" : xtd::environment::os_version().is_linux_platform() ? "_g" : xtd::environment::os_version().is_macos_platform() ? "_m" : "";}
68  static constexpr const char* forms_resource_path_ = __XTD_RESOURCES_PATH__;
69  };
70  }
71 }
static const xtd::drawing::bitmap & gammasoft()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:38
static const xtd::drawing::bitmap & cursor_arrow()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:24
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
static xtd::operating_system os_version()
Gets an operating_system object that contains the current platform identifier and version number...
static const xtd::drawing::bitmap & xtd_forms()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:59
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
bool is_windows_platform() const noexcept
Determines whether the current platform is Windows family.
Definition: operating_system.h:158
A strongly-typed resource class, for looking up localized strings, etc.
Definition: resources.h:18
bool is_macos_platform() const noexcept
Determines whether the current platform is macOS family.
Definition: operating_system.h:134
bool is_linux_platform() const noexcept
Determines whether the current platform is Unix family.
Definition: operating_system.h:142
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes...
Definition: bitmap.h:19
static bool exists(const xtd::ustring &path) noexcept
Determines whether the specified file exists.
static const xtd::drawing::bitmap & xtd()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:45
Contains xtd::environment class.
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:708
static const xtd::drawing::bitmap & xtd_console()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:52
static xtd::ustring combine(const xtd::ustring &path1, const xtd::ustring &path2)
Combines two path strings.
static bitmap empty
Represent an empty bitmap.
Definition: bitmap.h:25
static const xtd::drawing::bitmap & cursor_no_move_2d()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:31