Add support for wxTE_AUTO_URL to wxOSX
Recognize URLs by using native support for this available since OS X 10.5. Closes #17137.
This commit is contained in:
committed by
Vadim Zeitlin
parent
33d8d4e57c
commit
f5187859cc
@@ -201,8 +201,8 @@ wxOSX/Cocoa:
|
|||||||
- Implement wxWindow::Disable() for non-native controls too (Steve Browne).
|
- Implement wxWindow::Disable() for non-native controls too (Steve Browne).
|
||||||
- Implement wxTopLevelWindow::EnableCloseButton() (John Roberts).
|
- Implement wxTopLevelWindow::EnableCloseButton() (John Roberts).
|
||||||
- Fix wxEVT_CHAR for non-BMP Unicode characters (ARATA Mizuki).
|
- Fix wxEVT_CHAR for non-BMP Unicode characters (ARATA Mizuki).
|
||||||
- Add support for wxEVT_COMBOBOX_DROPDOWN and wxEVT_COMBOBOX_CLOSEUP
|
- Add wxTE_AUTO_URL support to wxTextCtrl (Igor Korot).
|
||||||
events (Igor Korot).
|
- Add support for wxEVT_COMBOBOX_{DROPDOWN, CLOSEUP} events (Igor Korot).
|
||||||
- Implement strike-through support in wxFont (Igor Korot).
|
- Implement strike-through support in wxFont (Igor Korot).
|
||||||
- Provide native implementation of wxStandardPaths (Tobias Taschner).
|
- Provide native implementation of wxStandardPaths (Tobias Taschner).
|
||||||
- Add wxTE_{RIGHT,CENTER} support for multiline wxTextCtrl (Andreas Falkenhahn).
|
- Add wxTE_{RIGHT,CENTER} support for multiline wxTextCtrl (Andreas Falkenhahn).
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
// automatically detect the URLs and generate the events when mouse is
|
// automatically detect the URLs and generate the events when mouse is
|
||||||
// moved/clicked over an URL
|
// moved/clicked over an URL
|
||||||
//
|
|
||||||
// this is for Win32 richedit and wxGTK2 multiline controls only so far
|
|
||||||
#define wxTE_AUTO_URL 0x1000
|
#define wxTE_AUTO_URL 0x1000
|
||||||
|
|
||||||
// by default, the Windows text control doesn't show the selection when it
|
// by default, the Windows text control doesn't show the selection when it
|
||||||
@@ -967,8 +965,7 @@ public:
|
|||||||
ignored under other platforms
|
ignored under other platforms
|
||||||
@style{wxTE_AUTO_URL}
|
@style{wxTE_AUTO_URL}
|
||||||
Highlight the URLs and generate the wxTextUrlEvents when mouse
|
Highlight the URLs and generate the wxTextUrlEvents when mouse
|
||||||
events occur over them. This style is only supported for wxTE_RICH
|
events occur over them.
|
||||||
Win32 and multi-line wxGTK2 text controls.
|
|
||||||
@style{wxTE_NOHIDESEL}
|
@style{wxTE_NOHIDESEL}
|
||||||
By default, the Windows text control doesn't show the selection
|
By default, the Windows text control doesn't show the selection
|
||||||
when it doesn't have focus - use this style to force it to always
|
when it doesn't have focus - use this style to force it to always
|
||||||
@@ -1148,8 +1145,7 @@ public:
|
|||||||
pressed in a text control which must have wxTE_PROCESS_ENTER style for
|
pressed in a text control which must have wxTE_PROCESS_ENTER style for
|
||||||
this event to be generated.
|
this event to be generated.
|
||||||
@event{EVT_TEXT_URL(id, func)}
|
@event{EVT_TEXT_URL(id, func)}
|
||||||
A mouse event occurred over an URL in the text control (wxMSW and
|
A mouse event occurred over an URL in the text control.
|
||||||
wxGTK2 only currently).
|
|
||||||
@event{EVT_TEXT_MAXLEN(id, func)}
|
@event{EVT_TEXT_MAXLEN(id, func)}
|
||||||
This event is generated when the user tries to enter more text into the
|
This event is generated when the user tries to enter more text into the
|
||||||
control than the limit set by wxTextCtrl::SetMaxLength(), see its description.
|
control than the limit set by wxTextCtrl::SetMaxLength(), see its description.
|
||||||
|
@@ -412,6 +412,23 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
|||||||
impl->DoNotifyFocusLost();
|
impl->DoNotifyFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(BOOL)textView:(NSTextView *)aTextView clickedOnLink:(id)link atIndex:(NSUInteger)charIndex
|
||||||
|
{
|
||||||
|
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( aTextView );
|
||||||
|
if ( impl )
|
||||||
|
{
|
||||||
|
wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
|
||||||
|
if ( wxpeer )
|
||||||
|
{
|
||||||
|
wxMouseEvent evtMouse( wxEVT_LEFT_DOWN );
|
||||||
|
wxTextUrlEvent event( wxpeer->GetId(), evtMouse, (long int)charIndex, (long int)charIndex );
|
||||||
|
event.SetEventObject( wxpeer );
|
||||||
|
wxpeer->HandleWindowEvent( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation wxNSTextField
|
@implementation wxNSTextField
|
||||||
@@ -624,6 +641,11 @@ wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long s
|
|||||||
[tv setRichText:NO];
|
[tv setRichText:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( wxPeer->HasFlag(wxTE_AUTO_URL) )
|
||||||
|
{
|
||||||
|
[tv setAutomaticLinkDetectionEnabled:YES];
|
||||||
|
}
|
||||||
|
|
||||||
[m_scrollView setDocumentView: tv];
|
[m_scrollView setDocumentView: tv];
|
||||||
|
|
||||||
[tv setDelegate: tv];
|
[tv setDelegate: tv];
|
||||||
@@ -671,7 +693,14 @@ void wxNSTextViewControl::SetStringValue( const wxString &str)
|
|||||||
wxMacEditHelper helper(m_textView);
|
wxMacEditHelper helper(m_textView);
|
||||||
|
|
||||||
if (m_textView)
|
if (m_textView)
|
||||||
|
{
|
||||||
[m_textView setString: wxCFStringRef( st , m_wxPeer->GetFont().GetEncoding() ).AsNSString()];
|
[m_textView setString: wxCFStringRef( st , m_wxPeer->GetFont().GetEncoding() ).AsNSString()];
|
||||||
|
if ( m_wxPeer->HasFlag(wxTE_AUTO_URL) )
|
||||||
|
{
|
||||||
|
// Make sure that any URLs in the new text are highlighted.
|
||||||
|
[m_textView checkTextInDocument:nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNSTextViewControl::Copy()
|
void wxNSTextViewControl::Copy()
|
||||||
|
Reference in New Issue
Block a user