mirror of https://github.com/BOINC/boinc.git
MGR: SimpleGUI: Make the Notices/Suspend/Resume/Help button borders transparent. The other buttons will take a bit more work.
This commit is contained in:
parent
b2c53551b6
commit
984c23558e
|
@ -42,6 +42,7 @@
|
|||
#include "version.h"
|
||||
|
||||
#include "sg_BoincSimpleFrame.h"
|
||||
#include "sg_CustomControls.h"
|
||||
#include "sg_TaskPanel.h"
|
||||
#include "sg_ProjectPanel.h"
|
||||
#include "sg_DlgMessages.h"
|
||||
|
@ -744,7 +745,7 @@ CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
|
|||
wxBoxSizer* buttonsSizer;
|
||||
buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_NoticesButton = new wxButton( this, ID_SGNOTICESBUTTON, _("Notices"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_NoticesButton = new CTransparentButton( this, ID_SGNOTICESBUTTON, _("Notices"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_NoticesButton->SetToolTip( _("Open a window to view notices from projects or BOINC"));
|
||||
buttonsSizer->Add( m_NoticesButton, 0, wxEXPAND | wxALIGN_LEFT, 0 );
|
||||
buttonsSizer->AddStretchSpacer();
|
||||
|
@ -754,7 +755,7 @@ CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
|
|||
GetTextExtent(m_sResumeString, &resumeWidth, &y);
|
||||
|
||||
m_bIsSuspended = suspendWidth > resumeWidth;
|
||||
m_SuspendResumeButton = new wxButton( this, ID_SGSUSPENDRESUMEBUTTON,
|
||||
m_SuspendResumeButton = new CTransparentButton( this, ID_SGSUSPENDRESUMEBUTTON,
|
||||
m_bIsSuspended ? m_sSuspendString : m_sResumeString,
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SuspendResumeButton->SetToolTip(wxEmptyString);
|
||||
|
@ -762,7 +763,7 @@ CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
|
|||
buttonsSizer->Add( m_SuspendResumeButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
|
||||
buttonsSizer->AddStretchSpacer();
|
||||
|
||||
m_HelpButton = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_HelpButton = new CTransparentButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
buttonsSizer->Add( m_HelpButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
|
||||
|
||||
wxString helpTip;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#pragma interface "sg_BoincSimpleFrame.cpp"
|
||||
#endif
|
||||
|
||||
class CTransparentButton;
|
||||
class CSimpleTaskPanel;
|
||||
class CSimpleProjectPanel;
|
||||
class CSimpleTaskPanel;
|
||||
|
@ -79,9 +80,9 @@ protected:
|
|||
int m_iRedRingRadius;
|
||||
#endif
|
||||
wxBitmap m_bmpBg;
|
||||
wxButton *m_NoticesButton;
|
||||
wxButton *m_SuspendResumeButton;
|
||||
wxButton *m_HelpButton;
|
||||
CTransparentButton *m_NoticesButton;
|
||||
CTransparentButton *m_SuspendResumeButton;
|
||||
CTransparentButton *m_HelpButton;
|
||||
wxString m_sSuspendString;
|
||||
wxString m_sResumeString;
|
||||
int m_oldWorkCount;
|
||||
|
|
|
@ -100,6 +100,40 @@ void CTransparentStaticText::OnPaint(wxPaintEvent& /*event*/) {
|
|||
}
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS (CTransparentButton, wxButton)
|
||||
|
||||
BEGIN_EVENT_TABLE(CTransparentButton, wxButton)
|
||||
EVT_ERASE_BACKGROUND(CTransparentButton::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CTransparentButton::CTransparentButton() {}
|
||||
|
||||
CTransparentButton::CTransparentButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name )
|
||||
{
|
||||
Create(parent, id, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool CTransparentButton::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name )
|
||||
{
|
||||
bool bRetVal = wxButton::Create(parent, id, label, pos, size, style|wxTRANSPARENT_WINDOW, validator, name);
|
||||
|
||||
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
|
||||
SetBackgroundColour(parent->GetBackgroundColour());
|
||||
SetForegroundColour(parent->GetForegroundColour());
|
||||
|
||||
return bRetVal;
|
||||
}
|
||||
|
||||
void CTransparentButton::SetLabel(const wxString& label)
|
||||
{
|
||||
wxButton::SetLabel(label);
|
||||
}
|
||||
|
||||
void CTransparentButton::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticTextAssociate, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(CTransparentStaticTextAssociate, wxPanel)
|
||||
|
|
|
@ -100,6 +100,42 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class CTransparentButton : public wxButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS (CTransparentButton)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
CTransparentButton();
|
||||
CTransparentButton(
|
||||
wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr
|
||||
);
|
||||
|
||||
bool Create(
|
||||
wxWindow* parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr
|
||||
);
|
||||
|
||||
virtual bool HasTransparentBackground() { return true; };
|
||||
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void OnEraseBackground(wxEraseEvent& event);
|
||||
};
|
||||
|
||||
|
||||
class CTransparentStaticTextAssociate : public wxPanel
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS (CTransparentStaticTextAssociate)
|
||||
|
|
Loading…
Reference in New Issue