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
wxCursor *m_resizeCursor;
bool m_isDragging;
- // column being resized
+ // column being resized or -1
int m_column;
// divider line position in logical (unscrolled) coords
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)
int xpos = 0;
// find the column where this event occured
- int countCol = m_owner->GetColumnCount();
- for (int col = 0; col < countCol; col++)
+ int col,
+ countCol = m_owner->GetColumnCount();
+ for (col = 0; col < countCol; col++)
{
xpos += m_owner->GetColumnWidth( col );
m_column = col;
m_minX = xpos;
}
+ if ( col == countCol )
+ m_column = -1;
+
if (event.LeftDown() || event.RightUp())
{
if (hit_border && event.LeftDown())
// 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)
if ( ld->HasImage() && GetLineIconRect(line).Inside(x, y) )
return wxLIST_HITTEST_ONITEMICON;
- if ( ld->HasText() )
+ // VS: Testing for "ld->HasText() || InReportView()" instead of
+ // "ld->HasText()" is needed to make empty lines in report view
+ // possible
+ if ( ld->HasText() || InReportView() )
{
wxRect rect = InReportView() ? GetLineRect(line)
: GetLineLabelRect(line);
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()
if (m_dirty)
wxSafeYield();
- wxClientDC dc(this);
- PrepareDC( dc );
-
wxString s = data->GetText(0);
wxRect rectLabel = GetLineLabelRect(m_currentEdit);
- rectLabel.x = dc.LogicalToDeviceX( rectLabel.x );
- rectLabel.y = dc.LogicalToDeviceY( rectLabel.y );
+ CalcScrolledPosition(rectLabel.x, rectLabel.y, &rectLabel.x, &rectLabel.y);
wxListTextCtrl *text = new wxListTextCtrl
(
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 );
m_dirty = TRUE;
m_columns.DeleteNode( node );
+
+ // invalidate it as it has to be recalculated
+ m_headerWidth = 0;
}
void wxListMainWindow::DoDeleteAllItems()
{
m_columns.Append( column );
}
+
+ // invalidate it as it has to be recalculated
+ m_headerWidth = 0;
}
}
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();
}
}