Merge pull request #817 from archshift/disabledcolor
Fixed toolbar's disabled button color.
This commit is contained in:
commit
6a74f5e8f6
|
@ -618,16 +618,14 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
|
|||
h = m_Bitmaps[0].GetHeight();
|
||||
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
|
||||
toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
|
||||
toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step], _("Step into the next instruction"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver], _("Step over the next instruction"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip], _("Skips the next instruction completely"));
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
|
||||
toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC], _("Go to the current instruction"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC], _("Set the current instruction"));
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, ""));
|
||||
|
||||
toolBar->Realize();
|
||||
}
|
||||
|
||||
// Update GUI
|
||||
|
|
|
@ -490,42 +490,35 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar)
|
|||
ToolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
|
||||
|
||||
ToolBar->AddTool(wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
|
||||
ToolBar->AddTool(wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
|
||||
ToolBar->AddTool(IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
|
||||
ToolBar->AddSeparator();
|
||||
ToolBar->AddTool(IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
|
||||
ToolBar->AddTool(IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
|
||||
ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
|
||||
ToolBar->AddTool(IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_Screenshot], _("Take Screenshot"));
|
||||
ToolBar->AddSeparator();
|
||||
ToolBar->AddTool(wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
|
||||
ToolBar->AddTool(IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
|
||||
ToolBar->AddTool(IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
|
||||
ToolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings"));
|
||||
ToolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect
|
||||
// the changes
|
||||
ToolBar->Realize();
|
||||
WxUtils::AddToolbarButton(ToolBar, wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings"));
|
||||
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
|
||||
}
|
||||
|
||||
|
||||
// Delete and recreate the toolbar
|
||||
void CFrame::RecreateToolbar()
|
||||
{
|
||||
if (m_ToolBar)
|
||||
static const long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT;
|
||||
|
||||
if (m_ToolBar != nullptr)
|
||||
{
|
||||
m_Mgr->DetachPane(m_ToolBar);
|
||||
m_ToolBar->Destroy();
|
||||
m_ToolBar = nullptr;
|
||||
}
|
||||
|
||||
long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT;
|
||||
|
||||
if (!m_ToolBar)
|
||||
{
|
||||
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain");
|
||||
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
|
@ -534,7 +527,9 @@ void CFrame::RecreateToolbar()
|
|||
}
|
||||
|
||||
PopulateToolbar(m_ToolBar);
|
||||
}
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect
|
||||
// the changes
|
||||
m_ToolBar->Realize();
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <wx/msgdlg.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/toolbar.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
|
@ -75,6 +76,19 @@ wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
|
|||
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
|
||||
}
|
||||
|
||||
wxBitmap CreateDisabledButtonBitmap(const wxBitmap& original)
|
||||
{
|
||||
wxImage image = original.ConvertToImage();
|
||||
return wxBitmap(image.ConvertToDisabled(240));
|
||||
}
|
||||
|
||||
void AddToolbarButton(wxToolBar* toolbar, int toolID, const wxString& label, const wxBitmap& bitmap, const wxString& shortHelp)
|
||||
{
|
||||
// Must explicitly set the disabled button bitmap because wxWidgets
|
||||
// incorrectly desaturates it instead of lightening it.
|
||||
toolbar->AddTool(toolID, label, bitmap, WxUtils::CreateDisabledButtonBitmap(bitmap), wxITEM_NORMAL, shortHelp);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::string WxStrToStr(const wxString& str)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <wx/string.h>
|
||||
|
||||
class wxBitmap;
|
||||
class wxToolBar;
|
||||
|
||||
// A shortcut to access the bitmaps
|
||||
#define wxGetBitmapFromMemory(name) WxUtils::_wxGetBitmapFromMemory(name, sizeof(name))
|
||||
|
@ -28,6 +29,12 @@ double GetCurrentBitmapLogicalScale();
|
|||
|
||||
wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length);
|
||||
|
||||
// From a wxBitmap, creates the corresponding disabled version for toolbar buttons
|
||||
wxBitmap CreateDisabledButtonBitmap(const wxBitmap& original);
|
||||
|
||||
// Helper function to add a button to a toolbar
|
||||
void AddToolbarButton(wxToolBar* toolbar, int toolID, const wxString& label, const wxBitmap& bitmap, const wxString& shortHelp);
|
||||
|
||||
} // namespace
|
||||
|
||||
std::string WxStrToStr(const wxString& str);
|
||||
|
|
Loading…
Reference in New Issue