Tried to prevent scrollbars from scrolling as
per MSW, didn't work. Added DeleteAllItems event and test to listctrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -107,7 +107,7 @@ public:
|
|||||||
void ShowHidden( bool show = TRUE );
|
void ShowHidden( bool show = TRUE );
|
||||||
long Add( wxFileData *fd, wxListItem &item );
|
long Add( wxFileData *fd, wxListItem &item );
|
||||||
void Update();
|
void Update();
|
||||||
virtual void StatusbarText( char *WXUNUSED(text) ) {};
|
virtual void StatusbarText( wxChar *WXUNUSED(text) ) {};
|
||||||
void MakeDir();
|
void MakeDir();
|
||||||
void GoToParentDir();
|
void GoToParentDir();
|
||||||
void GoToHomeDir();
|
void GoToHomeDir();
|
||||||
@@ -115,6 +115,7 @@ public:
|
|||||||
void SetWild( const wxString &wild );
|
void SetWild( const wxString &wild );
|
||||||
void GetDir( wxString &dir );
|
void GetDir( wxString &dir );
|
||||||
void OnListDeleteItem( wxListEvent &event );
|
void OnListDeleteItem( wxListEvent &event );
|
||||||
|
void OnListDeleteAllItems( wxListEvent &event );
|
||||||
void OnListEndLabelEdit( wxListEvent &event );
|
void OnListEndLabelEdit( wxListEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -56,6 +56,7 @@ BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
|
|||||||
EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnBeginLabelEdit)
|
EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnBeginLabelEdit)
|
||||||
EVT_LIST_END_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnEndLabelEdit)
|
EVT_LIST_END_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnEndLabelEdit)
|
||||||
EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
|
EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
|
||||||
|
EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
|
||||||
EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
|
EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
|
||||||
EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
|
EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
|
||||||
EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected)
|
EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected)
|
||||||
@@ -486,6 +487,18 @@ void MyListCtrl::OnDeleteItem(wxListEvent& WXUNUSED(event))
|
|||||||
text->WriteText("OnDeleteItem\n");
|
text->WriteText("OnDeleteItem\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyListCtrl::OnDeleteAllItems(wxListEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
if ( !wxGetApp().GetTopWindow() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
|
||||||
|
if ( !text )
|
||||||
|
return;
|
||||||
|
|
||||||
|
text->WriteText("OnDeleteAllItems\n");
|
||||||
|
}
|
||||||
|
|
||||||
void MyListCtrl::OnGetInfo(wxListEvent& event)
|
void MyListCtrl::OnGetInfo(wxListEvent& event)
|
||||||
{
|
{
|
||||||
if ( !wxGetApp().GetTopWindow() )
|
if ( !wxGetApp().GetTopWindow() )
|
||||||
|
@@ -34,6 +34,7 @@ public:
|
|||||||
void OnBeginLabelEdit(wxListEvent& event);
|
void OnBeginLabelEdit(wxListEvent& event);
|
||||||
void OnEndLabelEdit(wxListEvent& event);
|
void OnEndLabelEdit(wxListEvent& event);
|
||||||
void OnDeleteItem(wxListEvent& event);
|
void OnDeleteItem(wxListEvent& event);
|
||||||
|
void OnDeleteAllItems(wxListEvent& event);
|
||||||
void OnGetInfo(wxListEvent& event);
|
void OnGetInfo(wxListEvent& event);
|
||||||
void OnSetInfo(wxListEvent& event);
|
void OnSetInfo(wxListEvent& event);
|
||||||
void OnSelected(wxListEvent& event);
|
void OnSelected(wxListEvent& event);
|
||||||
|
@@ -444,11 +444,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl);
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
||||||
EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem)
|
EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem)
|
||||||
|
EVT_LIST_DELETE_ALL_ITEMS(-1, wxFileCtrl::OnListDeleteAllItems)
|
||||||
EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit)
|
EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxFileCtrl::wxFileCtrl()
|
wxFileCtrl::wxFileCtrl()
|
||||||
{
|
{
|
||||||
m_dirName = wxT("/");
|
m_dirName = wxT("/");
|
||||||
@@ -682,6 +682,23 @@ void wxFileCtrl::OnListDeleteItem( wxListEvent &event )
|
|||||||
delete fd;
|
delete fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFileCtrl::OnListDeleteAllItems( wxListEvent &WXUNUSED(event) )
|
||||||
|
{
|
||||||
|
wxListItem item;
|
||||||
|
item.m_mask = wxLIST_MASK_DATA;
|
||||||
|
|
||||||
|
item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL );
|
||||||
|
while ( item.m_itemId != -1 )
|
||||||
|
{
|
||||||
|
GetItem( item );
|
||||||
|
wxFileData *fd = (wxFileData*)item.m_data;
|
||||||
|
delete fd;
|
||||||
|
item.m_data = (void*) NULL;
|
||||||
|
SetItem( item );
|
||||||
|
item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
|
void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
|
||||||
{
|
{
|
||||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||||
|
@@ -1171,6 +1171,8 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxListMainWindow::~wxListMainWindow()
|
wxListMainWindow::~wxListMainWindow()
|
||||||
{
|
{
|
||||||
|
DeleteEverything();
|
||||||
|
|
||||||
if (m_hilightBrush) delete m_hilightBrush;
|
if (m_hilightBrush) delete m_hilightBrush;
|
||||||
|
|
||||||
delete m_renameTimer;
|
delete m_renameTimer;
|
||||||
@@ -2392,7 +2394,7 @@ void wxListMainWindow::DeleteColumn( int col )
|
|||||||
if (node) m_columns.DeleteNode( node );
|
if (node) m_columns.DeleteNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::DeleteAllItems( void )
|
void wxListMainWindow::DeleteAllItems()
|
||||||
{
|
{
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
m_current = (wxListLineData *) NULL;
|
m_current = (wxListLineData *) NULL;
|
||||||
@@ -2400,34 +2402,18 @@ void wxListMainWindow::DeleteAllItems( void )
|
|||||||
// to make the deletion of all items faster, we don't send the
|
// to make the deletion of all items faster, we don't send the
|
||||||
// notifications in this case: this is compatible with wxMSW and
|
// notifications in this case: this is compatible with wxMSW and
|
||||||
// documented in DeleteAllItems() description
|
// documented in DeleteAllItems() description
|
||||||
#if 0
|
|
||||||
wxNode *node = m_lines.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
|
||||||
|
|
||||||
DeleteLine( line );
|
wxListEvent event( wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, GetParent()->GetId() );
|
||||||
|
event.SetEventObject( GetParent() );
|
||||||
node = node->Next();
|
GetParent()->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
m_lines.Clear();
|
m_lines.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::DeleteEverything( void )
|
void wxListMainWindow::DeleteEverything()
|
||||||
{
|
{
|
||||||
m_dirty = TRUE;
|
DeleteAllItems();
|
||||||
m_current = (wxListLineData *) NULL;
|
|
||||||
wxNode *node = m_lines.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
|
||||||
DeleteLine( line );
|
|
||||||
node = node->Next();
|
|
||||||
}
|
|
||||||
m_lines.Clear();
|
|
||||||
m_current = (wxListLineData *) NULL;
|
|
||||||
m_columns.Clear();
|
m_columns.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1577,54 +1577,6 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindow *win )
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "changed" from m_vAdjust
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
|
|
||||||
{
|
|
||||||
DEBUG_MAIN_THREAD
|
|
||||||
|
|
||||||
if (g_isIdle)
|
|
||||||
wxapp_install_idle_handler();
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
|
||||||
if (!win->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
|
|
||||||
int value = (int)(win->m_vAdjust->value+0.5);
|
|
||||||
|
|
||||||
wxScrollWinEvent event( command, value, wxVERTICAL );
|
|
||||||
event.SetEventObject( win );
|
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "changed" from m_hAdjust
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
|
|
||||||
{
|
|
||||||
DEBUG_MAIN_THREAD
|
|
||||||
|
|
||||||
if (g_isIdle)
|
|
||||||
wxapp_install_idle_handler();
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
|
||||||
if (!win->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
|
|
||||||
int value = (int)(win->m_hAdjust->value+0.5);
|
|
||||||
|
|
||||||
wxScrollWinEvent event( command, value, wxHORIZONTAL );
|
|
||||||
event.SetEventObject( win );
|
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "button_press_event" from scrollbar
|
// "button_press_event" from scrollbar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -2119,13 +2071,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
|
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
|
||||||
(GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
|
(GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_widget_show( m_wxwindow );
|
gtk_widget_show( m_wxwindow );
|
||||||
|
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
@@ -3334,33 +3279,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orient == wxHORIZONTAL)
|
if (orient == wxHORIZONTAL)
|
||||||
{
|
|
||||||
/*
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_hAdjust),
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
/*
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_vAdjust),
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
||||||
|
@@ -1577,54 +1577,6 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindow *win )
|
|||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "changed" from m_vAdjust
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
|
|
||||||
{
|
|
||||||
DEBUG_MAIN_THREAD
|
|
||||||
|
|
||||||
if (g_isIdle)
|
|
||||||
wxapp_install_idle_handler();
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
|
||||||
if (!win->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
|
|
||||||
int value = (int)(win->m_vAdjust->value+0.5);
|
|
||||||
|
|
||||||
wxScrollWinEvent event( command, value, wxVERTICAL );
|
|
||||||
event.SetEventObject( win );
|
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "changed" from m_hAdjust
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
|
|
||||||
{
|
|
||||||
DEBUG_MAIN_THREAD
|
|
||||||
|
|
||||||
if (g_isIdle)
|
|
||||||
wxapp_install_idle_handler();
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
|
||||||
if (!win->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
|
|
||||||
int value = (int)(win->m_hAdjust->value+0.5);
|
|
||||||
|
|
||||||
wxScrollWinEvent event( command, value, wxHORIZONTAL );
|
|
||||||
event.SetEventObject( win );
|
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "button_press_event" from scrollbar
|
// "button_press_event" from scrollbar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -2119,13 +2071,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
|
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
|
||||||
(GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
|
(GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_widget_show( m_wxwindow );
|
gtk_widget_show( m_wxwindow );
|
||||||
|
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
@@ -3334,33 +3279,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (orient == wxHORIZONTAL)
|
if (orient == wxHORIZONTAL)
|
||||||
{
|
|
||||||
/*
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_hAdjust),
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
/*
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_vAdjust),
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
|
||||||
|
|
||||||
/*
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_vAdjust), "changed",
|
|
||||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
|
||||||
|
Reference in New Issue
Block a user