mirror of https://github.com/BOINC/boinc.git
Attempt to fix appearance of Simple View buttons on Windows
This commit is contained in:
parent
47409201aa
commit
0601bdbd19
|
@ -26,7 +26,11 @@
|
|||
IMPLEMENT_DYNAMIC_CLASS(CSimplePanelBase, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimplePanelBase, wxPanel)
|
||||
EVT_PAINT(CSimplePanelBase::OnPaint)
|
||||
#ifdef __WXMSW__
|
||||
EVT_ERASE_BACKGROUND(CSimplePanelBase::OnEraseBackground)
|
||||
#else
|
||||
EVT_PAINT(CSimplePanelBase::OnPaint)
|
||||
#endif
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -139,40 +143,51 @@ void CSimplePanelBase::MakeBGBitMap() {
|
|||
// events here, so use Paint events
|
||||
void CSimplePanelBase::OnPaint(wxPaintEvent& /*event*/) {
|
||||
wxPaintDC dc(this);
|
||||
EraseBackground(&dc);
|
||||
}
|
||||
|
||||
|
||||
void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
|
||||
wxDC *dc = event.GetDC();
|
||||
EraseBackground(dc);
|
||||
}
|
||||
|
||||
|
||||
void CSimplePanelBase::EraseBackground(wxDC *dc) {
|
||||
|
||||
if (!m_GotBGBitMap) {
|
||||
MakeBGBitMap();
|
||||
}
|
||||
|
||||
dc.DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
|
||||
wxPen oldPen= dc.GetPen();
|
||||
wxBrush oldBrush = dc.GetBrush();
|
||||
int oldMode = dc.GetBackgroundMode();
|
||||
dc->DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
|
||||
wxPen oldPen= dc->GetPen();
|
||||
wxBrush oldBrush = dc->GetBrush();
|
||||
int oldMode = dc->GetBackgroundMode();
|
||||
wxCoord w, h;
|
||||
wxPen bgPen(*wxLIGHT_GREY, 3);
|
||||
wxBrush bgBrush(*wxLIGHT_GREY, wxTRANSPARENT);
|
||||
|
||||
dc.SetBackgroundMode(wxSOLID);
|
||||
dc.SetPen(bgPen);
|
||||
dc.SetBrush(bgBrush);
|
||||
dc.GetSize(&w, &h);
|
||||
dc.DrawRoundedRectangle(0, 0, w, h, RECTANGLERADIUS);
|
||||
dc->SetBackgroundMode(wxSOLID);
|
||||
dc->SetPen(bgPen);
|
||||
dc->SetBrush(bgBrush);
|
||||
dc->GetSize(&w, &h);
|
||||
dc->DrawRoundedRectangle(0, 0, w, h, RECTANGLERADIUS);
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Mac progress bar can be hard to see on a colored
|
||||
// background, so put it on a white background
|
||||
wxRect* progressRect = GetProgressRect();
|
||||
if (progressRect) {
|
||||
dc.SetPen(*wxBLACK_PEN);
|
||||
dc.SetBrush(*wxWHITE_BRUSH);
|
||||
dc.DrawRoundedRectangle(progressRect->x, progressRect->y, progressRect->width, progressRect->height, 2);
|
||||
dc->SetPen(*wxBLACK_PEN);
|
||||
dc->SetBrush(*wxWHITE_BRUSH);
|
||||
dc->DrawRoundedRectangle(progressRect->x, progressRect->y, progressRect->width, progressRect->height, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Restore Mode, Pen and Brush
|
||||
dc.SetBackgroundMode(oldMode);
|
||||
dc.SetPen(oldPen);
|
||||
dc.SetBrush(oldBrush);
|
||||
dc->SetBackgroundMode(oldMode);
|
||||
dc->SetPen(oldPen);
|
||||
dc->SetBrush(oldBrush);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ class CSimplePanelBase : public wxPanel
|
|||
protected:
|
||||
void MakeBGBitMap();
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void EraseBackground(wxDC *dc);
|
||||
|
||||
wxBitmap m_TaskPanelBGBitMap;
|
||||
bool m_GotBGBitMap;
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include "sg_ProjectPanel.h"
|
||||
#include "sg_ProjectCommandPopup.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleProjectCommandPopupButton, wxButton)
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleProjectCommandPopupButton, CTransparentButton)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimpleProjectCommandPopupButton, wxButton)
|
||||
BEGIN_EVENT_TABLE(CSimpleProjectCommandPopupButton, CTransparentButton)
|
||||
EVT_LEFT_DOWN(CSimpleProjectCommandPopupButton::OnProjectCommandsButton)
|
||||
EVT_MENU(ID_TASK_PROJECT_UPDATE, CSimpleProjectCommandPopupButton::OnProjectUpdate)
|
||||
EVT_MENU(ID_TASK_PROJECT_SUSPEND, CSimpleProjectCommandPopupButton::OnProjectSuspendResume)
|
||||
|
@ -42,7 +42,7 @@ CSimpleProjectCommandPopupButton::CSimpleProjectCommandPopupButton() {
|
|||
CSimpleProjectCommandPopupButton::CSimpleProjectCommandPopupButton(wxWindow* parent, wxWindowID id,
|
||||
const wxString& label, const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxValidator& validator, const wxString& name) :
|
||||
wxButton(parent, id, label, pos, size, style, validator, name)
|
||||
CTransparentButton(parent, id, label, pos, size, style, validator, name)
|
||||
{
|
||||
|
||||
m_ProjectCommandsPopUpMenu = new wxMenu();
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#ifndef __sg_ProjectCommandPopup__
|
||||
#define __sg_ProjectCommandPopup__
|
||||
|
||||
class CSimpleProjectCommandPopupButton : public wxButton
|
||||
#include "sg_CustomControls.h"
|
||||
|
||||
class CSimpleProjectCommandPopupButton : public CTransparentButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( CSimpleProjectCommandPopupButton )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -94,7 +94,7 @@ CSimpleProjectPanel::CSimpleProjectPanel( wxWindow* parent ) :
|
|||
int addProjectWidth, synchronizeWidth, y;
|
||||
GetTextExtent(m_sAddProjectString, &addProjectWidth, &y);
|
||||
GetTextExtent(m_sSynchronizeString, &synchronizeWidth, &y);
|
||||
m_TaskAddProjectButton = new wxButton( this, ID_ADDROJECTBUTTON,
|
||||
m_TaskAddProjectButton = new CTransparentButton( this, ID_ADDROJECTBUTTON,
|
||||
(addProjectWidth > synchronizeWidth) ? m_sAddProjectString : m_sSynchronizeString,
|
||||
wxDefaultPosition, wxDefaultSize, 0
|
||||
);
|
||||
|
|
|
@ -59,7 +59,7 @@ class CSimpleProjectPanel : public CSimplePanelBase
|
|||
protected:
|
||||
CTransparentStaticText* m_myProjectsLabel;
|
||||
CBOINCBitmapComboBox* m_ProjectSelectionCtrl;
|
||||
wxButton* m_TaskAddProjectButton;
|
||||
CTransparentButton* m_TaskAddProjectButton;
|
||||
CTransparentStaticText* m_TotalCreditValue;
|
||||
CSimpleProjectWebSitesPopupButton* m_ProjectWebSitesButton;
|
||||
CSimpleProjectCommandPopupButton* m_ProjectCommandsButton;
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
#include "sg_ProjectWebSitesPopup.h"
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleProjectWebSitesPopupButton, wxButton)
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleProjectWebSitesPopupButton, CTransparentButton)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimpleProjectWebSitesPopupButton, wxButton)
|
||||
BEGIN_EVENT_TABLE(CSimpleProjectWebSitesPopupButton, CTransparentButton)
|
||||
EVT_LEFT_DOWN(CSimpleProjectWebSitesPopupButton::OnProjectWebSiteButton)
|
||||
EVT_MENU(WEBSITE_URL_MENU_ID,CSimpleProjectWebSitesPopupButton::OnMenuLinkClicked)
|
||||
EVT_MENU(WEBSITE_URL_MENU_ID_REMOVE_PROJECT,CSimpleProjectWebSitesPopupButton::OnMenuLinkClicked)
|
||||
|
@ -37,7 +37,7 @@ CSimpleProjectWebSitesPopupButton::CSimpleProjectWebSitesPopupButton() {
|
|||
CSimpleProjectWebSitesPopupButton::CSimpleProjectWebSitesPopupButton(wxWindow* parent, wxWindowID id,
|
||||
const wxString& label, const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxValidator& validator, const wxString& name) :
|
||||
wxButton(parent, id, label, pos, size, style, validator, name)
|
||||
CTransparentButton(parent, id, label, pos, size, style, validator, name)
|
||||
{
|
||||
|
||||
m_ProjectWebSitesPopUpMenu = new wxMenu();
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
#ifndef __sg_ProjectWebsitesPopup__
|
||||
#define __sg_ProjectWebsitesPopup__
|
||||
|
||||
#include "sg_CustomControls.h"
|
||||
|
||||
class CSimpleProjectWebSitesPopupButton : public wxButton
|
||||
class CSimpleProjectWebSitesPopupButton : public CTransparentButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( CSimpleProjectWebSitesPopupButton )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include "sg_TaskPanel.h"
|
||||
#include "sg_TaskCommandPopup.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleTaskPopupButton, wxButton)
|
||||
IMPLEMENT_DYNAMIC_CLASS(CSimpleTaskPopupButton, CTransparentButton)
|
||||
|
||||
BEGIN_EVENT_TABLE(CSimpleTaskPopupButton, wxButton)
|
||||
BEGIN_EVENT_TABLE(CSimpleTaskPopupButton, CTransparentButton)
|
||||
EVT_LEFT_DOWN(CSimpleTaskPopupButton::OnTasksCommandButton)
|
||||
EVT_MENU(ID_TASK_WORK_SHOWGRAPHICS, CSimpleTaskPopupButton::OnTaskShowGraphics)
|
||||
EVT_MENU(ID_TASK_WORK_SUSPEND, CSimpleTaskPopupButton::OnTaskSuspendResume)
|
||||
|
@ -40,7 +40,7 @@ CSimpleTaskPopupButton::CSimpleTaskPopupButton() {
|
|||
CSimpleTaskPopupButton::CSimpleTaskPopupButton(wxWindow* parent, wxWindowID id,
|
||||
const wxString& label, const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxValidator& validator, const wxString& name) :
|
||||
wxButton(parent, id, label, pos, size, style, validator, name)
|
||||
CTransparentButton(parent, id, label, pos, size, style, validator, name)
|
||||
{
|
||||
|
||||
m_TaskSuspendedViaGUI = false;
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#ifndef __sg_TaskCommandPopup__
|
||||
#define __sg_TaskCommandPopup__
|
||||
|
||||
class CSimpleTaskPopupButton : public wxButton
|
||||
#include "sg_CustomControls.h"
|
||||
|
||||
class CSimpleTaskPopupButton : public CTransparentButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( CSimpleTaskPopupButton )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
Loading…
Reference in New Issue