attempts to fix GTK refresh - completely fruitless so far

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-05 19:21:57 +00:00
parent f85b3ee981
commit d0b9653f6c
5 changed files with 69 additions and 30 deletions

View File

@@ -289,7 +289,7 @@ public:
virtual void AdjustSize(wxSize *size, const wxWindow *window)
{ m_renderer->AdjustSize(size, window); }
virtual wxRect GetBorderDimensions(wxBorder border) const
{ m_renderer->GetBorderDimensions(border); }
{ return m_renderer->GetBorderDimensions(border); }
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,

View File

@@ -79,7 +79,7 @@ bool wxControl::Create(wxWindow *parent,
m_handler = CreateInputHandler();
SetBackgroundColour(parent->GetBackgroundColour());
//SetBackgroundColour(parent->GetBackgroundColour());
return TRUE;
}

View File

@@ -376,8 +376,13 @@ void wxControlRenderer::DrawButtonBorder()
m_renderer->DrawButtonBorder(m_dc, m_rect, flags, &m_rect);
m_renderer->DrawBackground(m_dc, m_window->GetBackgroundColour(),
m_rect, flags);
wxColour colBg;
if ( !(flags & wxCONTROL_CURRENT) )
{
colBg = m_window->GetBackgroundColour();
}
m_renderer->DrawBackground(m_dc, colBg, m_rect, flags);
}
void wxControlRenderer::DrawBitmap(const wxBitmap& bitmap)

View File

@@ -374,7 +374,15 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col,
return wxColour(0xd6d6d6);
}
case CONTROL_TEXT: return *wxBLACK;
case CONTROL_TEXT: if ( flags & wxCONTROL_DISABLED )
{
return wxColour(0x757575);
}
else
{
return *wxBLACK;
}
case SCROLLBAR: return wxColour(0xc3c3c3);
case HIGHLIGHT: return wxColour(0x9c0000);
@@ -733,12 +741,12 @@ void wxGTKRenderer::DrawLabel(wxDC& dc,
if ( flags & wxCONTROL_DISABLED )
{
// make the text grey and draw a shade for it
dc.SetTextForeground(0xe0e0e0);
dc.SetTextForeground(*wxWHITE); // FIXME hardcoded colour
wxRect rectShadow = rect;
rectShadow.x++;
rectShadow.y++;
dc.DrawLabel(label, rectShadow, alignment, indexAccel);
dc.SetTextForeground(0x7f7f7f);
dc.SetTextForeground(m_scheme->Get(wxColourScheme::CONTROL_TEXT, flags));
}
dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
@@ -808,10 +816,17 @@ void wxGTKRenderer::DrawBackground(wxDC& dc,
const wxRect& rect,
int flags)
{
DoDrawBackground(dc,
col.Ok() ? col
: GetBackgroundColour(flags),
rect);
wxColour colBg;
if ( !col.Ok() )
{
colBg = m_scheme->Get(wxColourScheme::CONTROL, flags);
}
else
{
colBg = col;
}
DoDrawBackground(dc, colBg, rect);
}
// ----------------------------------------------------------------------------
@@ -1142,8 +1157,17 @@ wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
wxScrollBar::Element elem,
int thumbPos) const
{
// as GTK scrollbars can't be disabled, it makes no sense to remove the
// thumb for a scrollbar with range 0 - instead, make it fill the entire
// scrollbar shaft
if ( (elem == wxScrollBar::Element_Thumb) && !scrollbar->GetRange() )
{
elem = wxScrollBar::Element_Bar_2;
}
return StandardGetScrollbarRect(scrollbar, elem,
thumbPos, GetScrollbarArrowSize(scrollbar));
thumbPos,
GetScrollbarArrowSize(scrollbar));
}
wxCoord wxGTKRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)

View File

@@ -143,10 +143,8 @@ void wxWindow::OnErase(wxEraseEvent& event)
if ( m_scrollbarVert && m_scrollbarHorz )
{
wxRect rectCorner;
wxPoint ptOrigin = GetClientAreaOrigin();
wxSize sizeClient = GetClientSize();
rectCorner.x = ptOrigin.x + m_scrollbarHorz->GetSize().x;
rectCorner.y = ptOrigin.y + m_scrollbarVert->GetSize().y;
rectCorner.x = m_scrollbarHorz->GetSize().x;
rectCorner.y = m_scrollbarVert->GetSize().y;
rectCorner.width = m_scrollbarVert->GetSize().x;
rectCorner.height = m_scrollbarHorz->GetSize().y;
m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
@@ -306,20 +304,27 @@ void wxWindow::DoGetClientSize(int *width, int *height) const
if ( m_renderer )
rectBorder = m_renderer->GetBorderDimensions(GetBorder());
// TODO these calculations suppose that we position the scrollbars in such
// way that they overwrite some borders - when this is changed (see
// the next todo item below) this code must be updated too
if ( width )
{
if ( m_scrollbarVert )
*width -= m_scrollbarVert->GetSize().x;
else
*width -= rectBorder.width;
*width -= rectBorder.x + rectBorder.width;
*width -= rectBorder.x;
}
if ( height )
{
if ( m_scrollbarHorz )
*height -= m_scrollbarHorz->GetSize().y;
else
*height -= rectBorder.height;
*height -= rectBorder.y + rectBorder.height;
*height -= rectBorder.y;
}
}
@@ -331,25 +336,30 @@ void wxWindow::DoGetClientSize(int *width, int *height) const
void wxWindow::PositionScrollbars()
{
wxRect rectClient = GetClientRect();
int width = m_scrollbarVert ? m_scrollbarVert->GetSize().x : 0;
int height = m_scrollbarHorz ? m_scrollbarHorz->GetSize().y : 0;
wxRect rectClient = GetClientRect(),
rectTotal = wxRect(wxPoint(0, 0), GetSize());
// TODO we should be smarter about combining the scrollbar borders with
// the window ones - so far we just blend the right and bottom
// borders of the vertical scrollbar (and left/bottom of the
// horizontal one) into the window border, but this risks to look
// ugly with other renderers/border styles
if ( m_scrollbarVert )
{
m_scrollbarVert->SetSize(rectClient.GetRight() - 1,
rectClient.GetTop() - 2,
width,
rectClient.GetHeight());
m_scrollbarVert->SetSize(rectClient.GetRight() + 1,
rectTotal.GetTop(),
m_scrollbarVert->GetSize().x,
m_scrollbarHorz ? rectClient.GetBottom() + 1
: rectTotal.GetBottom() + 1);
}
if ( m_scrollbarHorz )
{
m_scrollbarHorz->SetSize(rectClient.GetLeft() - 2,
rectClient.GetBottom() - 1,
rectClient.GetWidth(),
height);
m_scrollbarHorz->SetSize(rectTotal.GetLeft(),
rectClient.GetBottom() + 1,
m_scrollbarVert ? rectClient.GetRight() + 1
: rectTotal.GetRight() + 1,
m_scrollbarHorz->GetSize().y);
}
}