OS X: Always use 24x24 icons for toolbars attached to frames

32x32 icons really should be used here as they'll get automatically
upscaled to that anyway, but we currently don't have those.

Originally committed to SVN as r6827.
This commit is contained in:
Thomas Goyne 2012-05-19 01:13:05 +00:00
parent ba40e24326
commit 3d512eb422

View file

@ -62,6 +62,8 @@ namespace {
std::vector<cmd::Command *> commands;
/// Hotkey context
std::string ht_context;
/// Current icon size
int icon_size;
/// Listener for icon size change signal
agi::signal::Connection icon_size_slot;
@ -86,6 +88,12 @@ namespace {
(*commands[evt.GetId() - TOOL_ID_BASE])(context);
}
/// Regenerate the toolbar when the icon size changes
void OnIconSizeChange(agi::OptionValue const& opt) {
icon_size = opt.GetInt();
RegenerateToolbar();
}
/// Clear the toolbar and recreate it
void RegenerateToolbar() {
Unbind(wxEVT_IDLE, &Toolbar::OnIdle, this);
@ -103,8 +111,6 @@ namespace {
throw agi::InternalError("Toolbar named " + name + " not found.", 0);
}
int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt();
json::Array const& arr = root_it->second;
commands.reserve(arr.size());
bool needs_onidle = false;
@ -177,7 +183,8 @@ namespace {
, name(name)
, context(c)
, ht_context(ht_context)
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::RegenerateToolbar, this))
, icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt())
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this))
, hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this))
{
Populate();
@ -189,7 +196,12 @@ namespace {
, name(name)
, context(c)
, ht_context(ht_context)
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::RegenerateToolbar, this))
#ifndef __WXMAC__
, icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt())
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this))
#else
, icon_size(24)
#endif
, hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this))
{
parent->SetToolBar(this);