attemps to make listbox refreshing to work - failed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,6 +106,9 @@ public:
|
||||
// override some more base class methods
|
||||
virtual bool SetFont(const wxFont& font);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
|
||||
// the wxUniversal-specific additions
|
||||
|
||||
// the current item is the same as the selected one for wxLB_SINGLE
|
||||
|
@@ -48,8 +48,8 @@
|
||||
|
||||
#include "wx/univ/theme.h"
|
||||
|
||||
#define DEBUG_SCROLL
|
||||
//#define DEBUG_LISTBOX
|
||||
//#define DEBUG_SCROLL
|
||||
#define DEBUG_LISTBOX
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
|
@@ -264,6 +264,15 @@ int wxListBox::GetSelections(wxArrayInt& selections) const
|
||||
// added/deleted/changed subsequently
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBox::Refresh(bool eraseBackground, const wxRect *rect)
|
||||
{
|
||||
// do nothing here if we didn't call it ourselves
|
||||
if ( m_updateCount )
|
||||
{
|
||||
wxControl::Refresh(eraseBackground, rect);
|
||||
}
|
||||
}
|
||||
|
||||
void wxListBox::RefreshItems(int from, int count)
|
||||
{
|
||||
switch ( m_updateCount )
|
||||
@@ -342,14 +351,16 @@ void wxListBox::OnIdle(wxIdleEvent& event)
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace(_T("listbox"), _T("Refreshing items %d..%d"),
|
||||
m_updateFrom, m_updateFrom + m_updateCount);
|
||||
|
||||
wxRect rect;
|
||||
rect.x = 0;
|
||||
rect.y = m_updateFrom*GetLineHeight();
|
||||
rect.width = 32767; // larger than our size
|
||||
rect.height = m_updateCount*GetLineHeight();
|
||||
|
||||
wxLogTrace(_T("listbox"), _T("Refreshing items %d..%d (%d-%d)"),
|
||||
m_updateFrom, m_updateFrom + m_updateCount,
|
||||
rect.GetTop(), rect.GetBottom());
|
||||
|
||||
Refresh(TRUE, &rect);
|
||||
}
|
||||
|
||||
@@ -376,7 +387,8 @@ void wxListBox::DoDraw(wxControlRenderer *renderer)
|
||||
GetViewStart(NULL, &y);
|
||||
#endif
|
||||
wxCoord lineHeight = GetLineHeight();
|
||||
wxRect rectUpdate = GetUpdateRegion().GetBox();
|
||||
wxRegion rgnUpdate = GetUpdateRegion();
|
||||
wxRect rectUpdate = rgnUpdate.GetBox();
|
||||
size_t itemFirst = rectUpdate.GetTop() / lineHeight,
|
||||
itemLast = (rectUpdate.GetBottom() + lineHeight - 1) / lineHeight,
|
||||
itemMax = m_strings.GetCount();
|
||||
@@ -390,6 +402,7 @@ void wxListBox::DoDraw(wxControlRenderer *renderer)
|
||||
// do draw them
|
||||
wxLogTrace(_T("listbox"), _T("Repainting items %d..%d"),
|
||||
itemFirst, itemLast);
|
||||
dc.SetClippingRegion(rgnUpdate);
|
||||
renderer->DrawItems(this, itemFirst, itemLast);
|
||||
}
|
||||
|
||||
@@ -411,7 +424,7 @@ bool wxListBox::SetFont(const wxFont& font)
|
||||
|
||||
void wxListBox::CalcItemsPerPage()
|
||||
{
|
||||
m_lineHeight = wxClientDC(this).GetCharHeight();
|
||||
m_lineHeight = wxClientDC(this).GetCharHeight() + 2;
|
||||
m_itemsPerPage = GetClientSize().y / m_lineHeight;
|
||||
}
|
||||
|
||||
@@ -671,7 +684,8 @@ bool wxStdListboxInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdListboxInputHandler::HandleMouseMove(wxControl *control,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
// we don't react to this at all
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
@@ -166,7 +166,7 @@ protected:
|
||||
|
||||
// returns the size of the arrow for the scrollbar (depends on
|
||||
// orientation)
|
||||
wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar)
|
||||
wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const
|
||||
{
|
||||
wxSize size;
|
||||
if ( scrollbar->IsVertical() )
|
||||
@@ -371,8 +371,8 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col,
|
||||
case CONTROL_TEXT: return *wxBLACK;
|
||||
case SCROLLBAR: return wxColour(0xc3c3c3);
|
||||
|
||||
case HIGHLIGHT: return wxColour(0x0000ff);
|
||||
case HIGHLIGHT_TEXT: return wxColour(0x00ffff);
|
||||
case HIGHLIGHT: return wxColour(0x9c0000);
|
||||
case HIGHLIGHT_TEXT: return wxColour(0xffffff);
|
||||
|
||||
case MAX:
|
||||
default:
|
||||
@@ -705,24 +705,36 @@ void wxGTKRenderer::DrawItem(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags)
|
||||
{
|
||||
wxLogTrace(_T("listbox"), _T("drawing item '%s' at (%d, %d)-(%d, %d)"),
|
||||
label.c_str(),
|
||||
rect.x, rect.y,
|
||||
rect.x + rect.width, rect.y + rect.height);
|
||||
|
||||
wxColour colFg;
|
||||
if ( flags & wxCONTROL_SELECTED )
|
||||
{
|
||||
dc.SetTextBackground(m_scheme->Get(wxColourScheme::HIGHLIGHT));
|
||||
dc.SetBrush(wxBrush(m_scheme->Get(wxColourScheme::HIGHLIGHT), wxSOLID));
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(rect);
|
||||
|
||||
colFg = dc.GetTextForeground();
|
||||
dc.SetTextForeground(m_scheme->Get(wxColourScheme::HIGHLIGHT_TEXT));
|
||||
dc.SetBackgroundMode(wxSOLID);
|
||||
}
|
||||
|
||||
dc.DrawLabel(label, wxNullBitmap, rect);
|
||||
wxRect rectText = rect;
|
||||
rectText.x += 2;
|
||||
rectText.y++;
|
||||
dc.DrawLabel(label, wxNullBitmap, rectText);
|
||||
|
||||
if ( flags & wxCONTROL_SELECTED )
|
||||
{
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
}
|
||||
|
||||
if ( flags & wxCONTROL_FOCUSED )
|
||||
// restore the text colour
|
||||
if ( colFg.Ok() )
|
||||
{
|
||||
wxRect rectFocus = rect;
|
||||
DrawRect(dc, &rectFocus, m_penBlack);
|
||||
dc.SetTextForeground(colFg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,6 +1220,12 @@ bool wxGTKInputHandler::HandleMouseMove(wxControl *control,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// don't refresh static controls uselessly - they never react to this
|
||||
if ( control->AcceptsFocus() )
|
||||
{
|
||||
control->Refresh();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user