MGR: Fixes to new Simple GUI for Linux

svn path=/trunk/boinc/; revision=23523
This commit is contained in:
Charlie Fenton 2011-05-11 11:26:34 +00:00
parent d1ae7a2fcc
commit 36ccee91bc
4 changed files with 54 additions and 3 deletions

View File

@ -2886,3 +2886,10 @@ Charlie 10 May 2011
clientgui/
sg_BoincSimpleFrame.cpp
sg_ProjectPanel.cpp
Charlie 11 May 2011
- MGR: Fixes to new Simple GUI for Linux.
clientgui/
sg_PanelBase.cpp, .h
sg_TaskPanel.cpp

View File

@ -21,7 +21,11 @@
IMPLEMENT_DYNAMIC_CLASS(CSimplePanelBase, wxPanel)
BEGIN_EVENT_TABLE(CSimplePanelBase, wxPanel)
#if (defined(__WXMSW_) || defined(__WXMAC__))
EVT_ERASE_BACKGROUND(CSimplePanelBase::OnEraseBackground)
#else // Linux
EVT_PAINT(CSimplePanelBase::OnPaint)
#endif
END_EVENT_TABLE()
@ -39,7 +43,7 @@ CSimplePanelBase::CSimplePanelBase( wxWindow* parent ) :
#ifdef __WXMAC__
// Tell accessibility aids to ignore this panel (but not its contents)
HIObjectSetAccessibilityIgnored((HIObjectRef)GetHandle(), true);
#endif
#endif
}
@ -117,13 +121,15 @@ void CSimplePanelBase::MakeBGBitMap() {
}
#if (defined(__WXMSW_) || defined(__WXMAC__))
void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
wxDC* dc = event.GetDC();
if (!m_GotBGBitMap) {
MakeBGBitMap();
}
//return;
dc->DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
wxPen oldPen= dc->GetPen();
wxBrush oldBrush = dc->GetBrush();
@ -144,6 +150,39 @@ void CSimplePanelBase::OnEraseBackground(wxEraseEvent& event) {
dc->SetBrush(oldBrush);
}
#else // Linux
void CSimplePanelBase::OnPaint(wxPaintEvent& event) {
wxPaintDC dc(this);
if (!m_GotBGBitMap) {
MakeBGBitMap();
}
dc.DrawBitmap(m_TaskPanelBGBitMap, 0, 0);
wxPen oldPen= dc.GetPen();
wxBrush oldBrush = dc.GetBrush();
int oldMode = dc.GetBackgroundMode();
wxCoord w, h;
wxPen bgPen(*wxBLUE, 3);
wxBrush bgBrush(*wxBLUE, wxTRANSPARENT);
dc.SetBackgroundMode(wxSOLID);
dc.SetPen(bgPen);
dc.SetBrush(bgBrush);
dc.GetSize(&w, &h);
dc.DrawRoundedRectangle(0, 0, w, h, 10.0);
// Restore Mode, Pen and Brush
dc.SetBackgroundMode(oldMode);
dc.SetPen(oldPen);
dc.SetBrush(oldBrush);
event.Skip();
}
#endif
void CSimplePanelBase::UpdateStaticText(CTransparentStaticText **whichText, wxString s) {
EllipseStringIfNeeded(s, *whichText);
@ -179,4 +218,4 @@ void CSimplePanelBase::EllipseStringIfNeeded(wxString& s, wxWindow *win) {
w += ellipsisWidth;
}
}
}
}

View File

@ -82,7 +82,11 @@ class CSimplePanelBase : public wxPanel
protected:
void MakeBGBitMap();
#if (defined(__WXMSW_) || defined(__WXMAC__))
void OnEraseBackground(wxEraseEvent& event);
#else // Linux
void OnPaint(wxPaintEvent& event);
#endif
wxBitmap m_TaskPanelBGBitMap;
bool m_GotBGBitMap;

View File

@ -424,6 +424,7 @@ void CSimpleTaskPanel::Update() {
m_TimeRemainingValue->Show();
m_ProgressValueText->Show();
m_TaskCommandsButton->Show();
this->Layout();
}
UpdateTaskSelectionList();