]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/listctrl/listtest.cpp
Played a little with sockets.
[wxWidgets.git] / samples / listctrl / listtest.cpp
index d745798ddf6854ea789ccc18634cbd72788d0cc4..4d1ffa42c8fd882e9d6cc8bce9e4b8c977d7cafc 100644 (file)
@@ -56,6 +56,7 @@ BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
        EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected)
        EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected)
        EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
+       EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
 END_EVENT_TABLE()
 
 IMPLEMENT_APP(MyApp)
@@ -219,8 +220,8 @@ void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_LIST);
     m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_SMALL);
@@ -235,8 +236,8 @@ void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_REPORT);
     m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
@@ -257,8 +258,8 @@ void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnIconView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_ICON);
     m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
@@ -271,8 +272,8 @@ void MyFrame::OnIconView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_ICON);
     m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
@@ -287,8 +288,8 @@ void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnSmallIconView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON);
     m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
@@ -301,8 +302,8 @@ void MyFrame::OnSmallIconView(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnSmallIconTextView(wxCommandEvent& WXUNUSED(event))
 {
-       m_logWindow->Clear();
        m_listCtrl->DeleteAllItems();
+       m_logWindow->Clear();
        m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON);
     m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
     m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
@@ -449,7 +450,19 @@ void MyListCtrl::OnDeselected(wxListEvent& WXUNUSED(event))
        text->WriteText("OnDeselected\n");
 }
 
-void MyListCtrl::OnListKeyDown(wxListEvent& WXUNUSED(event))
+void MyListCtrl::OnActivated(wxListEvent& WXUNUSED(event))
+{
+       if ( !wxGetApp().GetTopWindow() )
+               return;
+
+       wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
+       if ( !text )
+               return;
+
+       text->WriteText("OnActivated\n");
+}
+
+void MyListCtrl::OnListKeyDown(wxListEvent& event)
 {
        if ( !wxGetApp().GetTopWindow() )
                return;
@@ -461,3 +474,4 @@ void MyListCtrl::OnListKeyDown(wxListEvent& WXUNUSED(event))
        text->WriteText("OnListKeyDown\n");
 }
 
+