#endif // HAVE_NATIVE_LISTCTRL/!HAVE_NATIVE_LISTCTRL
#include "wx/selstore.h"
-
#include "wx/renderer.h"
+#include "wx/math.h"
#ifdef __WXMAC__
#include "wx/mac/private.h"
#endif
-#include <math.h>
// NOTE: If using the wxListBox visual attributes works everywhere then this can
const wxString &name = _T("listctrlmainwindow") );
virtual ~wxListMainWindow();
-
+
wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); }
bool HasFlag(int flag) const { return m_parent->HasFlag(flag); }
void Freeze();
void Thaw();
- void SetFocus();
-
void OnRenameTimer();
bool OnRenameAccept(size_t itemEdit, const wxString& value);
void OnRenameCancelled(size_t itemEdit);
dc,
wxRect(x, HEADER_OFFSET_Y, cw, h - 2),
m_parent->IsEnabled() ? 0
- : wxCONTROL_DISABLED
+ : (int)wxCONTROL_DISABLED
);
// see if we have enough space for the column label
m_finished = true;
- m_owner->SetFocus();
+ m_owner->SetFocusIgnoringChildren();
}
}
switch ( event.m_keyCode )
{
case WXK_RETURN:
- if ( AcceptChanges() )
- {
- // Close the text control, changes were accepted
- Finish();
- }
- // else do nothing, do not accept and do not close
+ // Notify the owner about the changes
+ AcceptChanges();
+
+ // Even if vetoed, close the control (consistent with MSW)
+ Finish();
break;
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
return;
+ if (event.GetEventType() == wxEVT_MOUSEWHEEL)
+ {
+ // let the base handle mouse wheel events.
+ event.Skip();
+ return;
+ }
+
if ( !HasCurrent() || IsEmpty() )
return;
}
else if (event.RightDown())
{
+ // If the item is already selected, do not update the selection.
+ // Multi-selections should not be cleared if a selected item is clicked.
+ if (!IsHighlighted(current))
+ {
+ HighlightAll(false);
+ ChangeCurrent(current);
+ ReverseHighlight(m_current);
+ }
+
SendNotify( current, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
event.GetPosition() );
}
// focus handling
// ----------------------------------------------------------------------------
-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 = DoFindFocus();
-
- if ( oldFocus && oldFocus->GetParent() == this )
- {
- wxWindow::SetFocus();
- }
- else
- {
- wxScrolledWindow::SetFocus();
- }
-}
-
void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
{
if ( GetParent() )
iconSpacing = 0;
// Note that we do not call GetClientSize() here but
- // GetSize() and substract the border size for sunken
+ // GetSize() and subtract the border size for sunken
// borders manually. This is technically incorrect,
// but we need to know the client area's size WITHOUT
// scrollbars here. Since we don't know if there are
if (item.m_itemId > count)
item.m_itemId = count;
-
+
size_t id = item.m_itemId;
m_dirty = true;
wxListLineData *line = new wxListLineData(this);
- line->SetItem( 0, item );
+ line->SetItem( item.m_col, item );
m_lines.Insert( line, id );
m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0,0), size, style );
-#if defined( __WXMAC__ ) && __WXMAC_CARBON__
+#ifdef __WXMAC_CARBON__
// Human Interface Guidelines ask us for a special font in this case
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL )
{