gui: Allow screenshot icon to be themed.

The logo and all the other icons can apparently be themed (though
theming is a bit broken). Let's allow the camera screenshot to be
themed as well.
This commit is contained in:
Jonathan Li 2015-09-06 21:08:14 +01:00
parent 2263961d4d
commit 5cf94e5a15
3 changed files with 31 additions and 4 deletions

View File

@ -242,6 +242,7 @@ public:
ScopedPtr<wxImageList> ToolbarImages;
ScopedPtr<wxIconBundle> IconBundle;
ScopedPtr<wxBitmap> Bitmap_Logo;
ScopedPtr<wxBitmap> ScreenshotBitmap;
ScopedPtr<AppGameDatabase> GameDB;
pxAppResources();
@ -559,6 +560,7 @@ public:
pxAppResources& GetResourceCache();
const wxIconBundle& GetIconBundle();
const wxBitmap& GetLogoBitmap();
const wxBitmap& GetScreenshotBitmap();
wxImageList& GetImgList_Config();
wxImageList& GetImgList_Toolbars();

View File

@ -23,6 +23,7 @@
#include "Resources/EmbeddedImage.h"
#include "Resources/BackgroundLogo.h"
#include "Resources/ButtonIcon_Camera.h"
#include "Resources/ConfigIcon_Cpu.h"
#include "Resources/ConfigIcon_Video.h"
@ -149,6 +150,28 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
return *logo;
}
const wxBitmap& Pcsx2App::GetScreenshotBitmap()
{
ScopedPtr<wxBitmap>& screenshot(GetResourceCache().ScreenshotBitmap);
if (screenshot) return *screenshot;
wxFileName mess;
bool useTheme = (g_Conf->DeskTheme != L"default");
if (useTheme)
{
wxDirName theme(PathDefs::GetThemes() + g_Conf->DeskTheme);
mess = theme.ToString();
}
wxImage img;
EmbeddedImage<res_ButtonIcon_Camera> temp; // because gcc can't allow non-const temporaries.
LoadImageAny(img, useTheme, mess, L"ButtonIcon_Camera", temp);
screenshot = new wxBitmap(img);
return *screenshot;
}
wxImageList& Pcsx2App::GetImgList_Config()
{
ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
@ -168,6 +191,11 @@ wxImageList& Pcsx2App::GetImgList_Config()
// GCC Specific: wxT() macro is required when using string token pasting. For some
// reason L generates syntax errors. >_<
// TODO: This can be fixed with something like
// #define L_STR(x) L_STR2(x)
// #define L_STR2(x) L ## x
// but it's probably best to do it everywhere at once. wxWidgets
// recommends not to use it since v2.9.0.
#undef FancyLoadMacro
#define FancyLoadMacro( name ) \

View File

@ -22,9 +22,6 @@
#include "ModalPopups.h"
#include "Panels/ConfigurationPanels.h"
#include "Resources/EmbeddedImage.h"
#include "Resources/ButtonIcon_Camera.h"
#include <wx/artprov.h>
#include <wx/filepicker.h>
#include <wx/listbook.h>
@ -187,7 +184,7 @@ void Dialogs::BaseConfigurationDialog::AddOkCancel( wxSizer* sizer )
if( wxWindow* apply = FindWindow( wxID_APPLY ) ) apply->Disable();
SomethingChanged_StateModified_IsChanged();
wxBitmapButton& screenshotButton( *new wxBitmapButton( this, wxID_SAVE, EmbeddedImage<res_ButtonIcon_Camera>().Get() ) );
wxBitmapButton& screenshotButton(*new wxBitmapButton(this, wxID_SAVE, wxGetApp().GetScreenshotBitmap()));
screenshotButton.SetToolTip( _("Saves a snapshot of this settings panel to a PNG file.") );
*m_extraButtonSizer += screenshotButton|pxMiddle;