Merge commit '0601bdbd1957419ed81d881de947e269bd01ab1c' into master

This commit is contained in:
Oliver Bock 2013-03-05 17:33:49 +01:00
commit eb94271cb5
10 changed files with 52 additions and 30 deletions

View File

@ -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()
@ -146,40 +150,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);
}

View File

@ -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;

View File

@ -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();

View File

@ -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()

View File

@ -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
);

View File

@ -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;

View File

@ -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();

View File

@ -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()

View File

@ -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;

View File

@ -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()