]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/vlbox.cpp
no real change; just add the standard separator where it's missing
[wxWidgets.git] / src / generic / vlbox.cpp
index df4a9bbfb0c70d4868ab72f39e0a09309a31e232..13ce1b6278faa2c1d41804cd367edb869f2fc409 100644 (file)
@@ -51,6 +51,8 @@ BEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow)
 
     EVT_SET_FOCUS(wxVListBox::OnSetOrKillFocus)
     EVT_KILL_FOCUS(wxVListBox::OnSetOrKillFocus)
+
+    EVT_SIZE(wxVListBox::OnSize)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -58,6 +60,7 @@ END_EVENT_TABLE()
 // ============================================================================
 
 IMPLEMENT_ABSTRACT_CLASS(wxVListBox, wxVScrolledWindow)
+const char wxVListBoxNameStr[] = "wxVListBox";
 
 // ----------------------------------------------------------------------------
 // wxVListBox creation
@@ -258,15 +261,19 @@ bool wxVListBox::DoSetCurrent(int current)
     return true;
 }
 
+void wxVListBox::InitEvent(wxCommandEvent& event, int n)
+{
+    event.SetEventObject(this);
+    event.SetInt(n);
+}
+
 void wxVListBox::SendSelectedEvent()
 {
     wxASSERT_MSG( m_current != wxNOT_FOUND,
                     _T("SendSelectedEvent() shouldn't be called") );
 
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
-    event.SetEventObject(this);
-    event.SetInt(m_current);
-
+    InitEvent(event, m_current);
     (void)GetEventHandler()->ProcessEvent(event);
 }
 
@@ -424,11 +431,11 @@ void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
             flags |= wxCONTROL_SELECTED;
         if ( IsCurrent(n) )
             flags |= wxCONTROL_CURRENT;
-        if ( wxWindow::FindFocus() == wx_const_cast(wxVListBox*, this) )
+        if ( wxWindow::FindFocus() == const_cast<wxVListBox*>(this) )
             flags |= wxCONTROL_FOCUSED;
 
         wxRendererNative::Get().DrawItemSelectionRect(
-            wx_const_cast(wxVListBox *, this), dc, rect, flags);
+            const_cast<wxVListBox *>(this), dc, rect, flags);
     }
 }
 
@@ -494,6 +501,11 @@ void wxVListBox::OnSetOrKillFocus(wxFocusEvent& WXUNUSED(event))
     RefreshSelected();
 }
 
+void wxVListBox::OnSize(wxSizeEvent& event)
+{
+    UpdateScrollbar();
+    event.Skip();
+}
 
 // ============================================================================
 // wxVListBox keyboard/mouse handling
@@ -700,9 +712,7 @@ void wxVListBox::OnLeftDClick(wxMouseEvent& eventMouse)
         if ( item == m_current )
         {
             wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, GetId());
-            event.SetEventObject(this);
-            event.SetInt(item);
-
+            InitEvent(event, item);
             (void)GetEventHandler()->ProcessEvent(event);
         }
         else