// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "textctrl.h"
-#endif
-
#include "wx/wxprec.h"
#if wxUSE_TEXTCTRL
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual wxTextPos GetLastPosition() const ;
- virtual void Replace( long from , long to , const wxString str ) ;
- virtual void Remove( long from , long to ) = 0 ;
+ virtual void Replace( long from , long to , const wxString &str ) ;
+ virtual void Remove( long from , long to ) ;
virtual void SetSelection( long from , long to ) = 0 ;
virtual void GetSelection( long* from, long* to) const = 0 ;
virtual void WriteText(const wxString& str) = 0 ;
+ virtual bool HasOwnContextMenu() const { return false ; }
virtual void Clear() ;
virtual bool CanUndo() const;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual wxTextPos GetLastPosition() const ;
- virtual void Replace( long from , long to , const wxString str ) ;
+ virtual void Replace( long from , long to , const wxString &str ) ;
virtual void Remove( long from , long to ) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to ) ;
virtual void WriteText(const wxString& str) ;
+ virtual bool HasOwnContextMenu() const
+ {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( UMAGetSystemVersion() >= 0x1040 )
+ {
+ TXNCommandEventSupportOptions options ;
+ TXNGetCommandEventSupport( m_txn , & options ) ;
+ return options & kTXNSupportEditCommandProcessing ;
+ }
+#endif
+ return false ;
+ }
+
virtual void Clear() ;
virtual bool CanUndo() const ;
const wxSize& size, long style ) ;
virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
virtual bool HasFocus() const ;
+ virtual void SetBackground( const wxBrush &brush) ;
protected :
HIViewRef m_scrollView ;
HIViewRef m_textView ;
virtual void Paste();
virtual bool CanPaste() const;
virtual void SetEditable(bool editable) ;
- virtual void Remove( long from , long to ) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to ) ;
virtual void WriteText(const wxString& str) ;
END_EVENT_TABLE()
// Text item
-void wxTextCtrl::Init()
+void wxTextCtrl::Init()
{
m_editable = true ;
m_dirty = false;
void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
+ if ( GetPeer()->HasOwnContextMenu() )
+ {
+ event.Skip() ;
+ return ;
+ }
+
if (m_privateContextMenu == NULL)
{
m_privateContextMenu = new wxMenu;
return GetStringValue().Length() ;
}
-void wxMacTextControl::Replace( long from , long to , const wxString str )
+void wxMacTextControl::Replace( long from , long to , const wxString &val )
{
+ SetSelection( from , to ) ;
+ WriteText( val) ;
+}
+
+void wxMacTextControl::Remove( long from , long to )
+{
+ SetSelection( from , to ) ;
+ WriteText( wxEmptyString) ;
}
void wxMacTextControl::Clear()
{
SetData<Boolean>( 0 , kControlEditTextLockedTag , (Boolean) !editable ) ;
}
-void wxMacUnicodeTextControl::Remove( long from , long to )
-{
-}
void wxMacUnicodeTextControl::GetSelection( long* from, long* to) const
{
tback.bgType = kTXNBackgroundTypeRGB;
tback.bg.color = MAC_WXCOLORREF( background.GetPixel() );
TXNSetBackground( m_txn , &tback);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( UMAGetSystemVersion() >= 0x1040 )
+ {
+ TXNCommandEventSupportOptions options ;
+ if ( TXNGetCommandEventSupport( m_txn, &options) == noErr )
+ {
+ options |= kTXNSupportEditCommandProcessing ;
+ options |= kTXNSupportSpellCheckCommandProcessing ;
+ options |= kTXNSupportFontCommandProcessing ;
+ options |= kTXNSupportFontCommandUpdating ;
+
+ TXNSetCommandEventSupport( m_txn , options ) ;
+ }
+ }
+#endif
}
void wxMacMLTEControl::SetBackground( const wxBrush &brush )
return actualsize ;
}
-void wxMacMLTEControl::Replace( long from , long to , const wxString str )
+void wxMacMLTEControl::Replace( long from , long to , const wxString &str )
{
wxString value = str ;
wxMacConvertNewlines10To13( &value ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
- HIRect hr = { bounds.left , bounds.top , bounds.right - bounds.left , bounds.bottom- bounds.top } ;
+ HIRect hr = { { bounds.left , bounds.top} ,
+ { bounds.right - bounds.left , bounds.bottom - bounds.top} } ;
m_scrollView = NULL ;
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ;
return control == m_textView ;
}
+void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
+{
+ wxMacMLTEControl::SetBackground( brush ) ;
+/*
+ CGColorSpaceRef rgbSpace = CGColorSpaceCreateDeviceRGB();
+ RGBColor col = MAC_WXCOLORREF(brush.GetColour().GetPixel()) ;
+
+ float component[4] ;
+ component[0] = col.red / 65536.0 ;
+ component[1] = col.green / 65536.0 ;
+ component[2] = col.blue / 65536.0 ;
+ component[3] = 1.0 ; // alpha
+
+ CGColorRef color = CGColorCreate (rgbSpace , component );
+ HITextViewSetBackgroundColor( m_textView , color ) ;
+ CGColorSpaceRelease( rgbSpace );
+*/
+}
+
#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2