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.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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:
22  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;
23  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("arrow{}.png", get_os_postfix())));
24  return bitmap;
25  }
26 
29  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;
30  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "cursors", xtd::ustring::format("cursor_no_move_2d{}.png", get_os_postfix())));
31  return bitmap;
32  }
33 
35  static const xtd::drawing::bitmap& gammasoft() {
36  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "gammasoft.png"))) return xtd::drawing::bitmap::empty;
37  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "gammasoft.png"));
38  return bitmap;
39  }
40 
42  static const xtd::drawing::bitmap& xtd() {
43  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd.png"))) return xtd::drawing::bitmap::empty;
44  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd.png"));
45  return bitmap;
46  }
47 
50  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_console.png"))) return xtd::drawing::bitmap::empty;
51  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_console.png"));
52  return bitmap;
53  }
54 
56  static const xtd::drawing::bitmap& xtd_forms() {
57  if (!xtd::io::file::exists(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_forms.png"))) return xtd::drawing::bitmap::empty;
58  static xtd::drawing::bitmap bitmap(xtd::io::path::combine(forms_resource_path_, "pictures", "xtd_forms.png"));
59  return bitmap;
60  }
61 
62  private:
63  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" : "";}
64 #if defined(__XTD_RESOURCES_PATH__)
65  static constexpr const char* forms_resource_path_ = __XTD_RESOURCES_PATH__;
66 #else
67  static constexpr const char* forms_resource_path_ = "";
68 #endif
69  };
70  }
71 }
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition: bitmap.h:19
static bitmap empty
Represent an empty bitmap.
Definition: bitmap.h:75
static xtd::operating_system os_version()
Gets an operating_system object that contains the current platform identifier and version number.
A strongly-typed resource class, for looking up localized strings, etc.
Definition: resources.h:18
static const xtd::drawing::bitmap & cursor_no_move_2d()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:28
static const xtd::drawing::bitmap & gammasoft()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:35
static const xtd::drawing::bitmap & xtd()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:42
static const xtd::drawing::bitmap & xtd_console()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:49
static const xtd::drawing::bitmap & xtd_forms()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:56
static const xtd::drawing::bitmap & cursor_arrow()
Looks up a localized resource of type xtd::drawing::bitmap.
Definition: resources.h:21
static bool exists(const xtd::ustring &path) noexcept
Determines whether the specified file exists.
static xtd::ustring combine(const xtd::ustring &path1, const xtd::ustring &path2)
Combines two path strings.
bool is_linux_platform() const noexcept
Determines whether the current platform is Unix family.
Definition: operating_system.h:82
bool is_macos_platform() const noexcept
Determines whether the current platform is macOS family.
Definition: operating_system.h:78
bool is_windows_platform() const noexcept
Determines whether the current platform is Windows family.
Definition: operating_system.h:86
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:689
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17