mirror of
https://github.com/alexkay/spek.git
synced 2025-04-15 08:10:33 +03:00
Set window icon
This commit is contained in:
parent
eb3b69f63f
commit
a318529ecd
@ -1,6 +1,8 @@
|
||||
bin_PROGRAMS = spek
|
||||
|
||||
spek_SOURCES = \
|
||||
spek-artwork.hh \
|
||||
spek-artwork.cc \
|
||||
spek-audio-desc.cc \
|
||||
spek-audio-desc.hh \
|
||||
spek-events.cc \
|
||||
|
59
src/spek-artwork.cc
Normal file
59
src/spek-artwork.cc
Normal file
@ -0,0 +1,59 @@
|
||||
/* spek-artwork.cc
|
||||
*
|
||||
* Copyright (C) 2012 Alexander Kojevnikov <alexander@kojevnikov.com>
|
||||
*
|
||||
* Spek is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Spek is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/iconbndl.h>
|
||||
|
||||
#include "spek-artwork.hh"
|
||||
|
||||
class SpekArtProvider : public wxArtProvider
|
||||
{
|
||||
protected:
|
||||
virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size);
|
||||
#if ART_HAS_ICON_BUNDLES
|
||||
virtual wxIconBundle CreateIconBundle(const wxArtID& id, const wxArtClient& client);
|
||||
#endif
|
||||
};
|
||||
|
||||
wxBitmap SpekArtProvider::CreateBitmap(
|
||||
const wxArtID& id, const wxArtClient& client, const wxSize& size)
|
||||
{
|
||||
if (id == ART_SPEK) {
|
||||
#ifdef OS_UNIX
|
||||
return wxArtProvider::GetBitmap(wxT("spek"), client, size);
|
||||
#endif
|
||||
}
|
||||
return wxNullBitmap;
|
||||
}
|
||||
|
||||
#if ART_HAS_ICON_BUNDLES
|
||||
wxIconBundle SpekArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient& client)
|
||||
{
|
||||
if (id == ART_SPEK) {
|
||||
#ifdef OS_UNIX
|
||||
return wxArtProvider::GetIconBundle(wxT("spek"), client);
|
||||
#endif
|
||||
}
|
||||
return wxNullIconBundle;
|
||||
}
|
||||
#endif
|
||||
|
||||
void spek_artwork_init()
|
||||
{
|
||||
wxArtProvider::Push(new SpekArtProvider());
|
||||
}
|
34
src/spek-artwork.hh
Normal file
34
src/spek-artwork.hh
Normal file
@ -0,0 +1,34 @@
|
||||
/* spek-artwork.hh
|
||||
*
|
||||
* Copyright (C) 2012 Alexander Kojevnikov <alexander@kojevnikov.com>
|
||||
*
|
||||
* Spek is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Spek is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SPEK_ARTWORK_HH_
|
||||
#define SPEK_ARTWORK_HH_
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#define ART_HAS_ICON_BUNDLES wxCHECK_VERSION(2, 9, 0)
|
||||
|
||||
#define ART_SPEK wxT("art-spek")
|
||||
#define ART_OPEN wxT("art-open")
|
||||
#define ART_SAVE wxT("art-save")
|
||||
#define ART_ABOUT wxT("art-about")
|
||||
#define ART_CLOSE wxT("art-close")
|
||||
|
||||
void spek_artwork_init();
|
||||
|
||||
#endif
|
@ -30,6 +30,7 @@ extern "C" {
|
||||
#include <spek-utils.h>
|
||||
}
|
||||
|
||||
#include "spek-artwork.hh"
|
||||
#include "spek-preferences-dialog.hh"
|
||||
#include "spek-preferences.hh"
|
||||
#include "spek-spectrogram.hh"
|
||||
@ -74,8 +75,12 @@ SpekWindow::SpekWindow(const wxString& path) :
|
||||
{
|
||||
this->description = _("Spek - Acoustic Spectrum Analyser");
|
||||
SetTitle(this->description);
|
||||
// TODO: test on all platforms
|
||||
//SetIcon(wxIcon(wxT("spek")));
|
||||
|
||||
#if ART_HAS_ICON_BUNDLES
|
||||
SetIcons(wxArtProvider::GetIconBundle(ART_SPEK));
|
||||
#else
|
||||
SetIcon(wxArtProvider::GetIcon(ART_SPEK, wxART_OTHER, wxSize(48, 48)));
|
||||
#endif
|
||||
|
||||
wxMenuBar *menu = new wxMenuBar();
|
||||
|
||||
|
@ -24,6 +24,7 @@ extern "C" {
|
||||
#include <spek-audio.h>
|
||||
}
|
||||
|
||||
#include "spek-artwork.hh"
|
||||
#include "spek-platform.hh"
|
||||
#include "spek-preferences.hh"
|
||||
|
||||
@ -51,6 +52,8 @@ bool Spek::OnInit()
|
||||
wxSocketBase::Initialize();
|
||||
|
||||
spek_audio_init();
|
||||
|
||||
spek_artwork_init();
|
||||
spek_platform_init();
|
||||
SpekPreferences::get().init();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user