Skip to content

mcorino/wxRuby3-MaterialDesignArtProvider

Repository files navigation

License Gem Version Documentation

Material Design Art Provider for wxRuby3

This custom Art Provider was inspired by wxMaterialDesignArtProvider but rewritten in pure Ruby for use with wxRuby3.
See the License section below to see where the original icons were taken from.

screenshots

Installing

wxRuby3-MaterialDesignArtProvider is distributed as a Ruby gem on RubyGems. This gem can also be downloaded from the release assets on Github.

Installing the gem requires no additional installation steps and/or additional software to be installed except for a supported version of the Ruby interpreter. So the following command is all it takes to install:

gem install wxruby3-mdap

Using

To add Wx::MDAP::MaterialDesignArtProvider to your project you first need to require it like this:

require 'wx'        # make sure the wxRuby3 libraries have been loaded 
require 'wx/mdap'   # now load the wxRuby3-MaterialDesignArtProvider library

Next, before you load images through Wx::ArtProvider register the Wx::MDAP::MaterialDesignArtProvider like this:

Wx::ArtProvider.push(Wx::MDAP::MaterialDesignArtProvider.new)
# You can in fact normally also reference the class as `Wx::MaterialDesignArtProvider` (unless the constant 
# `Wx::MaterialDesignArtProvider` was already defined before requiring 'wx/mdap').

Now that the new art provider has been installed the new Material Design art ids can be used. Constants for these are all defined in the Wx::MDAP module as 'Wx::MDAP::ART_ICON_NAME' (see here). Many of these art ids are available under most of the various client ids (also defined here) while others are only available under some client ids (as can be seen in the documentation). The client ids each correspond to a different collection in the full dataset:

  • Material Design art
    • Wx::MDAP::ART_MATERIAL_DESIGN_FILLED
    • Wx::MDAP::ART_MATERIAL_DESIGN_OUTLINE
    • Wx::MDAP::ART_MATERIAL_DESIGN_ROUND
    • Wx::MDAP::ART_MATERIAL_DESIGN_SHARP
    • Wx::MDAP::ART_MATERIAL_DESIGN_TWO_TONE
  • Font Awesome art
    • Wx::MDAP::ART_FONT_AWESOME_SOLID
    • Wx::MDAP::ART_FONT_AWESOME_REGULAR
    • Wx::MDAP::ART_FONT_AWESOME_BRANDS
  • Fluent UI art
    • Wx::MDAP::ART_FLUENT_UI_FILLED
    • Wx::MDAP::ART_FLUENT_UI_REGULAR
  • Simple Icons art
    • Wx::MDAP::ART_SIMPLE_ICONS_ICONS

Of these collections, Wx::MDAP::ART_FONT_AWESOME_BRANDS and Wx::MDAP::ART_SIMPLE_ICONS_ICONS are the odd ones out as these do not contain any action/function icons but rather brand/logo icons.

Extensions

wxRuby3-MaterialDesignArtProvider offers several extensions to improve options for using the Material Design art:

  1. Wx::MDAP::MaterialDesignArtProvider supports mapping of standard wxRuby3 Art (Client) ids to Material Design ids so you can transparently switch standard art;
  2. Wx::MDAP::MaterialDesignArtProvider supports using custom colors with Material Design art;
  3. Wx::MDAP::MaterialDesignArtProvider supports using custom default sizes with Material Design art.

See Wx::MDAP::MaterialDesignArtProvider for details concerning these extensions.

Example

For more details and a working example of how to use Wx::MDAP::MaterialDesignArtProvider see here.

License

The wxRuby3 MaterialDesignArtProvider library itself is released under the MIT License.