wxListItemData *item = (wxListItemData*)node->Data();
if (item->HasImage() && IsInRect( x, y, m_bound_icon )) return wxLIST_HITTEST_ONITEMICON;
if (item->HasText() && IsInRect( x, y, m_bound_label )) return wxLIST_HITTEST_ONITEMLABEL;
- if (!(item->HasImage() || item->HasText())) return 0;
+// if (!(item->HasImage() || item->HasText())) return 0;
};
// if there is no icon or text = empty
if (IsInRect( x, y, m_bound_all )) return wxLIST_HITTEST_ONITEMICON;
};
if (hit)
{
-// if (m_currentCursor == wxSTANDARD_CURSOR) SetCursor( m_resizeCursor );
-// m_currentCursor = m_resizeCursor;
+ if (m_currentCursor == wxSTANDARD_CURSOR) SetCursor( m_resizeCursor );
+ m_currentCursor = m_resizeCursor;
}
else
{
-// if (m_currentCursor != wxSTANDARD_CURSOR) SetCursor( wxSTANDARD_CURSOR );
-// m_currentCursor = wxSTANDARD_CURSOR;
+ if (m_currentCursor != wxSTANDARD_CURSOR) SetCursor( wxSTANDARD_CURSOR );
+ m_currentCursor = wxSTANDARD_CURSOR;
};
};
};
m_lastOnSame = FALSE;
// m_renameTimer = new wxRenameTimer( this );
m_isCreated = FALSE;
- m_isDragging = FALSE;
+ m_dragCount = 0;
};
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
// AllowDoubleClick( TRUE );
m_myFont = wxNORMAL_FONT;
m_hasFocus = FALSE;
- m_isDragging = FALSE;
+ m_dragCount = 0;
m_isCreated = FALSE;
wxSize sz = size;
sz.y = 25;
m_text->SetFocus();
*/
/*
- char *res = wxGetTextFromUser( "Enter new name:", "", s );
+ char *res = wxGetTextFromUser( _("Enter new name:"), "", s );
if (res)
{
m_dirty = TRUE;
void wxListMainWindow::OnMouse( wxMouseEvent &event )
{
+ if (m_parent->ProcessEvent( event)) return;
+
if (!m_current) return;
if (m_dirty) return;
-// wxDragCanvas::OnEvent( event );
wxClientDC dc(this);
PrepareDC(dc);
node = node->Next();
};
- if (!event.Dragging()) m_isDragging = FALSE;
+ if (!event.Dragging())
+ m_dragCount = 0;
+ else
+ m_dragCount++;
- if (event.Dragging() && (!m_isDragging))
+ if (event.Dragging() && (m_dragCount > 3))
{
- m_isDragging = TRUE;
+ m_dragCount = 0;
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, m_parent->GetId() );
le.SetEventObject( this );
le.m_code = 0;
{
m_usedKeys = FALSE;
wxListLineData *oldCurrent = m_current;
- m_current = line;
- if (!event.ShiftDown() || (m_mode & wxLC_SINGLE_SEL)) HilightAll( FALSE );
- m_current->ReverseHilight();
- RefreshLine( m_current );
+ if (m_mode & wxLC_SINGLE_SEL)
+ {
+ m_current = line;
+ HilightAll( FALSE );
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ else
+ {
+ if (event.ShiftDown())
+ {
+ m_current = line;
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ else if (event.ControlDown())
+ {
+ m_current = line;
+ int numOfCurrent = -1;
+ node = m_lines.First();
+ while (node)
+ {
+ wxListLineData *test_line = (wxListLineData*)node->Data();
+ numOfCurrent++;
+ if (test_line == oldCurrent) break;
+ node = node->Next();
+ };
+ int numOfLine = -1;
+ node = m_lines.First();
+ while (node)
+ {
+ wxListLineData *test_line = (wxListLineData*)node->Data();
+ numOfLine++;
+ if (test_line == line) break;
+ node = node->Next();
+ };
+
+ if (numOfLine < numOfCurrent)
+ { int i = numOfLine; numOfLine = numOfCurrent; numOfCurrent = i; }
+ wxNode *node = m_lines.Nth( numOfCurrent );
+ for (int i = 0; i <= numOfLine-numOfCurrent; i++)
+ {
+ wxListLineData *test_line= (wxListLineData*)node->Data();
+ test_line->Hilight(TRUE);
+ RefreshLine( test_line );
+ node = node->Next();
+ }
+ }
+ else
+ {
+ m_current = line;
+ HilightAll( FALSE );
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ }
+ }
if (m_current != oldCurrent)
{
+ RefreshLine( oldCurrent );
UnfocusLine( oldCurrent );
FocusLine( m_current );
- RefreshLine( oldCurrent );
};
m_lastOnSame = (m_current == oldCurrent);
return;
void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
{
- UnfocusLine( m_current );
if ((m_mode & wxLC_SINGLE_SEL) || (m_usedKeys == FALSE)) m_current->Hilight( FALSE );
wxListLineData *oldCurrent = m_current;
m_current = newCurrent;
MoveToFocus();
if (shiftDown || (m_mode & wxLC_SINGLE_SEL)) m_current->Hilight( TRUE );
- FocusLine( m_current );
RefreshLine( m_current );
RefreshLine( oldCurrent );
+ FocusLine( m_current );
+ UnfocusLine( oldCurrent );
};
void wxListMainWindow::OnChar( wxKeyEvent &event )
};
break;
};
+ case WXK_SPACE:
+ {
+ m_current->ReverseHilight();
+ RefreshLine( m_current );
+ };
+ break;
case WXK_INSERT:
{
if (!(m_mode & wxLC_SINGLE_SEL))
{
wxListLineData *oldCurrent = m_current;
- UnfocusLine( m_current );
m_current->ReverseHilight();
wxNode *node = m_lines.Member( m_current )->Next();
if (node) m_current = (wxListLineData*)node->Data();
MoveToFocus();
- FocusLine( m_current );
- RefreshLine( m_current );
RefreshLine( oldCurrent );
+ RefreshLine( m_current );
+ UnfocusLine( oldCurrent );
+ FocusLine( m_current );
};
};
break;
{
if ((m_mode & wxLC_ICON) && (m_normal_image_list))
{
- m_normal_image_list->Draw( index, *dc, x, y );
+ m_normal_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
return;
};
if ((m_mode & wxLC_SMALL_ICON) && (m_small_image_list))
{
- m_small_image_list->Draw( index, *dc, x, y );
+ m_small_image_list->Draw( index, *dc, x, y, wxIMAGELIST_DRAW_TRANSPARENT );
};
};
};
};
+bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
+{
+ wxNode *node = m_lines.Nth( item );
+ if (node)
+ {
+ wxRectangle rect;
+ wxListLineData *line = (wxListLineData*)node->Data();
+ line->GetRect( rect );
+ pos.x = rect.x;
+ pos.y = rect.y;
+ }
+ else
+ {
+ pos.x = 0;
+ pos.y = 0;
+ };
+ return TRUE;
+};
+
int wxListMainWindow::GetSelectedItemCount( void )
{
int ret = 0;
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
+ if (m_current == line) m_current = NULL;
DeleteLine( line );
m_lines.DeleteNode( node );
};
void wxListMainWindow::DeleteAllItems( void )
{
m_dirty = TRUE;
+ m_current = NULL;
wxNode *node = m_lines.First();
while (node)
{
node = node->Next();
};
m_lines.Clear();
- m_current = NULL;
};
void wxListMainWindow::DeleteEverything( void )
{
m_dirty = TRUE;
+ m_current = NULL;
wxNode *node = m_lines.First();
while (node)
{
return TRUE;
};
-bool wxListCtrl::GetItemPosition( long WXUNUSED(item), wxPoint& WXUNUSED(pos) ) const
+bool wxListCtrl::GetItemPosition( long item, wxPoint& pos )
{
- return 0;
+ m_mainWin->GetItemPosition( item, pos );
+ return TRUE;
};
bool wxListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
return m_mainWin->GetItemCount();
};
+void wxListCtrl::SetItemSpacing( int spacing, bool isSmall )
+{
+ m_mainWin->SetItemSpacing( spacing, isSmall );
+};
+
int wxListCtrl::GetItemSpacing( bool isSmall )
{
return m_mainWin->GetItemSpacing( isSmall );
return TRUE;
};
-void wxListCtrl::OnIdle( wxIdleEvent &event )
+void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
{
if (!m_mainWin->m_dirty) return;
m_mainWin->CalculatePositions();
m_mainWin->RealizeChanges();
+ m_mainWin->m_dirty = FALSE;
m_mainWin->Refresh();
};