2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2006-10-28 09:02:46 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2006-10-28 09:02:46 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2006-10-28 09:02:46 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2006-10-28 09:02:46 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-10-28 09:02:46 +00:00
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "sg_CustomControls.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "sg_CustomControls.h"
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticLine, wxPanel)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CTransparentStaticLine, wxPanel)
|
|
|
|
EVT_PAINT(CTransparentStaticLine::OnPaint)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CTransparentStaticLine::CTransparentStaticLine() {}
|
|
|
|
|
|
|
|
CTransparentStaticLine::CTransparentStaticLine(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CTransparentStaticLine::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
2006-10-30 00:19:58 +00:00
|
|
|
bool bRetVal = wxPanel::Create(parent, id, pos, size, style|wxTRANSPARENT_WINDOW, name);
|
2006-10-28 09:02:46 +00:00
|
|
|
|
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(parent->GetForegroundColour());
|
2012-10-26 06:06:14 +00:00
|
|
|
SetLineColor(GetForegroundColour());
|
2006-10-28 09:02:46 +00:00
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CTransparentStaticLine::OnPaint(wxPaintEvent& /*event*/) {
|
2012-10-26 06:06:14 +00:00
|
|
|
wxPaintDC dc(this);
|
2006-10-28 09:02:46 +00:00
|
|
|
wxPen pen = wxPen(GetLineColor(), 1);
|
|
|
|
dc.SetPen(pen);
|
|
|
|
dc.DrawLine(0, 0, GetSize().GetWidth(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticText, wxStaticText)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CTransparentStaticText, wxStaticText)
|
2006-11-01 08:58:24 +00:00
|
|
|
EVT_ERASE_BACKGROUND(CTransparentStaticText::OnEraseBackground)
|
2012-10-25 10:00:42 +00:00
|
|
|
#ifndef __WXMAC__
|
2006-10-28 09:02:46 +00:00
|
|
|
EVT_PAINT(CTransparentStaticText::OnPaint)
|
2012-10-25 10:00:42 +00:00
|
|
|
#endif
|
2006-10-28 09:02:46 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CTransparentStaticText::CTransparentStaticText() {}
|
|
|
|
|
2011-03-29 19:28:27 +00:00
|
|
|
CTransparentStaticText::CTransparentStaticText(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& WXUNUSED(name) ) {
|
2011-01-27 14:36:49 +00:00
|
|
|
// Set name same as label for accessibility on Windows
|
|
|
|
Create(parent, id, label, pos, size, style, label);
|
2006-10-28 09:02:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CTransparentStaticText::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
|
|
|
bool bRetVal = wxStaticText::Create(parent, id, label, pos, size, style|wxTRANSPARENT_WINDOW, name);
|
|
|
|
|
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(parent->GetForegroundColour());
|
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-25 10:00:42 +00:00
|
|
|
#ifndef __WXMAC__
|
2006-10-28 09:02:46 +00:00
|
|
|
void CTransparentStaticText::OnPaint(wxPaintEvent& /*event*/) {
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
dc.SetFont(GetFont());
|
|
|
|
dc.DrawText(GetLabel(), 0, 0);
|
|
|
|
}
|
2012-10-25 10:00:42 +00:00
|
|
|
#endif
|
2006-10-28 09:02:46 +00:00
|
|
|
|
2015-03-27 02:37:59 +00:00
|
|
|
|
2013-02-14 21:43:31 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2013-02-14 21:43:31 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2013-02-14 21:43:31 +00:00
|
|
|
void CTransparentButton::SetLabel(const wxString& label)
|
|
|
|
{
|
|
|
|
wxButton::SetLabel(label);
|
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2013-02-14 21:43:31 +00:00
|
|
|
void CTransparentButton::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-25 13:08:41 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentHyperlinkCtrl, wxHyperlinkCtrl)
|
|
|
|
|
2015-03-27 12:21:37 +00:00
|
|
|
#ifndef __WXMAC__
|
2015-03-25 13:08:41 +00:00
|
|
|
BEGIN_EVENT_TABLE(CTransparentHyperlinkCtrl, wxHyperlinkCtrl)
|
|
|
|
EVT_ERASE_BACKGROUND(CTransparentHyperlinkCtrl::OnEraseBackground)
|
2015-03-31 13:14:58 +00:00
|
|
|
EVT_PAINT(CTransparentHyperlinkCtrl::OnPaint)
|
2015-03-25 13:08:41 +00:00
|
|
|
END_EVENT_TABLE()
|
2015-03-27 12:21:37 +00:00
|
|
|
#endif
|
2015-03-25 13:08:41 +00:00
|
|
|
|
|
|
|
CTransparentHyperlinkCtrl::CTransparentHyperlinkCtrl() {}
|
|
|
|
|
|
|
|
CTransparentHyperlinkCtrl::CTransparentHyperlinkCtrl(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& label, const wxString& url,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style,
|
2015-03-27 12:04:05 +00:00
|
|
|
const wxString& name,
|
|
|
|
wxBitmap** parentsBgBmp)
|
2015-03-25 13:08:41 +00:00
|
|
|
{
|
2015-03-27 12:04:05 +00:00
|
|
|
(void)Create(parent, id, label, url, pos, size, style, name, parentsBgBmp);
|
2015-03-25 13:08:41 +00:00
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2015-03-25 13:08:41 +00:00
|
|
|
bool CTransparentHyperlinkCtrl::Create(wxWindow *parent,
|
2015-03-27 12:04:05 +00:00
|
|
|
wxWindowID id,
|
|
|
|
const wxString& label, const wxString& url,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style,
|
|
|
|
const wxString& name,
|
|
|
|
wxBitmap** parentsBgBmp)
|
2015-03-25 13:08:41 +00:00
|
|
|
{
|
2015-03-27 12:04:05 +00:00
|
|
|
bool bRetVal = wxHyperlinkCtrl::Create(parent, id, label, url, pos, size, style, name);
|
2015-03-25 13:08:41 +00:00
|
|
|
|
2015-03-27 12:04:05 +00:00
|
|
|
m_pParentsBgBmp = parentsBgBmp;
|
2015-03-31 13:00:52 +00:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
2015-03-25 13:08:41 +00:00
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(wxColour(0, 100, 225));
|
2015-03-27 12:04:05 +00:00
|
|
|
wxFont myFont = GetFont();
|
|
|
|
myFont.SetUnderlined(true);
|
|
|
|
SetFont(myFont);
|
2015-03-27 12:21:37 +00:00
|
|
|
#endif
|
2015-03-25 13:08:41 +00:00
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2015-03-27 12:21:37 +00:00
|
|
|
#ifndef __WXMAC__
|
2015-03-27 12:04:05 +00:00
|
|
|
void CTransparentHyperlinkCtrl::OnEraseBackground(wxEraseEvent& event)
|
2015-03-25 13:08:41 +00:00
|
|
|
{
|
2015-03-27 12:04:05 +00:00
|
|
|
if (m_pParentsBgBmp && *m_pParentsBgBmp) {
|
|
|
|
wxMemoryDC memDC(**m_pParentsBgBmp);
|
|
|
|
wxSize sz = GetClientSize();
|
|
|
|
wxDC *dc = event.GetDC();
|
2015-03-28 11:09:34 +00:00
|
|
|
wxCoord x=0, y=0, xx, yy;
|
|
|
|
wxWindow* win = this;
|
|
|
|
do {
|
|
|
|
win->GetPosition(&xx, &yy);
|
|
|
|
x += xx;
|
|
|
|
y += yy;
|
|
|
|
win = win->GetParent();
|
|
|
|
} while (!win->IsTopLevel());
|
2015-03-27 12:04:05 +00:00
|
|
|
dc->Blit(0, 0, sz.GetWidth(), sz.GetHeight(), &memDC, x, y, wxCOPY);
|
|
|
|
} else {
|
|
|
|
event.Skip();
|
|
|
|
}
|
2015-03-27 12:21:37 +00:00
|
|
|
}
|
2015-03-25 13:08:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-10-29 00:24:26 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticTextAssociate, wxPanel)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CTransparentStaticTextAssociate, wxPanel)
|
|
|
|
EVT_ERASE_BACKGROUND(CTransparentStaticTextAssociate::OnEraseBackground)
|
|
|
|
EVT_PAINT(CTransparentStaticTextAssociate::OnPaint)
|
|
|
|
EVT_MOUSE_EVENTS(CTransparentStaticTextAssociate::OnMouse)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CTransparentStaticTextAssociate::CTransparentStaticTextAssociate() {}
|
|
|
|
|
|
|
|
CTransparentStaticTextAssociate::CTransparentStaticTextAssociate(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
|
|
|
Create(parent, id, label, pos, size, style, name);
|
2006-10-28 09:02:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-29 00:24:26 +00:00
|
|
|
bool CTransparentStaticTextAssociate::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
|
|
|
bool bRetVal = wxPanel::Create(parent, id, pos, size, style|wxTRANSPARENT_WINDOW, name);
|
|
|
|
|
|
|
|
m_pWnd = NULL;
|
|
|
|
|
|
|
|
SetLabel(label);
|
|
|
|
SetFont(GetFont());
|
|
|
|
|
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(parent->GetForegroundColour());
|
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CTransparentStaticTextAssociate::SetFont(const wxFont& font) {
|
|
|
|
|
|
|
|
bool ret = wxPanel::SetFont(font);
|
|
|
|
|
|
|
|
InvalidateBestSize();
|
|
|
|
|
|
|
|
wxCoord width, height;
|
|
|
|
wxClientDC dc(this);
|
|
|
|
dc.SetFont(font);
|
|
|
|
dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
|
|
|
|
|
|
|
|
CacheBestSize(wxSize(width, height));
|
|
|
|
|
|
|
|
return ret;
|
2006-10-28 09:02:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Due to the nature of how wxWidgets handles some controls when Windows XP
|
|
|
|
// themes are enabled, it is easier to make a simulated CheckBox or
|
|
|
|
// RadioButton by linking two windows together. So when a mouse event
|
|
|
|
// happens with this window it forwards the event to the associated
|
|
|
|
// window.
|
2006-10-29 00:24:26 +00:00
|
|
|
bool CTransparentStaticTextAssociate::AssociateWindow(wxWindow* pWnd) {
|
2006-10-28 09:02:46 +00:00
|
|
|
m_pWnd = pWnd;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-29 00:24:26 +00:00
|
|
|
void CTransparentStaticTextAssociate::OnPaint(wxPaintEvent& /*event*/) {
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
dc.SetFont(GetFont());
|
|
|
|
dc.DrawText(GetLabel(), 1, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CTransparentStaticTextAssociate::OnMouse(wxMouseEvent& event) {
|
|
|
|
if (m_pWnd) {
|
|
|
|
wxMouseEvent evtAssociate(event);
|
|
|
|
evtAssociate.SetId(m_pWnd->GetId());
|
2012-10-16 19:56:34 +00:00
|
|
|
m_pWnd->GetEventHandler()->ProcessEvent(event);
|
2006-10-29 00:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If we get the left button up event and we already had focus, that must
|
|
|
|
// mean the user clicked on the static text, So change the associated
|
|
|
|
// control so that it has been clicked.
|
|
|
|
if (event.GetEventType() == wxEVT_LEFT_UP) {
|
|
|
|
wxCheckBox* pCheckBox = wxDynamicCast(m_pWnd, wxCheckBox);
|
|
|
|
if (pCheckBox) {
|
|
|
|
// Send the updated click event
|
|
|
|
wxCommandEvent evtCheckBox(wxEVT_COMMAND_CHECKBOX_CLICKED, pCheckBox->GetId());
|
|
|
|
evtCheckBox.SetEventObject(pCheckBox);
|
|
|
|
if (pCheckBox->IsChecked()) {
|
|
|
|
evtCheckBox.SetInt(wxCHK_UNCHECKED);
|
|
|
|
} else {
|
|
|
|
evtCheckBox.SetInt(wxCHK_CHECKED);
|
|
|
|
}
|
|
|
|
pCheckBox->Command(evtCheckBox);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
event.Skip();
|
|
|
|
}
|
2006-11-20 21:59:03 +00:00
|
|
|
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
#ifdef __WXMSW__
|
2015-03-27 02:37:59 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentStaticBitmap, wxStaticText)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CTransparentStaticBitmap, wxPanel)
|
|
|
|
EVT_ERASE_BACKGROUND(CTransparentStaticBitmap::OnEraseBackground)
|
|
|
|
EVT_PAINT(CTransparentStaticBitmap::OnPaint)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CTransparentStaticBitmap::CTransparentStaticBitmap() {}
|
|
|
|
|
|
|
|
CTransparentStaticBitmap::CTransparentStaticBitmap(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxString& WXUNUSED(name) ) {
|
|
|
|
Create(parent, id, bitmap, pos, size, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CTransparentStaticBitmap::Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) {
|
|
|
|
bool bRetVal = wxPanel::Create(parent, id, pos, size, style|wxTRANSPARENT_WINDOW, name);
|
|
|
|
|
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(parent->GetForegroundColour());
|
|
|
|
|
|
|
|
m_bitMap = wxBitmap(bitmap);
|
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CTransparentStaticBitmap::OnPaint(wxPaintEvent& /*event*/) {
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
dc.DrawBitmap(m_bitMap, 0, 0, true);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CTransparentCheckBox, wxCheckBox)
|
|
|
|
|
2015-03-27 12:21:37 +00:00
|
|
|
#ifndef __WXMAC__
|
2015-03-27 02:37:59 +00:00
|
|
|
BEGIN_EVENT_TABLE(CTransparentCheckBox, wxCheckBox)
|
|
|
|
EVT_ERASE_BACKGROUND(CTransparentCheckBox::OnEraseBackground)
|
|
|
|
END_EVENT_TABLE()
|
2015-03-27 12:21:37 +00:00
|
|
|
#endif
|
2015-03-27 02:37:59 +00:00
|
|
|
|
|
|
|
CTransparentCheckBox::CTransparentCheckBox() {}
|
|
|
|
|
|
|
|
CTransparentCheckBox::CTransparentCheckBox(wxWindow *parent, wxWindowID id, const wxString& label,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, long style,
|
|
|
|
const wxValidator& validator,
|
2015-03-27 12:04:05 +00:00
|
|
|
const wxString& name,
|
|
|
|
wxBitmap** parentsBgBmp
|
2015-03-27 02:37:59 +00:00
|
|
|
) {
|
2015-03-27 12:04:05 +00:00
|
|
|
Create(parent, id, label, pos, size, style, validator, name, parentsBgBmp);
|
2015-03-27 02:37:59 +00:00
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2015-03-27 02:37:59 +00:00
|
|
|
bool CTransparentCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, long style,
|
|
|
|
const wxValidator& validator,
|
2015-03-27 12:04:05 +00:00
|
|
|
const wxString& name,
|
|
|
|
wxBitmap** parentsBgBmp
|
2015-03-27 02:37:59 +00:00
|
|
|
) {
|
2015-03-31 09:18:52 +00:00
|
|
|
wxString spacedLabel = wxT(" ") + label;
|
|
|
|
bool bRetVal = wxCheckBox::Create(parent, id, spacedLabel, pos, size, style, validator, name);
|
2015-03-27 02:37:59 +00:00
|
|
|
|
2015-03-27 12:04:05 +00:00
|
|
|
m_pParentsBgBmp = parentsBgBmp;
|
2015-03-31 13:00:52 +00:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
2015-03-27 02:37:59 +00:00
|
|
|
SetBackgroundColour(parent->GetBackgroundColour());
|
|
|
|
SetForegroundColour(parent->GetForegroundColour());
|
2015-03-27 12:21:37 +00:00
|
|
|
#endif
|
2015-03-27 02:37:59 +00:00
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
2015-03-31 13:00:52 +00:00
|
|
|
|
2015-03-27 12:21:37 +00:00
|
|
|
#ifndef __WXMAC__
|
2015-03-27 12:04:05 +00:00
|
|
|
void CTransparentCheckBox::OnEraseBackground(wxEraseEvent& event)
|
|
|
|
{
|
|
|
|
if (m_pParentsBgBmp && *m_pParentsBgBmp) {
|
|
|
|
wxMemoryDC memDC(**m_pParentsBgBmp);
|
|
|
|
wxSize sz = GetClientSize();
|
|
|
|
wxDC *dc = event.GetDC();
|
2015-03-28 11:09:34 +00:00
|
|
|
wxCoord x=0, y=0, xx, yy;
|
|
|
|
wxWindow* win = this;
|
|
|
|
do {
|
|
|
|
win->GetPosition(&xx, &yy);
|
|
|
|
x += xx;
|
|
|
|
y += yy;
|
|
|
|
win = win->GetParent();
|
|
|
|
} while (!win->IsTopLevel());
|
2015-03-27 12:04:05 +00:00
|
|
|
dc->Blit(0, 0, sz.GetWidth(), sz.GetHeight(), &memDC, x, y, wxCOPY);
|
|
|
|
} else {
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
2015-03-27 02:37:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-11-20 21:59:03 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS (CLinkButton, wxBitmapButton)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CLinkButton, wxBitmapButton)
|
|
|
|
EVT_MOUSE_EVENTS(CLinkButton::OnMouse)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CLinkButton::CLinkButton() {}
|
|
|
|
|
|
|
|
CLinkButton::CLinkButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) {
|
|
|
|
Create(parent, id, bitmap, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CLinkButton::Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) {
|
|
|
|
bool bRetVal = wxBitmapButton::Create(parent, id, bitmap, pos, size, style, validator, name);
|
|
|
|
|
|
|
|
m_HandCursor = wxCursor(wxCURSOR_HAND);
|
|
|
|
|
|
|
|
return bRetVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CLinkButton::OnMouse(wxMouseEvent& event) {
|
|
|
|
if (event.Entering()) {
|
|
|
|
SetCursor(m_HandCursor);
|
|
|
|
} else if (event.Leaving()) {
|
|
|
|
SetCursor(*wxSTANDARD_CURSOR);
|
|
|
|
}
|
|
|
|
event.Skip();
|
|
|
|
}
|