Implement wxComboBox::Popup() and Dismiss() for wxOSX/Cocoa.

Unlike in the other ports, these methods currently don't generate any events
under OS X because these events are never generated at all there.

Closes #12642.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-12-07 23:41:06 +00:00
parent f089d73634
commit ff8cb900da
7 changed files with 37 additions and 5 deletions

View File

@@ -509,6 +509,7 @@ OSX:
for OS X 10.6.
- Added wxApp::MacOpenFiles and deprecated wxApp::MacOpenFile.
- Implement wxEVT_CHAR_HOOK event generation in wxOSX/Cocoa.
- Implemented wxComboBox::Popup() and Dismiss() in wxOSX/Cocoa (joostn).
GTK:

View File

@@ -105,6 +105,9 @@ public :
virtual wxString GetStringAtIndex(int pos) const;
virtual int FindString(const wxString& text) const;
virtual void Popup();
virtual void Dismiss();
private:
NSComboBox* m_comboBox;
};

View File

@@ -139,6 +139,8 @@ class WXDLLIMPEXP_CORE wxComboBox :
virtual wxTextWidgetImpl* GetTextPeer() const;
#endif // wxOSX_USE_CARBON
virtual void Popup();
virtual void Dismiss();
// osx specific event handling common for all osx-ports

View File

@@ -690,6 +690,8 @@ public :
virtual void RemoveItem(int WXUNUSED(pos)) {}
virtual void Clear() {}
virtual void Popup() {}
virtual void Dismiss() {}
virtual wxString GetStringAtIndex(int WXUNUSED(pos)) const { return wxEmptyString; }

View File

@@ -285,10 +285,11 @@ public:
/**
Shows the list box portion of the combo box.
Currently only implemented in wxMSW and wxGTK.
Currently this method is implemented in wxMSW, wxGTK and wxOSX/Cocoa.
Notice that calling this function will generate a
@c wxEVT_COMMAND_COMBOBOX_DROPDOWN event.
@c wxEVT_COMMAND_COMBOBOX_DROPDOWN event except under wxOSX where
generation of this event is not supported at all.
@since 2.9.1
*/
@@ -297,10 +298,11 @@ public:
/**
Hides the list box portion of the combo box.
Currently only implemented in wxMSW and wxGTK.
Currently this method is implemented in wxMSW, wxGTK and wxOSX/Cocoa.
Notice that calling this function will generate a
@c wxEVT_COMMAND_COMBOBOX_CLOSEUP event.
@c wxEVT_COMMAND_COMBOBOX_CLOSEUP event except under wxOSX where
generation of this event is not supported at all.
@since 2.9.1
*/

View File

@@ -165,6 +165,18 @@ int wxNSComboBoxControl::FindString(const wxString& text) const
return result;
}
void wxNSComboBoxControl::Popup()
{
id ax = NSAccessibilityUnignoredDescendant(m_comboBox);
[ax accessibilitySetValue: [NSNumber numberWithBool: YES] forAttribute: NSAccessibilityExpandedAttribute];
}
void wxNSComboBoxControl::Dismiss()
{
id ax = NSAccessibilityUnignoredDescendant(m_comboBox);
[ax accessibilitySetValue: [NSNumber numberWithBool: NO] forAttribute: NSAccessibilityExpandedAttribute];
}
wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxComboBox* wxpeer,
wxWindowMac* WXUNUSED(parent),
wxWindowID WXUNUSED(id),

View File

@@ -215,4 +215,14 @@ wxComboWidgetImpl* wxComboBox::GetComboPeer() const
return dynamic_cast<wxComboWidgetImpl*> (GetPeer());
}
void wxComboBox::Popup()
{
GetComboPeer()->Popup();
}
void wxComboBox::Dismiss()
{
GetComboPeer()->Dismiss();
}
#endif // wxUSE_COMBOBOX && wxOSX_USE_COCOA