wxListCtrl selection improved
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1098,9 +1098,60 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
{
|
{
|
||||||
m_usedKeys = FALSE;
|
m_usedKeys = FALSE;
|
||||||
wxListLineData *oldCurrent = m_current;
|
wxListLineData *oldCurrent = m_current;
|
||||||
m_current = line;
|
if (m_mode & wxLC_SINGLE_SEL)
|
||||||
if (!event.ShiftDown() || (m_mode & wxLC_SINGLE_SEL)) HilightAll( FALSE );
|
{
|
||||||
m_current->ReverseHilight();
|
m_current = line;
|
||||||
|
HilightAll( FALSE );
|
||||||
|
m_current->ReverseHilight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (event.ShiftDown())
|
||||||
|
{
|
||||||
|
m_current = line;
|
||||||
|
m_current->ReverseHilight();
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_current = line;
|
||||||
|
HilightAll( FALSE );
|
||||||
|
m_current->ReverseHilight();
|
||||||
|
}
|
||||||
|
}
|
||||||
RefreshLine( m_current );
|
RefreshLine( m_current );
|
||||||
if (m_current != oldCurrent)
|
if (m_current != oldCurrent)
|
||||||
{
|
{
|
||||||
@@ -1248,6 +1299,12 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
case WXK_SPACE:
|
||||||
|
{
|
||||||
|
m_current->ReverseHilight();
|
||||||
|
RefreshLine( m_current );
|
||||||
|
};
|
||||||
|
break;
|
||||||
case WXK_INSERT:
|
case WXK_INSERT:
|
||||||
{
|
{
|
||||||
if (!(m_mode & wxLC_SINGLE_SEL))
|
if (!(m_mode & wxLC_SINGLE_SEL))
|
||||||
|
@@ -121,7 +121,7 @@ MyFrame::MyFrame(void) :
|
|||||||
SetStatusText( "Welcome", 0 );
|
SetStatusText( "Welcome", 0 );
|
||||||
SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
|
SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
|
||||||
|
|
||||||
wxToolBar *m_tb = CreateToolBar( ID_TOOLBAR );
|
wxToolBar *m_tb = CreateToolBar();
|
||||||
m_tb->SetMargins( 2, 2 );
|
m_tb->SetMargins( 2, 2 );
|
||||||
|
|
||||||
m_tb->AddSeparator();
|
m_tb->AddSeparator();
|
||||||
@@ -148,7 +148,7 @@ MyFrame::MyFrame(void) :
|
|||||||
m_tb->AddSeparator();
|
m_tb->AddSeparator();
|
||||||
m_tb->AddTool( ID_ABOUT, wxBitmap( help_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
|
m_tb->AddTool( ID_ABOUT, wxBitmap( help_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
|
||||||
|
|
||||||
m_tb->Layout();
|
m_tb->Realize();
|
||||||
|
|
||||||
m_splitter = new wxSplitterWindow( this, -1, wxPoint(0,0), wxSize(400,300), wxSP_3D );
|
m_splitter = new wxSplitterWindow( this, -1, wxPoint(0,0), wxSize(400,300), wxSP_3D );
|
||||||
|
|
||||||
|
@@ -62,7 +62,6 @@ class MyFrame: public wxFrame
|
|||||||
void OnTreeSelected( wxTreeEvent &event );
|
void OnTreeSelected( wxTreeEvent &event );
|
||||||
void OnTreeKeyDown( wxTreeEvent &event );
|
void OnTreeKeyDown( wxTreeEvent &event );
|
||||||
|
|
||||||
wxToolBar *m_tb;
|
|
||||||
wxSplitterWindow *m_splitter;
|
wxSplitterWindow *m_splitter;
|
||||||
wxFileCtrl *m_rightFile;
|
wxFileCtrl *m_rightFile;
|
||||||
wxFileCtrl *m_leftFile;
|
wxFileCtrl *m_leftFile;
|
||||||
|
Reference in New Issue
Block a user