X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c62bcbeeb1f0f7fafc72544acc7d9caf1d0df1d..3b5d20079c81e0106b3dead7cd8d7337bf3f36f4:/src/mac/carbon/srchctrl.cpp diff --git a/src/mac/carbon/srchctrl.cpp b/src/mac/carbon/srchctrl.cpp index 6ec0a7b394..223ed8fcb1 100644 --- a/src/mac/carbon/srchctrl.cpp +++ b/src/mac/carbon/srchctrl.cpp @@ -43,7 +43,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase) static const EventTypeSpec eventList[] = { { kEventClassSearchField, kEventSearchFieldCancelClicked } , +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 { kEventClassSearchField, kEventSearchFieldSearchClicked } , +#endif }; class wxMacSearchFieldControl : public wxMacUnicodeTextControl @@ -76,10 +78,12 @@ private: void wxMacSearchFieldControl::CreateControl( wxTextCtrl* /*peer*/, const Rect* bounds, CFStringRef crf ) { OptionBits attributes = 0; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if ( UMAGetSystemVersion() >= 0x1040 ) { attributes = kHISearchFieldAttributesSearchIcon; } +#endif HIRect hibounds = { { bounds->left, bounds->top }, { bounds->right-bounds->left, bounds->bottom-bounds->top } }; verify_noerr( HISearchFieldCreate( &hibounds, @@ -94,6 +98,7 @@ void wxMacSearchFieldControl::CreateControl( wxTextCtrl* /*peer*/, const Rect* b // search field options void wxMacSearchFieldControl::ShowSearchButton( bool show ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if ( UMAGetSystemVersion() >= 0x1040 ) { OptionBits set = 0; @@ -108,13 +113,18 @@ void wxMacSearchFieldControl::ShowSearchButton( bool show ) } HISearchFieldChangeAttributes( m_controlRef, set, clear ); } +#endif } bool wxMacSearchFieldControl::IsSearchButtonVisible() const { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 OptionBits attributes = 0; verify_noerr( HISearchFieldGetAttributes( m_controlRef, &attributes ) ); return ( attributes & kHISearchFieldAttributesSearchIcon ) != 0; +#else + return false; +#endif } void wxMacSearchFieldControl::ShowCancelButton( bool show ) @@ -178,9 +188,11 @@ static pascal OSStatus wxMacSearchControlEventHandler( EventHandlerCallRef handl case kEventSearchFieldCancelClicked : thisWindow->MacSearchFieldCancelHit( handler , event ) ; break ; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 case kEventSearchFieldSearchClicked : thisWindow->MacSearchFieldSearchHit( handler , event ) ; break ; +#endif } return result ; @@ -341,7 +353,7 @@ bool wxSearchCtrl::IsCancelButtonVisible() const wxInt32 wxSearchCtrl::MacSearchFieldSearchHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) { - wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH, m_windowId ); + wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, m_windowId ); event.SetEventObject(this); ProcessCommand(event); return eventNotHandledErr ; @@ -349,7 +361,7 @@ wxInt32 wxSearchCtrl::MacSearchFieldSearchHit(WXEVENTHANDLERREF WXUNUSED(handler wxInt32 wxSearchCtrl::MacSearchFieldCancelHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) { - wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_CANCEL, m_windowId ); + wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, m_windowId ); event.SetEventObject(this); ProcessCommand(event); return eventNotHandledErr ;