Use retina icons for the main toolbar if first opened on a retina display

This commit is contained in:
Thomas Goyne 2013-12-26 17:55:41 -08:00
parent b4ed6a3b1a
commit f4a6d90db4
4 changed files with 11 additions and 1 deletions

View file

@ -61,3 +61,8 @@ void SetPlaceholderText(wxWindow *window, wxString const& placeholder) {
cell.placeholderString = wxCFStringRef(placeholder).AsNSString();
}
}
double GetScaleFactor(wxWindow *window) {
NSWindow *nsWindow = [window->GetHandle() window];
return [nsWindow respondsToSelector:@selector(backingScaleFactor)] ? nsWindow.backingScaleFactor : 1.0;
}

View file

@ -26,6 +26,7 @@
#include "include/aegisub/hotkey.h"
#include "libresrc/libresrc.h"
#include "options.h"
#include "utils.h"
#include <libaegisub/hotkey.h>
#include <libaegisub/json.h>
@ -186,7 +187,7 @@ namespace {
, icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt())
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this))
#else
, icon_size(32)
, icon_size(32 * GetScaleFactor(parent))
#endif
, hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this))
{

View file

@ -271,6 +271,7 @@ size_t MaxLineLength(std::string const& text, bool ignore_whitespace) {
#ifndef __WXOSX_COCOA__
void AddFullScreenButton(wxWindow *) { }
void SetFloatOnParent(wxWindow *) { }
double GetScaleFactor(wxWindow *) { return 1; }
#endif
wxString FontFace(std::string opt_prefix) {

View file

@ -49,6 +49,7 @@
class wxMouseEvent;
class wxWindow;
namespace cmd { class Command; }
wxString PrettySize(int bytes);
@ -77,6 +78,8 @@ void SetFloatOnParent(wxWindow *window);
void SetPlaceholderText(wxWindow *window, wxString const& placeholder);
double GetScaleFactor(wxWindow *window);
/// Forward a mouse wheel event to the window under the mouse if needed
/// @param source The initial target of the wheel event
/// @param evt The event