]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/odcombobox.cpp
Support using GetTextExtent() with empty string to get descent in wxOSX.
[wxWidgets.git] / samples / widgets / odcombobox.cpp
index ae95eab5ac76fdae9a30929d6fb244cca152cb75..c29e7e88ccdaf5c0495d58ebd602cefdc2477405 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     Jul-28-2006
 // Id:          $Id$
 // Copyright:   (c) 2006 Jaakko Salli
-// License:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -113,6 +113,8 @@ protected:
     void OnButtonAddMany(wxCommandEvent& event);
 
     void OnComboBox(wxCommandEvent& event);
+    void OnDropDown(wxCommandEvent& event);
+    void OnCloseUp(wxCommandEvent& event);
     void OnComboText(wxCommandEvent& event);
 
     void OnCheckOrRadioBox(wxCommandEvent& event);
@@ -218,6 +220,8 @@ BEGIN_EVENT_TABLE(ODComboboxWidgetsPage, WidgetsPage)
     EVT_UPDATE_UI(ODComboPage_ChangeText, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
     EVT_UPDATE_UI(ODComboPage_DeleteSel, ODComboboxWidgetsPage::OnUpdateUIDeleteSelButton)
 
+    EVT_COMBOBOX_DROPDOWN(ODComboPage_Combo, ODComboboxWidgetsPage::OnDropDown)
+    EVT_COMBOBOX_CLOSEUP(ODComboPage_Combo, ODComboboxWidgetsPage::OnCloseUp)
     EVT_COMBOBOX(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboBox)
     EVT_TEXT(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
     EVT_TEXT_ENTER(ODComboPage_Combo, ODComboboxWidgetsPage::OnComboText)
@@ -537,7 +541,7 @@ void ODComboboxWidgetsPage::CreateCombo()
 
     if ( m_chkBitmapbutton->GetValue() )
     {
-        wxBitmap bmpNormal = CreateBitmap(wxColour(0,0,255));
+        wxBitmap bmpNormal = CreateBitmap(*wxBLUE);
         wxBitmap bmpPressed = CreateBitmap(wxColour(0,0,128));
         wxBitmap bmpHover = CreateBitmap(wxColour(128,128,255));
         m_combobox->SetButtonBitmaps(bmpNormal,m_chkStdbutton->GetValue(),bmpPressed,bmpHover);
@@ -760,7 +764,7 @@ void ODComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
     wxASSERT_MSG( s == m_combobox->GetValue(),
                   wxT("event and combobox values should be the same") );
 
-    if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
+    if (event.GetEventType() == wxEVT_TEXT_ENTER)
     {
         wxLogMessage(wxT("OwnerDrawnCombobox enter pressed (now '%s')"), s.c_str());
     }
@@ -844,4 +848,14 @@ wxBitmap ODComboboxWidgetsPage::CreateBitmap(const wxColour& colour)
     return bmp;
 }
 
+void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
+{
+    wxLogMessage(wxT("Combobox dropped down"));
+}
+
+void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
+{
+    wxLogMessage(wxT("Combobox closed up"));
+}
+
 #endif //wxUSE_ODCOMBOBOX