spek

Acoustic spectrum analyser https://github.com/alexkay/spek spek.cc
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

spek-artwork.cc (2526B)


      1 #include <wx/artprov.h>
      2 #include <wx/iconbndl.h>
      3 
      4 #include "spek-artwork.h"
      5 
      6 class SpekArtProvider : public wxArtProvider
      7 {
      8 protected:
      9     virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size);
     10     virtual wxIconBundle CreateIconBundle(const wxArtID& id, const wxArtClient& client);
     11 };
     12 
     13 wxBitmap SpekArtProvider::CreateBitmap(
     14     const wxArtID& id, const wxArtClient& client, const wxSize& size)
     15 {
     16 #ifdef OS_UNIX
     17     if (id == ART_SPEK) {
     18         return wxArtProvider::GetBitmap("spek", client, size);
     19     }
     20     if (id == ART_HELP) {
     21         return wxArtProvider::GetBitmap("gtk-help", client, size);
     22     }
     23     if (id == ART_OPEN) {
     24         return wxArtProvider::GetBitmap("gtk-open", client, size);
     25     }
     26     if (id == ART_SAVE) {
     27         return wxArtProvider::GetBitmap("gtk-save", client, size);
     28     }
     29     if (id == ART_CLOSE) {
     30         return wxArtProvider::GetBitmap("gtk-close", client, size);
     31     }
     32 #endif
     33 #ifdef OS_WIN
     34     if (id == ART_HELP) {
     35         return wxIcon("help", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
     36     }
     37     if (id == ART_OPEN) {
     38         return wxIcon("open", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
     39     }
     40     if (id == ART_SAVE) {
     41         return wxIcon("save", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
     42     }
     43     if (id == ART_CLOSE) {
     44         return wxIcon("close", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
     45     }
     46 #endif
     47 #ifdef OS_OSX
     48     if (id == ART_HELP) {
     49         return wxBitmap("help", wxBITMAP_TYPE_PNG_RESOURCE);
     50     }
     51     if (id == ART_OPEN) {
     52         return wxBitmap("open", wxBITMAP_TYPE_PNG_RESOURCE);
     53     }
     54     if (id == ART_SAVE) {
     55         return wxBitmap("save", wxBITMAP_TYPE_PNG_RESOURCE);
     56     }
     57     if (id == ART_CLOSE) {
     58         return wxBitmap("close", wxBITMAP_TYPE_PNG_RESOURCE);
     59     }
     60 #endif
     61     return wxNullBitmap;
     62 }
     63 
     64 wxIconBundle SpekArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient& client)
     65 {
     66 #ifdef OS_UNIX
     67     if (id == ART_SPEK) {
     68         return wxArtProvider::GetIconBundle("spek", client);
     69     }
     70 #endif
     71 #ifdef OS_WIN
     72     if (id == ART_SPEK) {
     73         wxIconBundle bundle;
     74         bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16));
     75         bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24));
     76         bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 32, 32));
     77         bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 48, 48));
     78         return bundle;
     79     }
     80 #endif
     81     return wxNullIconBundle;
     82 }
     83 
     84 void spek_artwork_init()
     85 {
     86     wxArtProvider::Push(new SpekArtProvider());
     87 }