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:
@@ -289,7 +289,7 @@ public:
|
|||||||
virtual void AdjustSize(wxSize *size, const wxWindow *window)
|
virtual void AdjustSize(wxSize *size, const wxWindow *window)
|
||||||
{ m_renderer->AdjustSize(size, window); }
|
{ m_renderer->AdjustSize(size, window); }
|
||||||
virtual wxRect GetBorderDimensions(wxBorder border) const
|
virtual wxRect GetBorderDimensions(wxBorder border) const
|
||||||
{ m_renderer->GetBorderDimensions(border); }
|
{ return m_renderer->GetBorderDimensions(border); }
|
||||||
|
|
||||||
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
|
virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
|
||||||
wxScrollBar::Element elem,
|
wxScrollBar::Element elem,
|
||||||
|
@@ -79,7 +79,7 @@ bool wxControl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_handler = CreateInputHandler();
|
m_handler = CreateInputHandler();
|
||||||
|
|
||||||
SetBackgroundColour(parent->GetBackgroundColour());
|
//SetBackgroundColour(parent->GetBackgroundColour());
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -376,8 +376,13 @@ void wxControlRenderer::DrawButtonBorder()
|
|||||||
|
|
||||||
m_renderer->DrawButtonBorder(m_dc, m_rect, flags, &m_rect);
|
m_renderer->DrawButtonBorder(m_dc, m_rect, flags, &m_rect);
|
||||||
|
|
||||||
m_renderer->DrawBackground(m_dc, m_window->GetBackgroundColour(),
|
wxColour colBg;
|
||||||
m_rect, flags);
|
if ( !(flags & wxCONTROL_CURRENT) )
|
||||||
|
{
|
||||||
|
colBg = m_window->GetBackgroundColour();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_renderer->DrawBackground(m_dc, colBg, m_rect, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControlRenderer::DrawBitmap(const wxBitmap& bitmap)
|
void wxControlRenderer::DrawBitmap(const wxBitmap& bitmap)
|
||||||
|
@@ -374,7 +374,15 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col,
|
|||||||
return wxColour(0xd6d6d6);
|
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 SCROLLBAR: return wxColour(0xc3c3c3);
|
||||||
|
|
||||||
case HIGHLIGHT: return wxColour(0x9c0000);
|
case HIGHLIGHT: return wxColour(0x9c0000);
|
||||||
@@ -733,12 +741,12 @@ void wxGTKRenderer::DrawLabel(wxDC& dc,
|
|||||||
if ( flags & wxCONTROL_DISABLED )
|
if ( flags & wxCONTROL_DISABLED )
|
||||||
{
|
{
|
||||||
// make the text grey and draw a shade for it
|
// make the text grey and draw a shade for it
|
||||||
dc.SetTextForeground(0xe0e0e0);
|
dc.SetTextForeground(*wxWHITE); // FIXME hardcoded colour
|
||||||
wxRect rectShadow = rect;
|
wxRect rectShadow = rect;
|
||||||
rectShadow.x++;
|
rectShadow.x++;
|
||||||
rectShadow.y++;
|
rectShadow.y++;
|
||||||
dc.DrawLabel(label, rectShadow, alignment, indexAccel);
|
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);
|
dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
|
||||||
@@ -808,10 +816,17 @@ void wxGTKRenderer::DrawBackground(wxDC& dc,
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
DoDrawBackground(dc,
|
wxColour colBg;
|
||||||
col.Ok() ? col
|
if ( !col.Ok() )
|
||||||
: GetBackgroundColour(flags),
|
{
|
||||||
rect);
|
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,
|
wxScrollBar::Element elem,
|
||||||
int thumbPos) const
|
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,
|
return StandardGetScrollbarRect(scrollbar, elem,
|
||||||
thumbPos, GetScrollbarArrowSize(scrollbar));
|
thumbPos,
|
||||||
|
GetScrollbarArrowSize(scrollbar));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxGTKRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)
|
wxCoord wxGTKRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)
|
||||||
|
@@ -143,10 +143,8 @@ void wxWindow::OnErase(wxEraseEvent& event)
|
|||||||
if ( m_scrollbarVert && m_scrollbarHorz )
|
if ( m_scrollbarVert && m_scrollbarHorz )
|
||||||
{
|
{
|
||||||
wxRect rectCorner;
|
wxRect rectCorner;
|
||||||
wxPoint ptOrigin = GetClientAreaOrigin();
|
rectCorner.x = m_scrollbarHorz->GetSize().x;
|
||||||
wxSize sizeClient = GetClientSize();
|
rectCorner.y = m_scrollbarVert->GetSize().y;
|
||||||
rectCorner.x = ptOrigin.x + m_scrollbarHorz->GetSize().x;
|
|
||||||
rectCorner.y = ptOrigin.y + m_scrollbarVert->GetSize().y;
|
|
||||||
rectCorner.width = m_scrollbarVert->GetSize().x;
|
rectCorner.width = m_scrollbarVert->GetSize().x;
|
||||||
rectCorner.height = m_scrollbarHorz->GetSize().y;
|
rectCorner.height = m_scrollbarHorz->GetSize().y;
|
||||||
m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
|
m_renderer->DrawScrollCorner(*event.GetDC(), rectCorner);
|
||||||
@@ -306,20 +304,27 @@ void wxWindow::DoGetClientSize(int *width, int *height) const
|
|||||||
if ( m_renderer )
|
if ( m_renderer )
|
||||||
rectBorder = m_renderer->GetBorderDimensions(GetBorder());
|
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 ( width )
|
||||||
{
|
{
|
||||||
if ( m_scrollbarVert )
|
if ( m_scrollbarVert )
|
||||||
*width -= m_scrollbarVert->GetSize().x;
|
*width -= m_scrollbarVert->GetSize().x;
|
||||||
|
else
|
||||||
|
*width -= rectBorder.width;
|
||||||
|
|
||||||
*width -= rectBorder.x + rectBorder.width;
|
*width -= rectBorder.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( height )
|
if ( height )
|
||||||
{
|
{
|
||||||
if ( m_scrollbarHorz )
|
if ( m_scrollbarHorz )
|
||||||
*height -= m_scrollbarHorz->GetSize().y;
|
*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()
|
void wxWindow::PositionScrollbars()
|
||||||
{
|
{
|
||||||
wxRect rectClient = GetClientRect();
|
wxRect rectClient = GetClientRect(),
|
||||||
|
rectTotal = wxRect(wxPoint(0, 0), GetSize());
|
||||||
int width = m_scrollbarVert ? m_scrollbarVert->GetSize().x : 0;
|
|
||||||
int height = m_scrollbarHorz ? m_scrollbarHorz->GetSize().y : 0;
|
|
||||||
|
|
||||||
|
// 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 )
|
if ( m_scrollbarVert )
|
||||||
{
|
{
|
||||||
m_scrollbarVert->SetSize(rectClient.GetRight() - 1,
|
m_scrollbarVert->SetSize(rectClient.GetRight() + 1,
|
||||||
rectClient.GetTop() - 2,
|
rectTotal.GetTop(),
|
||||||
width,
|
m_scrollbarVert->GetSize().x,
|
||||||
rectClient.GetHeight());
|
m_scrollbarHorz ? rectClient.GetBottom() + 1
|
||||||
|
: rectTotal.GetBottom() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_scrollbarHorz )
|
if ( m_scrollbarHorz )
|
||||||
{
|
{
|
||||||
m_scrollbarHorz->SetSize(rectClient.GetLeft() - 2,
|
m_scrollbarHorz->SetSize(rectTotal.GetLeft(),
|
||||||
rectClient.GetBottom() - 1,
|
rectClient.GetBottom() + 1,
|
||||||
rectClient.GetWidth(),
|
m_scrollbarVert ? rectClient.GetRight() + 1
|
||||||
height);
|
: rectTotal.GetRight() + 1,
|
||||||
|
m_scrollbarHorz->GetSize().y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user