#include "wx/imaglist.h"
#include "wx/listctrl.h"
-#ifdef __WXGTK__
+#if defined(__WXGTK__)
#include <gtk/gtk.h>
#include "wx/gtk/win_gtk.h"
#endif
int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return n1 - n2; }
-WX_DEFINE_SORTED_EXPORTED_ARRAY(size_t, wxIndexArray);
+WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(size_t, wxIndexArray);
// this class is used to store the selected items in the virtual list control
// (but it is not tied to list control and so can be used with other controls
void OnKillFocus( wxFocusEvent &event );
private:
- DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
+ DECLARE_DYNAMIC_CLASS(wxListTextCtrl)
DECLARE_EVENT_TABLE()
};
// suspend/resume redrawing the control
void Freeze();
void Thaw();
+
+ void SetFocus();
void OnRenameTimer();
void OnRenameAccept();
// if this is > 0, the control is frozen and doesn't redraw itself
size_t m_freezeCount;
- DECLARE_DYNAMIC_CLASS(wxListMainWindow);
+ DECLARE_DYNAMIC_CLASS(wxListMainWindow)
DECLARE_EVENT_TABLE()
};
// wxListHeaderWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow);
+IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow)
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
{
-#ifdef __WXGTK__
+#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
GtkStateType state = m_parent->IsEnabled() ? GTK_STATE_NORMAL
: GTK_STATE_INSENSITIVE;
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
-#ifdef __WXGTK__
+#if defined(__WXGTK__)
wxClientDC dc( this );
#else
wxPaintDC dc( this );
{
int x1 = m_currentX;
int y1 = 0;
- ClientToScreen( &x1, &y1 );
+ m_owner->ClientToScreen( &x1, &y1 );
- int x2 = m_currentX-1;
+ int x2 = m_currentX;
int y2 = 0;
m_owner->GetClientSize( NULL, &y2 );
m_owner->ClientToScreen( &x2, &y2 );
// wxListTextCtrl (internal)
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl);
+IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl)
BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl)
EVT_CHAR (wxListTextCtrl::OnChar)
m_owner->OnRenameAccept();
m_finished = TRUE;
- m_owner->SetFocus(); // This doesn't work. TODO.
+ m_owner->SetFocus();
return;
}
wxPendingDelete.Append(this);
m_finished = TRUE;
- m_owner->SetFocus(); // This doesn't work. TODO.
+ m_owner->SetFocus();
return;
}
wxPoint myPos = GetPosition();
wxSize mySize = GetSize();
int sx, sy;
- GetTextExtent(GetValue() + _T("M"), &sx, &sy); // FIXME: MM??
+ GetTextExtent(GetValue() + _T("MM"), &sx, &sy);
if (myPos.x + sx > parentSize.x)
sx = parentSize.x - myPos.x;
if (mySize.x > sx)
// wxListMainWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow);
+IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow)
BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
EVT_PAINT (wxListMainWindow::OnPaint)
to = GetItemCount() - 1;
}
- // VZ: this code would work fine if wxGTK wxWindow::Refresh() were
- // reasonable, i.e. if it only generated one expose event for
- // several calls to it - as it is, each Refresh() results in a
- // repaint which provokes flicker too horrible to be seen
- //
- // when/if wxGTK is fixed, this code should be restored as normally it
- // should generate _less_ flicker than the version below
-#ifndef __WXGTK__
if ( HasCurrent() && m_current >= from && m_current <= to )
{
RefreshLine(m_current);
RefreshLine(line);
}
}
-#else // __WXGTK__
- size_t selMin = (size_t)-1,
- selMax = 0;
-
- for ( size_t line = from; line <= to; line++ )
- {
- if ( IsHighlighted(line) || (line == m_current) )
- {
- if ( line < selMin )
- selMin = line;
- if ( line > selMax )
- selMax = line;
- }
- }
-
- if ( selMin != (size_t)-1 )
- {
- RefreshLines(selMin, selMax);
- }
-#endif // !__WXGTK__/__WXGTK__
}
void wxListMainWindow::Freeze()
m_renameTimer->Stop();
m_lastOnSame = FALSE;
+#ifdef __WXGTK__
+ // FIXME: wxGTK generates bad sequence of events prior to doubleclick
+ // ("down, up, down, double, up" while other ports
+ // do "down, up, double, up"). We have to have this hack
+ // in place till somebody fixes wxGTK...
if ( current == m_lineBeforeLastClicked )
+#else
+ if ( current == m_lineLastClicked )
+#endif
{
SendNotify( current, wxEVT_COMMAND_LIST_ITEM_ACTIVATED );
// focus handling
// ----------------------------------------------------------------------------
-#ifdef __WXGTK__
-extern wxWindow *g_focusWindow;
-#endif
+void wxListMainWindow::SetFocus()
+{
+ // VS: wxListMainWindow derives from wxPanel (via wxScrolledWindow) and wxPanel
+ // overrides SetFocus in such way that it does never change focus from
+ // panel's child to the panel itself. Unfortunately, we must be able to change
+ // focus to the panel from wxListTextCtrl because the text control should
+ // disappear when the user clicks outside it.
+
+ wxWindow *oldFocus = FindFocus();
+
+ if ( oldFocus && oldFocus->GetParent() == this )
+ {
+ wxWindow::SetFocus();
+ }
+ else
+ {
+ wxScrolledWindow::SetFocus();
+ }
+}
void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
{
if ( !GetParent() )
return;
-#ifdef __WXGTK__
- g_focusWindow = GetParent();
-#endif
-
wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
event.SetEventObject( GetParent() );
GetParent()->GetEventHandler()->ProcessEvent( event );
wxListCtrl* lc = GetListCtrl();
wxCHECK_RET( lc, _T("no listctrl window?") );
- lc->m_headerWin->Refresh() ;
-#ifdef __WXMAC__
- lc->m_headerWin->MacUpdateImmediately() ;
-#endif
+ lc->m_headerWin->Refresh();
+ lc->m_headerWin->Update();
}
}