.. index:: pair: class; EE::UI::UISystemIconTheme .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme: class EE::UI::UISystemIconTheme =============================== .. toctree:: :hidden: struct_EE_UI_UISystemIconTheme_Request.rst Overview ~~~~~~~~ Icons provided by the platform, loaded asynchronously. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class UISystemIconTheme: public std::enable_shared_from_this< UISystemIconTheme > { public: // structs struct :ref:`Request`; // construction :target:`~UISystemIconTheme`(); // methods static std::shared_ptr :ref:`New`(:ref:`Executor`& worker, :ref:`Executor`& ui, const std::string& themeName = {}); :ref:`UIIcon`* :ref:`getIcon`(const std::vector& names, :ref:`UIIcon`* fallback = nullptr); :ref:`UIIcon`* :ref:`getFileIcon`(const std::string& fileName, bool isDirectory, const std::vector& names, :ref:`UIIcon`* fallback = nullptr); :ref:`UIIcon`* :ref:`getPathIcon`(const std::string& path, const std::vector& names, :ref:`UIIcon`* fallback = nullptr); const std::string& :ref:`getThemeName`() const; void :ref:`setOnIconsLoaded`(std::function callback); }; .. _details-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Icons provided by the platform, loaded asynchronously. * Linux and BSD: the user's freedesktop.org icon theme (Icon Theme Specification). * Windows: the shell's icons (file types, special folders and stock icons). * macOS: NSWorkspace icons. Icons are returned immediately. Finding, reading and rasterizing them happens on the worker executor; until an icon's image is ready it shows its fallback icon (or nothing). Textures are created on the :ref:`UI ` executor, which then calls the icons-loaded callback so views can redraw. Loaded icons are cached for the life of the theme. Both executors must outlive the work they were given (shut the worker down first, as a ThreadPool member declared after the :ref:`UI ` executor does). Methods are :ref:`UI ` thread only. Methods ------- .. index:: pair: function; New .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1a187321f094a114ee29b7facbb4baf08e: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::shared_ptr New(:ref:`Executor`& worker, :ref:`Executor`& ui, const std::string& themeName = {}) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - worker - Where lookups, file reads and rasterization run (e.g. a ThreadPool). * - ui - The thread that owns the graphics context (e.g. a MainThreadExecutor). * - themeName - Freedesktop theme to use; empty detects the user's (Linux and BSD only). Detection and indexing start right away on the worker. .. index:: pair: function; getIcon .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1a98b7130175ec78347ff9cbfc6f513925: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIIcon`* getIcon(const std::vector& names, :ref:`UIIcon`* fallback = nullptr) Icon for standard (freedesktop) icon names, tried in order: "folder", "user-home", "folder-documents", "user-trash", "drive-harddisk", "drive-removable-media", "network-server", "text-x-generic"... Windows and macOS map these names to their own special folder and stock icons. The returned icon is owned by the theme. .. index:: pair: function; getFileIcon .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1af1342dc37a2c1ef0049e426faa5baea5: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIIcon`* getFileIcon(const std::string& fileName, bool isDirectory, const std::vector& names, :ref:`UIIcon`* fallback = nullptr) Icon for a file or folder type. On Linux and BSD names are the freedesktop names of its MIME type (most specific first); Windows and macOS use the type of the file name's extension. .. index:: pair: function; getPathIcon .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1a701a8bf7701f41b3e09654528d3ee863: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`UIIcon`* getPathIcon(const std::string& path, const std::vector& names, :ref:`UIIcon`* fallback = nullptr) Icon of a local path as the platform shows it (special folders, drives): Windows and macOS ask the shell for that path; Linux and BSD use names. .. index:: pair: function; getThemeName .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1a68273b2abeb60014aba5bc1158c1ea9c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getThemeName() const The freedesktop theme in use, once detected (empty before, and on Windows and macOS). .. index:: pair: function; setOnIconsLoaded .. _doxid-class_e_e_1_1_u_i_1_1_u_i_system_icon_theme_1a6f1416efcc91f7144e3e5be0b147ade2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setOnIconsLoaded(std::function callback) Called on the :ref:`UI ` thread after icons received images (coalesced): redraw the views that show them.