cleanup - reformat
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,6 +53,16 @@
|
|||||||
#include <Scrap.h>
|
#include <Scrap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __DARWIN__
|
||||||
|
#include <MacTextEditor.h>
|
||||||
|
#include <ATSUnicode.h>
|
||||||
|
#include <TextCommon.h>
|
||||||
|
#include <TextEncodingConverter.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
|
|
||||||
// if this is set to 1 then under OSX 10.2 the 'classic' MLTE implementation will be used
|
// if this is set to 1 then under OSX 10.2 the 'classic' MLTE implementation will be used
|
||||||
// if set to 0 then the unicode textctrl will be used
|
// if set to 0 then the unicode textctrl will be used
|
||||||
#ifndef wxMAC_AWAYS_USE_MLTE
|
#ifndef wxMAC_AWAYS_USE_MLTE
|
||||||
@@ -62,24 +72,19 @@
|
|||||||
#ifndef __WXMAC_OSX__
|
#ifndef __WXMAC_OSX__
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kTXNVisibilityTag = 'visb' /*set the visibility state of the object */
|
kTXNVisibilityTag = 'visb' // set the visibility state of the object
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <MacTextEditor.h>
|
|
||||||
#include <ATSUnicode.h>
|
|
||||||
#include <TextCommon.h>
|
|
||||||
#include <TextEncodingConverter.h>
|
|
||||||
#endif
|
|
||||||
#include "wx/mac/uma.h"
|
|
||||||
|
|
||||||
class wxMacFunctor
|
class wxMacFunctor
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxMacFunctor() {}
|
wxMacFunctor() {}
|
||||||
virtual ~wxMacFunctor() {}
|
virtual ~wxMacFunctor() {}
|
||||||
|
|
||||||
virtual void* operator()() = 0 ;
|
virtual void* operator()() = 0 ;
|
||||||
|
|
||||||
static void* CallBackProc(void *param)
|
static void* CallBackProc(void *param)
|
||||||
{
|
{
|
||||||
wxMacFunctor* f = (wxMacFunctor*) param ;
|
wxMacFunctor* f = (wxMacFunctor*) param ;
|
||||||
@@ -89,6 +94,7 @@ public :
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
template<typename classtype, typename param1type>
|
template<typename classtype, typename param1type>
|
||||||
|
|
||||||
class wxMacObjectFunctor1 : public wxMacFunctor
|
class wxMacObjectFunctor1 : public wxMacFunctor
|
||||||
{
|
{
|
||||||
typedef void (classtype::*function)( param1type p1 ) ;
|
typedef void (classtype::*function)( param1type p1 ) ;
|
||||||
@@ -185,7 +191,12 @@ public :
|
|||||||
virtual void SetSelection( long from , long to ) = 0 ;
|
virtual void SetSelection( long from , long to ) = 0 ;
|
||||||
virtual void GetSelection( long* from, long* to) const = 0 ;
|
virtual void GetSelection( long* from, long* to) const = 0 ;
|
||||||
virtual void WriteText(const wxString& str) = 0 ;
|
virtual void WriteText(const wxString& str) = 0 ;
|
||||||
virtual bool HasOwnContextMenu() const { return false ; }
|
|
||||||
|
virtual bool HasOwnContextMenu() const
|
||||||
|
{ return false ; }
|
||||||
|
|
||||||
|
virtual bool SetupCursor( const wxPoint& pt )
|
||||||
|
{ return false ; }
|
||||||
|
|
||||||
virtual void Clear() ;
|
virtual void Clear() ;
|
||||||
virtual bool CanUndo() const;
|
virtual bool CanUndo() const;
|
||||||
@@ -198,7 +209,6 @@ public :
|
|||||||
virtual void ShowPosition( long WXUNUSED(pos) ) ;
|
virtual void ShowPosition( long WXUNUSED(pos) ) ;
|
||||||
virtual int GetLineLength(long lineNo) const ;
|
virtual int GetLineLength(long lineNo) const ;
|
||||||
virtual wxString GetLineText(long lineNo) const ;
|
virtual wxString GetLineText(long lineNo) const ;
|
||||||
virtual bool SetupCursor( const wxPoint& pt ) { return false ; }
|
|
||||||
|
|
||||||
#ifndef __WXMAC_OSX__
|
#ifndef __WXMAC_OSX__
|
||||||
virtual void MacControlUserPaneDrawProc(wxInt16 part) = 0 ;
|
virtual void MacControlUserPaneDrawProc(wxInt16 part) = 0 ;
|
||||||
@@ -222,6 +232,7 @@ public :
|
|||||||
virtual void SetStringValue( const wxString &str) ;
|
virtual void SetStringValue( const wxString &str) ;
|
||||||
|
|
||||||
static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ;
|
static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ;
|
||||||
|
|
||||||
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
|
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
|
||||||
|
|
||||||
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
|
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
|
||||||
@@ -239,6 +250,7 @@ public :
|
|||||||
virtual void SetSelection( long from , long to ) ;
|
virtual void SetSelection( long from , long to ) ;
|
||||||
|
|
||||||
virtual void WriteText(const wxString& str) ;
|
virtual void WriteText(const wxString& str) ;
|
||||||
|
|
||||||
virtual bool HasOwnContextMenu() const
|
virtual bool HasOwnContextMenu() const
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
@@ -249,6 +261,7 @@ public :
|
|||||||
return options & kTXNSupportEditCommandProcessing ;
|
return options & kTXNSupportEditCommandProcessing ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,6 +282,7 @@ public :
|
|||||||
|
|
||||||
protected :
|
protected :
|
||||||
void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ;
|
void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ;
|
||||||
|
|
||||||
TXNObject m_txn ;
|
TXNObject m_txn ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -304,6 +318,7 @@ public :
|
|||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style ) ;
|
const wxSize& size, long style ) ;
|
||||||
~wxMacUnicodeTextControl();
|
~wxMacUnicodeTextControl();
|
||||||
|
|
||||||
virtual void VisibilityChanged(bool shown);
|
virtual void VisibilityChanged(bool shown);
|
||||||
virtual wxString GetStringValue() const ;
|
virtual wxString GetStringValue() const ;
|
||||||
virtual void SetStringValue( const wxString &str) ;
|
virtual void SetStringValue( const wxString &str) ;
|
||||||
@@ -353,10 +368,9 @@ protected :
|
|||||||
OSStatus DoCreate();
|
OSStatus DoCreate();
|
||||||
|
|
||||||
void MacUpdatePosition() ;
|
void MacUpdatePosition() ;
|
||||||
void MacActivatePaneText(Boolean setActive) ;
|
void MacActivatePaneText(bool setActive) ;
|
||||||
void MacFocusPaneText(Boolean setFocus) ;
|
void MacFocusPaneText(bool setFocus) ;
|
||||||
|
void MacSetObjectVisibility(bool vis) ;
|
||||||
void MacSetObjectVisibility(Boolean vis) ;
|
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TXNFrameID m_txnFrameID ;
|
TXNFrameID m_txnFrameID ;
|
||||||
@@ -365,10 +379,13 @@ private :
|
|||||||
// bounds of the control as we last did set the txn frames
|
// bounds of the control as we last did set the txn frames
|
||||||
Rect m_txnControlBounds ;
|
Rect m_txnControlBounds ;
|
||||||
Rect m_txnVisBounds ;
|
Rect m_txnVisBounds ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
static pascal void TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue,
|
|
||||||
TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon) ;
|
|
||||||
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
|
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
|
||||||
|
static pascal void TXNScrollInfoProc(
|
||||||
|
SInt32 iValue, SInt32 iMaximumValue,
|
||||||
|
TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon ) ;
|
||||||
|
|
||||||
ControlRef m_sbHorizontal ;
|
ControlRef m_sbHorizontal ;
|
||||||
SInt32 m_lastHorizontalValue ;
|
SInt32 m_lastHorizontalValue ;
|
||||||
ControlRef m_sbVertical ;
|
ControlRef m_sbVertical ;
|
||||||
@@ -378,6 +395,7 @@ private :
|
|||||||
|
|
||||||
#define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL
|
#define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||||
@@ -403,6 +421,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
|||||||
EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll)
|
EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
// Text item
|
// Text item
|
||||||
void wxTextCtrl::Init()
|
void wxTextCtrl::Init()
|
||||||
{
|
{
|
||||||
@@ -445,6 +464,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool forceMLTE = false ;
|
bool forceMLTE = false ;
|
||||||
|
|
||||||
#if wxUSE_SYSTEM_OPTIONS
|
#if wxUSE_SYSTEM_OPTIONS
|
||||||
if ( (wxSystemOptions::HasOption(wxMAC_TEXTCONTROL_USE_MLTE) ) && ( wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_MLTE ) == 1) )
|
if ( (wxSystemOptions::HasOption(wxMAC_TEXTCONTROL_USE_MLTE) ) && ( wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_MLTE ) == 1) )
|
||||||
{
|
{
|
||||||
@@ -460,12 +480,14 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
|
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !m_peer )
|
if ( !m_peer )
|
||||||
{
|
{
|
||||||
if ( !(m_windowStyle & wxTE_MULTILINE) && forceMLTE == false )
|
if ( !(m_windowStyle & wxTE_MULTILINE) && forceMLTE == false )
|
||||||
m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
|
m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !m_peer )
|
if ( !m_peer )
|
||||||
{
|
{
|
||||||
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
|
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
|
||||||
@@ -535,12 +557,14 @@ bool wxTextCtrl::SetFont( const wxFont& font )
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
GetPeer()->SetFont( font , GetForegroundColour() , GetWindowStyle() ) ;
|
GetPeer()->SetFont( font , GetForegroundColour() , GetWindowStyle() ) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
|
||||||
{
|
{
|
||||||
GetPeer()->SetStyle( start , end , style ) ;
|
GetPeer()->SetStyle( start , end , style ) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,10 +572,12 @@ bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
|
|||||||
{
|
{
|
||||||
wxTextCtrlBase::SetDefaultStyle( style ) ;
|
wxTextCtrlBase::SetDefaultStyle( style ) ;
|
||||||
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
|
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
|
|
||||||
void wxTextCtrl::Copy()
|
void wxTextCtrl::Copy()
|
||||||
{
|
{
|
||||||
if (CanCopy())
|
if (CanCopy())
|
||||||
@@ -575,7 +601,8 @@ void wxTextCtrl::Paste()
|
|||||||
if (CanPaste())
|
if (CanPaste())
|
||||||
{
|
{
|
||||||
GetPeer()->Paste() ;
|
GetPeer()->Paste() ;
|
||||||
// eventually we should add setting the default style again
|
|
||||||
|
// TODO: eventually we should add setting the default style again
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
@@ -667,11 +694,11 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
|||||||
|
|
||||||
void wxTextCtrl::WriteText(const wxString& str)
|
void wxTextCtrl::WriteText(const wxString& str)
|
||||||
{
|
{
|
||||||
// TODO this MPRemoting will be moved into a remoting peer proxy for any command
|
// TODO: this MPRemoting will be moved into a remoting peer proxy for any command
|
||||||
if ( !wxIsMainThread() )
|
if ( !wxIsMainThread() )
|
||||||
{
|
{
|
||||||
// unfortunately CW 8 is not able to correctly deduce the template types, so we have
|
// unfortunately CW 8 is not able to correctly deduce the template types,
|
||||||
// to instantiate explicitly
|
// so we have to instantiate explicitly
|
||||||
wxMacMPRemoteGUICall<wxTextCtrl,wxString>( this , &wxTextCtrl::WriteText , str ) ;
|
wxMacMPRemoteGUICall<wxTextCtrl,wxString>( this , &wxTextCtrl::WriteText , str ) ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -850,12 +877,13 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
if ( CanCopy() )
|
if ( CanCopy() )
|
||||||
Copy() ;
|
Copy() ;
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !IsEditable() && key != WXK_LEFT && key != WXK_RIGHT && key != WXK_DOWN && key != WXK_UP && key != WXK_TAB &&
|
if ( !IsEditable() && key != WXK_LEFT && key != WXK_RIGHT && key != WXK_DOWN && key != WXK_UP && key != WXK_TAB &&
|
||||||
!( key == WXK_RETURN && ( (m_windowStyle & wxPROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
|
!( key == WXK_RETURN && ( (m_windowStyle & wxPROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
|
||||||
/* && key != WXK_PRIOR && key != WXK_NEXT && key != WXK_HOME && key != WXK_END */
|
// && key != WXK_PRIOR && key != WXK_NEXT && key != WXK_HOME && key != WXK_END
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// eat it
|
// eat it
|
||||||
@@ -879,12 +907,15 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
if ( CanPaste() )
|
if ( CanPaste() )
|
||||||
Paste() ;
|
Paste() ;
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( key == 'x' && event.MetaDown() )
|
if ( key == 'x' && event.MetaDown() )
|
||||||
{
|
{
|
||||||
if ( CanCut() )
|
if ( CanCut() )
|
||||||
Cut() ;
|
Cut() ;
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,21 +930,24 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
if ( GetEventHandler()->ProcessEvent(event) )
|
if ( GetEventHandler()->ProcessEvent(event) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
||||||
{
|
{
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
|
while ( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
|
||||||
|
{
|
||||||
parent = parent->GetParent() ;
|
parent = parent->GetParent() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parent && parent->GetDefaultItem() )
|
if ( parent && parent->GetDefaultItem() )
|
||||||
{
|
{
|
||||||
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
|
wxButton *def = wxDynamicCast(parent->GetDefaultItem(), wxButton);
|
||||||
wxButton);
|
|
||||||
if ( def && def->IsEnabled() )
|
if ( def && def->IsEnabled() )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
||||||
event.SetEventObject(def);
|
event.SetEventObject(def);
|
||||||
def->Command(event);
|
def->Command(event);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -934,12 +968,13 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
if (event.ControlDown())
|
if (event.ControlDown())
|
||||||
flags |= wxNavigationKeyEvent::WinChange ;
|
flags |= wxNavigationKeyEvent::WinChange ;
|
||||||
Navigate(flags);
|
Navigate(flags);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This is necessary (don't know why) or the tab will not
|
// This is necessary (don't know why);
|
||||||
// be inserted.
|
// otherwise the tab will not be inserted.
|
||||||
WriteText(wxT("\t"));
|
WriteText(wxT("\t"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1238,9 +1273,11 @@ int wxMacTextControl::GetNumberOfLines() const
|
|||||||
ItemCount lines = 0 ;
|
ItemCount lines = 0 ;
|
||||||
wxString content = GetStringValue() ;
|
wxString content = GetStringValue() ;
|
||||||
lines = 1;
|
lines = 1;
|
||||||
|
|
||||||
for (size_t i = 0; i < content.Length() ; i++)
|
for (size_t i = 0; i < content.Length() ; i++)
|
||||||
{
|
{
|
||||||
if (content[i] == '\r') lines++;
|
if (content[i] == '\r')
|
||||||
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines ;
|
return lines ;
|
||||||
@@ -1248,7 +1285,7 @@ int wxMacTextControl::GetNumberOfLines() const
|
|||||||
|
|
||||||
wxString wxMacTextControl::GetLineText(long lineNo) const
|
wxString wxMacTextControl::GetLineText(long lineNo) const
|
||||||
{
|
{
|
||||||
// TODO change this if possible to reflect real lines
|
// TODO: change this if possible to reflect real lines
|
||||||
wxString content = GetStringValue() ;
|
wxString content = GetStringValue() ;
|
||||||
|
|
||||||
// Find line first
|
// Find line first
|
||||||
@@ -1271,7 +1308,8 @@ wxString wxMacTextControl::GetLineText(long lineNo) const
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content[i] == '\n') count++;
|
if (content[i] == '\n')
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxEmptyString ;
|
return wxEmptyString ;
|
||||||
@@ -1279,7 +1317,7 @@ wxString wxMacTextControl::GetLineText(long lineNo) const
|
|||||||
|
|
||||||
int wxMacTextControl::GetLineLength(long lineNo) const
|
int wxMacTextControl::GetLineLength(long lineNo) const
|
||||||
{
|
{
|
||||||
// TODO change this if possible to reflect real lines
|
// TODO: change this if possible to reflect real lines
|
||||||
wxString content = GetStringValue() ;
|
wxString content = GetStringValue() ;
|
||||||
|
|
||||||
// Find line first
|
// Find line first
|
||||||
@@ -1300,7 +1338,8 @@ int wxMacTextControl::GetLineLength(long lineNo) const
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content[i] == '\n') count++;
|
if (content[i] == '\n')
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
@@ -1326,7 +1365,9 @@ wxMacUnicodeTextControl::wxMacUnicodeTextControl( wxTextCtrl *wxPeer,
|
|||||||
CFStringRef cfr = cf ;
|
CFStringRef cfr = cf ;
|
||||||
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
|
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
|
||||||
m_valueTag = isPassword ? kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
|
m_valueTag = isPassword ? kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
|
||||||
CreateEditUnicodeTextControl( MAC_WXHWND(wxPeer->MacGetTopLevelWindowRef()), &bounds , cfr , isPassword , NULL , &m_controlRef ) ;
|
CreateEditUnicodeTextControl(
|
||||||
|
MAC_WXHWND(wxPeer->MacGetTopLevelWindowRef()), &bounds , cfr ,
|
||||||
|
isPassword , NULL , &m_controlRef ) ;
|
||||||
|
|
||||||
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
||||||
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
|
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
|
||||||
@@ -1340,7 +1381,8 @@ void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
|
|||||||
{
|
{
|
||||||
if ( !(m_windowStyle & wxTE_MULTILINE) && shown )
|
if ( !(m_windowStyle & wxTE_MULTILINE) && shown )
|
||||||
{
|
{
|
||||||
// work around a refresh issue insofar as not always the entire content is shown even if this would be possible
|
// work around a refresh issue insofar as not always the entire content is shown,
|
||||||
|
// even if this would be possible
|
||||||
ControlEditTextSelectionRec sel ;
|
ControlEditTextSelectionRec sel ;
|
||||||
CFStringRef value = NULL ;
|
CFStringRef value = NULL ;
|
||||||
|
|
||||||
@@ -1497,8 +1539,9 @@ wxString wxMacMLTEControl::GetStringValue() const
|
|||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
Handle theText ;
|
Handle theText ;
|
||||||
err = TXNGetDataEncoded( m_txn , kTXNStartOffset, kTXNEndOffset, &theText , kTXNUnicodeTextData );
|
err = TXNGetDataEncoded( m_txn , kTXNStartOffset, kTXNEndOffset, &theText , kTXNUnicodeTextData );
|
||||||
|
|
||||||
// all done
|
// all done
|
||||||
if ( err )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
actualSize = 0 ;
|
actualSize = 0 ;
|
||||||
}
|
}
|
||||||
@@ -1508,6 +1551,7 @@ wxString wxMacMLTEControl::GetStringValue() const
|
|||||||
if ( actualSize > 0 )
|
if ( actualSize > 0 )
|
||||||
{
|
{
|
||||||
wxChar *ptr = NULL ;
|
wxChar *ptr = NULL ;
|
||||||
|
|
||||||
#if SIZEOF_WCHAR_T == 2
|
#if SIZEOF_WCHAR_T == 2
|
||||||
ptr = new wxChar[actualSize + 1 ] ;
|
ptr = new wxChar[actualSize + 1 ] ;
|
||||||
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
|
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
|
||||||
@@ -1523,6 +1567,7 @@ wxString wxMacMLTEControl::GetStringValue() const
|
|||||||
ptr[noChars] = 0 ;
|
ptr[noChars] = 0 ;
|
||||||
HUnlock( theText ) ;
|
HUnlock( theText ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ptr[actualSize] = 0 ;
|
ptr[actualSize] = 0 ;
|
||||||
result = wxString( ptr ) ;
|
result = wxString( ptr ) ;
|
||||||
delete[] ptr ;
|
delete[] ptr ;
|
||||||
@@ -1641,7 +1686,7 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo
|
|||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag,
|
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag,
|
||||||
iControlTags, iControlData )) ;
|
iControlTags, iControlData )) ;
|
||||||
|
|
||||||
// setting the default font
|
// setting the default font:
|
||||||
// under 10.2 this causes a visible caret, therefore we avoid it
|
// under 10.2 this causes a visible caret, therefore we avoid it
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
if ( UMAGetSystemVersion() >= 0x1030 )
|
||||||
@@ -1681,10 +1726,13 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo
|
|||||||
TXNCommandEventSupportOptions options ;
|
TXNCommandEventSupportOptions options ;
|
||||||
if ( TXNGetCommandEventSupport( m_txn, &options ) == noErr )
|
if ( TXNGetCommandEventSupport( m_txn, &options ) == noErr )
|
||||||
{
|
{
|
||||||
options |= kTXNSupportEditCommandProcessing ;
|
options |=
|
||||||
options |= kTXNSupportSpellCheckCommandProcessing ;
|
kTXNSupportEditCommandProcessing
|
||||||
options |= kTXNSupportFontCommandProcessing ;
|
| kTXNSupportEditCommandUpdating
|
||||||
options |= kTXNSupportFontCommandUpdating ;
|
| kTXNSupportSpellCheckCommandProcessing
|
||||||
|
| kTXNSupportSpellCheckCommandUpdating
|
||||||
|
| kTXNSupportFontCommandProcessing
|
||||||
|
| kTXNSupportFontCommandUpdating;
|
||||||
|
|
||||||
TXNSetCommandEventSupport( m_txn , options ) ;
|
TXNSetCommandEventSupport( m_txn , options ) ;
|
||||||
}
|
}
|
||||||
@@ -1709,6 +1757,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
|
|||||||
Style fontStyle = normal ;
|
Style fontStyle = normal ;
|
||||||
RGBColor color ;
|
RGBColor color ;
|
||||||
int attrCounter = 0 ;
|
int attrCounter = 0 ;
|
||||||
|
|
||||||
if ( style.HasFont() )
|
if ( style.HasFont() )
|
||||||
{
|
{
|
||||||
const wxFont &font = style.GetFont() ;
|
const wxFont &font = style.GetFont() ;
|
||||||
@@ -1732,6 +1781,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
|
|||||||
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
|
||||||
attrCounter += 3 ;
|
attrCounter += 3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( style.HasTextColour() )
|
if ( style.HasTextColour() )
|
||||||
{
|
{
|
||||||
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
typeAttr[attrCounter].tag = kTXNQDFontColorAttribute ;
|
||||||
@@ -1740,6 +1790,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
|
|||||||
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ;
|
||||||
attrCounter += 1 ;
|
attrCounter += 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attrCounter > 0 )
|
if ( attrCounter > 0 )
|
||||||
{
|
{
|
||||||
verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, from , to) );
|
verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, from , to) );
|
||||||
@@ -1796,16 +1847,17 @@ wxTextPos wxMacMLTEControl::GetLastPosition() const
|
|||||||
|
|
||||||
Handle theText ;
|
Handle theText ;
|
||||||
OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
|
||||||
/* all done */
|
|
||||||
if ( err )
|
// all done
|
||||||
{
|
if ( err == noErr )
|
||||||
actualsize = 0 ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
actualsize = GetHandleSize( theText ) ;
|
actualsize = GetHandleSize( theText ) ;
|
||||||
DisposeHandle( theText ) ;
|
DisposeHandle( theText ) ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actualsize = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
return actualsize ;
|
return actualsize ;
|
||||||
}
|
}
|
||||||
@@ -1839,7 +1891,8 @@ void wxMacMLTEControl::GetSelection( long* from, long* to) const
|
|||||||
void wxMacMLTEControl::SetSelection( long from , long to )
|
void wxMacMLTEControl::SetSelection( long from , long to )
|
||||||
{
|
{
|
||||||
wxMacWindowClipper c( m_peer ) ;
|
wxMacWindowClipper c( m_peer ) ;
|
||||||
/* change the selection */
|
|
||||||
|
// change the selection
|
||||||
if ((from == -1) && (to == -1))
|
if ((from == -1) && (to == -1))
|
||||||
TXNSelectAll(m_txn);
|
TXNSelectAll(m_txn);
|
||||||
else
|
else
|
||||||
@@ -1861,7 +1914,8 @@ void wxMacMLTEControl::WriteText(const wxString& str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetSelection( &dummy , &end ) ;
|
GetSelection( &dummy , &end ) ;
|
||||||
// TODO SetStyle( start , end , GetDefaultStyle() ) ;
|
|
||||||
|
// TODO: SetStyle( start , end , GetDefaultStyle() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacMLTEControl::Clear()
|
void wxMacMLTEControl::Clear()
|
||||||
@@ -1896,24 +1950,25 @@ int wxMacMLTEControl::GetNumberOfLines() const
|
|||||||
{
|
{
|
||||||
ItemCount lines = 0 ;
|
ItemCount lines = 0 ;
|
||||||
TXNGetLineCount( m_txn, &lines ) ;
|
TXNGetLineCount( m_txn, &lines ) ;
|
||||||
|
|
||||||
return lines ;
|
return lines ;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxMacMLTEControl::XYToPosition(long x, long y) const
|
long wxMacMLTEControl::XYToPosition(long x, long y) const
|
||||||
{
|
{
|
||||||
Point curpt ;
|
Point curpt ;
|
||||||
|
wxTextPos lastpos ;
|
||||||
|
|
||||||
wxTextPos lastpos = GetLastPosition() ;
|
// TODO: find a better implementation : while we can get the
|
||||||
|
|
||||||
// TODO find a better implementation : while we can get the
|
|
||||||
// line metrics of a certain line, we don't get its starting
|
// line metrics of a certain line, we don't get its starting
|
||||||
// position, so it would probably be rather a binary search
|
// position, so it would probably be rather a binary search
|
||||||
// for the start position
|
// for the start position
|
||||||
long xpos = 0 ;
|
long xpos = 0 ;
|
||||||
long ypos = 0 ;
|
long ypos = 0 ;
|
||||||
int lastHeight = 0 ;
|
int lastHeight = 0 ;
|
||||||
|
|
||||||
ItemCount n ;
|
ItemCount n ;
|
||||||
|
|
||||||
|
lastpos = GetLastPosition() ;
|
||||||
for ( n = 0 ; n <= (ItemCount) lastpos ; ++n )
|
for ( n = 0 ; n <= (ItemCount) lastpos ; ++n )
|
||||||
{
|
{
|
||||||
if ( y == ypos && x == xpos )
|
if ( y == ypos && x == xpos )
|
||||||
@@ -1938,12 +1993,14 @@ long wxMacMLTEControl::XYToPosition(long x, long y) const
|
|||||||
bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
|
bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
|
||||||
{
|
{
|
||||||
Point curpt ;
|
Point curpt ;
|
||||||
|
wxTextPos lastpos ;
|
||||||
|
|
||||||
wxTextPos lastpos = GetLastPosition() ;
|
if ( y )
|
||||||
|
*y = 0 ;
|
||||||
if ( y ) *y = 0 ;
|
if ( x )
|
||||||
if ( x ) *x = 0 ;
|
*x = 0 ;
|
||||||
|
|
||||||
|
lastpos = GetLastPosition() ;
|
||||||
if ( pos <= lastpos )
|
if ( pos <= lastpos )
|
||||||
{
|
{
|
||||||
// TODO find a better implementation : while we can get the
|
// TODO find a better implementation : while we can get the
|
||||||
@@ -1970,8 +2027,10 @@ bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
|
|||||||
++xpos ;
|
++xpos ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( y ) *y = ypos ;
|
if ( y )
|
||||||
if ( x ) *x = xpos ;
|
*y = ypos ;
|
||||||
|
if ( x )
|
||||||
|
*x = xpos ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
@@ -1981,21 +2040,23 @@ void wxMacMLTEControl::ShowPosition( long pos )
|
|||||||
{
|
{
|
||||||
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
|
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
|
||||||
{
|
{
|
||||||
Point current ;
|
Point current, desired ;
|
||||||
Point desired ;
|
|
||||||
TXNOffset selstart, selend;
|
TXNOffset selstart, selend;
|
||||||
|
|
||||||
TXNGetSelection( m_txn, &selstart, &selend );
|
TXNGetSelection( m_txn, &selstart, &selend );
|
||||||
TXNOffsetToPoint( m_txn, selstart, ¤t );
|
TXNOffsetToPoint( m_txn, selstart, ¤t );
|
||||||
TXNOffsetToPoint( m_txn, pos, &desired );
|
TXNOffsetToPoint( m_txn, pos, &desired );
|
||||||
//TODO use HIPoints for 10.3 and above
|
|
||||||
|
// TODO: use HIPoints for 10.3 and above
|
||||||
if ( (UInt32)TXNScroll != (UInt32)kUnresolvedCFragSymbolAddress )
|
if ( (UInt32)TXNScroll != (UInt32)kUnresolvedCFragSymbolAddress )
|
||||||
{
|
{
|
||||||
OSErr theErr = noErr;
|
OSErr theErr = noErr;
|
||||||
SInt32 dv = desired.v - current.v ;
|
SInt32 dv = desired.v - current.v ;
|
||||||
SInt32 dh = desired.h - current.h ;
|
SInt32 dh = desired.h - current.h ;
|
||||||
TXNShowSelection( m_txn , true ) ;
|
TXNShowSelection( m_txn, kTXNShowEnd ) ; // NB: should this be kTXNShowStart or kTXNShowEnd ??
|
||||||
theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
|
theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
|
||||||
// there will be an error returned for classic mlte implementation when the control is
|
|
||||||
|
// there will be an error returned for classic MLTE implementation when the control is
|
||||||
// invisible, but HITextView works correctly, so we don't assert that one
|
// invisible, but HITextView works correctly, so we don't assert that one
|
||||||
// wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
|
// wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
|
||||||
}
|
}
|
||||||
@@ -2008,21 +2069,18 @@ void wxMacMLTEControl::SetTXNData( const wxString& st , TXNOffset start , TXNOff
|
|||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
#if SIZEOF_WCHAR_T == 2
|
#if SIZEOF_WCHAR_T == 2
|
||||||
size_t len = st.Len() ;
|
size_t len = st.Len() ;
|
||||||
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
|
TXNSetData( m_txn, kTXNUnicodeTextData, (void*)st.wc_str(), len * 2, start, end );
|
||||||
start, end);
|
|
||||||
#else
|
#else
|
||||||
wxMBConvUTF16 converter ;
|
wxMBConvUTF16 converter ;
|
||||||
ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
|
ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
|
||||||
UniChar *unibuf = (UniChar*) malloc( byteBufferLen ) ;
|
UniChar *unibuf = (UniChar*) malloc( byteBufferLen ) ;
|
||||||
converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen ) ;
|
converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen ) ;
|
||||||
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
|
TXNSetData( m_txn, kTXNUnicodeTextData, (void*)unibuf, byteBufferLen, start, end ) ;
|
||||||
start, end);
|
|
||||||
free( unibuf ) ;
|
free( unibuf ) ;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
wxCharBuffer text = st.mb_str(wxConvLocal) ;
|
wxCharBuffer text = st.mb_str(wxConvLocal) ;
|
||||||
TXNSetData( m_txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
|
TXNSetData( m_txn, kTXNTextData, (void*)text.data(), strlen( text ), start, end ) ;
|
||||||
start, end);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2032,18 +2090,17 @@ wxString wxMacMLTEControl::GetLineText(long lineNo) const
|
|||||||
|
|
||||||
if ( lineNo < GetNumberOfLines() )
|
if ( lineNo < GetNumberOfLines() )
|
||||||
{
|
{
|
||||||
long ypos = 0 ;
|
Point firstPoint;
|
||||||
|
Fixed lineWidth, lineHeight, currentHeight;
|
||||||
Fixed lineWidth,
|
long ypos ;
|
||||||
lineHeight,
|
|
||||||
currentHeight = 0;
|
|
||||||
|
|
||||||
// get the first possible position in the control
|
// get the first possible position in the control
|
||||||
Point firstPoint;
|
|
||||||
TXNOffsetToPoint(m_txn, 0, &firstPoint);
|
TXNOffsetToPoint(m_txn, 0, &firstPoint);
|
||||||
|
|
||||||
// Iterate through the lines until we reach the one we want,
|
// Iterate through the lines until we reach the one we want,
|
||||||
// adding to our current y pixel point position
|
// adding to our current y pixel point position
|
||||||
|
ypos = 0 ;
|
||||||
|
currentHeight = 0;
|
||||||
while (ypos < lineNo)
|
while (ypos < lineNo)
|
||||||
{
|
{
|
||||||
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
|
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
|
||||||
@@ -2062,6 +2119,7 @@ wxString wxMacMLTEControl::GetLineText(long lineNo) const
|
|||||||
TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint);
|
TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return line ;
|
return line ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2071,18 +2129,17 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
|
|||||||
|
|
||||||
if ( lineNo < GetNumberOfLines() )
|
if ( lineNo < GetNumberOfLines() )
|
||||||
{
|
{
|
||||||
long ypos = 0 ;
|
Point firstPoint;
|
||||||
|
Fixed lineWidth, lineHeight, currentHeight;
|
||||||
Fixed lineWidth,
|
long ypos ;
|
||||||
lineHeight,
|
|
||||||
currentHeight = 0;
|
|
||||||
|
|
||||||
// get the first possible position in the control
|
// get the first possible position in the control
|
||||||
Point firstPoint;
|
|
||||||
TXNOffsetToPoint(m_txn, 0, &firstPoint);
|
TXNOffsetToPoint(m_txn, 0, &firstPoint);
|
||||||
|
|
||||||
// Iterate through the lines until we reach the one we want,
|
// Iterate through the lines until we reach the one we want,
|
||||||
// adding to our current y pixel point position
|
// adding to our current y pixel point position
|
||||||
|
ypos = 0;
|
||||||
|
currentHeight = 0;
|
||||||
while (ypos < lineNo)
|
while (ypos < lineNo)
|
||||||
{
|
{
|
||||||
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
|
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
|
||||||
@@ -2101,6 +2158,7 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
|
|||||||
TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint);
|
TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return theLength ;
|
return theLength ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2120,8 +2178,9 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
|
|||||||
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
|
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
|
||||||
ControlActionUPP gTXNScrollActionProc = NULL ;
|
ControlActionUPP gTXNScrollActionProc = NULL ;
|
||||||
|
|
||||||
pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation
|
pascal void wxMacMLTEClassicControl::TXNScrollInfoProc(
|
||||||
iScrollBarOrientation, SInt32 iRefCon)
|
SInt32 iValue, SInt32 iMaximumValue,
|
||||||
|
TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon)
|
||||||
{
|
{
|
||||||
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ;
|
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ;
|
||||||
SInt32 value = wxMax( iValue , 0 ) ;
|
SInt32 value = wxMax( iValue , 0 ) ;
|
||||||
@@ -2149,7 +2208,6 @@ pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iM
|
|||||||
|
|
||||||
pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode )
|
pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode )
|
||||||
{
|
{
|
||||||
OSStatus err ;
|
|
||||||
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ;
|
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ;
|
||||||
if ( mlte == NULL )
|
if ( mlte == NULL )
|
||||||
return ;
|
return ;
|
||||||
@@ -2157,33 +2215,42 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef
|
|||||||
if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal )
|
if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
OSStatus err ;
|
||||||
bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
|
bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
|
||||||
|
|
||||||
SInt32 minimum = 0 ;
|
SInt32 minimum = 0 ;
|
||||||
SInt32 maximum = GetControl32BitMaximum( controlRef ) ;
|
SInt32 maximum = GetControl32BitMaximum( controlRef ) ;
|
||||||
SInt32 value = GetControl32BitValue( controlRef ) ;
|
SInt32 value = GetControl32BitValue( controlRef ) ;
|
||||||
SInt32 delta = 0;
|
SInt32 delta = 0;
|
||||||
|
|
||||||
switch ( partCode )
|
switch ( partCode )
|
||||||
{
|
{
|
||||||
|
|
||||||
case kControlDownButtonPart :
|
case kControlDownButtonPart :
|
||||||
delta = 10 ;
|
delta = 10 ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kControlUpButtonPart :
|
case kControlUpButtonPart :
|
||||||
delta = -10 ;
|
delta = -10 ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kControlPageDownPart :
|
case kControlPageDownPart :
|
||||||
delta = GetControlViewSize( controlRef ) ;
|
delta = GetControlViewSize( controlRef ) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kControlPageUpPart :
|
case kControlPageUpPart :
|
||||||
delta = -GetControlViewSize( controlRef ) ;
|
delta = -GetControlViewSize( controlRef ) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kControlIndicatorPart :
|
case kControlIndicatorPart :
|
||||||
delta = value -
|
delta = value -
|
||||||
( isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue ) ;
|
( isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue ) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( delta != 0 )
|
if ( delta != 0 )
|
||||||
{
|
{
|
||||||
SInt32 newValue = value ;
|
SInt32 newValue = value ;
|
||||||
@@ -2214,7 +2281,7 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make correct activations
|
// make correct activations
|
||||||
void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive)
|
void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
|
||||||
{
|
{
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
|
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
|
||||||
|
|
||||||
@@ -2227,35 +2294,32 @@ void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive)
|
|||||||
TXNFocus( m_txn, setActive );
|
TXNFocus( m_txn, setActive );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus)
|
void wxMacMLTEClassicControl::MacFocusPaneText(bool setFocus)
|
||||||
{
|
{
|
||||||
TXNFocus( m_txn, setFocus);
|
TXNFocus( m_txn, setFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// guards against inappropriate redraw (hidden objects drawing onto window)
|
// guards against inappropriate redraw (hidden objects drawing onto window)
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis)
|
void wxMacMLTEClassicControl::MacSetObjectVisibility(bool vis)
|
||||||
{
|
{
|
||||||
ControlRef controlFocus = 0 ;
|
ControlRef controlFocus = 0 ;
|
||||||
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
|
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
|
||||||
|
|
||||||
if ( controlFocus == m_controlRef && vis == false )
|
if ( !vis && (controlFocus == m_controlRef ) )
|
||||||
{
|
|
||||||
SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
|
SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
|
||||||
}
|
|
||||||
|
|
||||||
TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
|
TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
|
||||||
TXNControlData iControlData[1] = { {(UInt32) false } };
|
TXNControlData iControlData[1] = { {(UInt32) false } };
|
||||||
|
|
||||||
verify_noerr( TXNGetTXNObjectControls( m_txn , 1,
|
verify_noerr( TXNGetTXNObjectControls( m_txn , 1, iControlTags, iControlData ) ) ;
|
||||||
iControlTags, iControlData ) ) ;
|
|
||||||
|
|
||||||
if ( iControlData[0].uValue != vis )
|
if ( iControlData[0].uValue != vis )
|
||||||
{
|
{
|
||||||
iControlData[0].uValue = vis ;
|
iControlData[0].uValue = vis ;
|
||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false , 1,
|
verify_noerr( TXNSetTXNObjectControls( m_txn, false , 1, iControlTags, iControlData )) ;
|
||||||
iControlTags, iControlData )) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we right now are always clipping as partial visibility (overlapped) visibility
|
// we right now are always clipping as partial visibility (overlapped) visibility
|
||||||
// is also a problem, if we run into further problems we might set the FrameBounds to an empty
|
// is also a problem, if we run into further problems we might set the FrameBounds to an empty
|
||||||
// rect here
|
// rect here
|
||||||
@@ -2329,9 +2393,11 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
|
TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
|
||||||
|
|
||||||
Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
||||||
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
|
||||||
|
m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
||||||
TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
||||||
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
|
||||||
|
m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
||||||
|
|
||||||
if ( olddestRect.right >= 10000 )
|
if ( olddestRect.right >= 10000 )
|
||||||
destRect.right = destRect.left + 32000 ;
|
destRect.right = destRect.left + 32000 ;
|
||||||
@@ -2341,10 +2407,16 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
|
|
||||||
SectRect( &viewRect , &visBounds , &viewRect ) ;
|
SectRect( &viewRect , &visBounds , &viewRect ) ;
|
||||||
TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
|
TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
|
||||||
/*
|
|
||||||
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
#if 0
|
||||||
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ), m_txnFrameID);
|
TXNSetFrameBounds(
|
||||||
*/
|
m_txn,
|
||||||
|
m_txnControlBounds.top,
|
||||||
|
m_txnControlBounds.left,
|
||||||
|
m_txnControlBounds.bottom - (m_sbHorizontal ? 14 : 0),
|
||||||
|
m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
|
||||||
|
m_txnFrameID );
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
||||||
@@ -2354,14 +2426,12 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
// the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a
|
// the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a
|
||||||
// movement, therefore we have to force it
|
// movement, therefore we have to force it
|
||||||
|
|
||||||
// according to David Surovell this problem also sometimes occurs under OSX, so we use this as well
|
// this problem has been reported in OSX as well, so we use this here once again
|
||||||
|
|
||||||
TXNLongRect textRect ;
|
TXNLongRect textRect ;
|
||||||
TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
|
TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
|
||||||
if ( textRect.left < m_txnControlBounds.left )
|
if ( textRect.left < m_txnControlBounds.left )
|
||||||
{
|
TXNShowSelection( m_txn , kTXNShowStart ) ;
|
||||||
TXNShowSelection( m_txn , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2393,7 +2463,9 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt1
|
|||||||
if ( (textctrl != NULL) && textctrl->MacIsReallyShown() )
|
if ( (textctrl != NULL) && textctrl->MacIsReallyShown() )
|
||||||
{
|
{
|
||||||
if (PtInRect( where, &m_txnControlBounds ))
|
if (PtInRect( where, &m_txnControlBounds ))
|
||||||
|
{
|
||||||
result = kControlEditTextPart ;
|
result = kControlEditTextPart ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// sometimes we get the coords also in control local coordinates, therefore test again
|
// sometimes we get the coords also in control local coordinates, therefore test again
|
||||||
@@ -2404,6 +2476,7 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt1
|
|||||||
where.h += x ;
|
where.h += x ;
|
||||||
where.v += y ;
|
where.v += y ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PtInRect(where, &m_txnControlBounds))
|
if (PtInRect(where, &m_txnControlBounds))
|
||||||
result = kControlEditTextPart ;
|
result = kControlEditTextPart ;
|
||||||
}
|
}
|
||||||
@@ -2468,8 +2541,8 @@ void wxMacMLTEClassicControl::MacControlUserPaneIdleProc()
|
|||||||
|
|
||||||
if (PtInRect(mousep, &m_txnControlBounds))
|
if (PtInRect(mousep, &m_txnControlBounds))
|
||||||
{
|
{
|
||||||
RgnHandle theRgn;
|
RgnHandle theRgn = NewRgn();
|
||||||
RectRgn((theRgn = NewRgn()), &m_txnControlBounds);
|
RectRgn(theRgn, &m_txnControlBounds);
|
||||||
TXNAdjustCursor(m_txn, theRgn);
|
TXNAdjustCursor(m_txn, theRgn);
|
||||||
DisposeRgn(theRgn);
|
DisposeRgn(theRgn);
|
||||||
}
|
}
|
||||||
@@ -2489,7 +2562,7 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode,
|
|||||||
memset( &ev , 0 , sizeof( ev ) ) ;
|
memset( &ev , 0 , sizeof( ev ) ) ;
|
||||||
ev.what = keyDown ;
|
ev.what = keyDown ;
|
||||||
ev.modifiers = modifiers ;
|
ev.modifiers = modifiers ;
|
||||||
ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ;
|
ev.message = ((keyCode << 8) & keyCodeMask) | (charCode & charCodeMask);
|
||||||
TXNKeyDown( m_txn , &ev );
|
TXNKeyDown( m_txn , &ev );
|
||||||
|
|
||||||
return kControlEntireControl;
|
return kControlEntireControl;
|
||||||
@@ -2661,7 +2734,7 @@ static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control,
|
|||||||
return kControlNoPart ;
|
return kControlNoPart ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
|
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
|
||||||
{
|
{
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ;
|
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ;
|
||||||
@@ -2669,9 +2742,10 @@ static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, Contro
|
|||||||
if ( win )
|
if ( win )
|
||||||
win->MacControlUserPaneBackgroundProc(info) ;
|
win->MacControlUserPaneBackgroundProc(info) ;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // __WXMAC_OSX__
|
||||||
|
|
||||||
// TXNRegisterScrollInfoProc
|
// TXNRegisterScrollInfoProc
|
||||||
|
|
||||||
OSStatus wxMacMLTEClassicControl::DoCreate()
|
OSStatus wxMacMLTEClassicControl::DoCreate()
|
||||||
@@ -2680,7 +2754,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
|
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
|
|
||||||
/* set up our globals */
|
// set up our globals
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
|
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
|
||||||
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
|
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
|
||||||
@@ -2694,13 +2768,13 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
|
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set the initial settings for our private data */
|
// set the initial settings for our private data
|
||||||
|
|
||||||
m_txnWindow = GetControlOwner(m_controlRef);
|
m_txnWindow = GetControlOwner(m_controlRef);
|
||||||
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
|
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
/* set up the user pane procedures */
|
// set up the user pane procedures
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneTrackingProcTag, sizeof(gTPTrackProc), &gTPTrackProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneTrackingProcTag, sizeof(gTPTrackProc), &gTPTrackProc);
|
||||||
@@ -2709,26 +2783,24 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
||||||
#endif
|
#endif
|
||||||
/* calculate the rectangles used by the control */
|
// calculate the rectangles used by the control
|
||||||
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
|
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
|
||||||
|
|
||||||
m_txnControlBounds = bounds ;
|
m_txnControlBounds = bounds ;
|
||||||
m_txnVisBounds = bounds ;
|
m_txnVisBounds = bounds ;
|
||||||
|
|
||||||
CGrafPtr origPort = NULL ;
|
CGrafPtr origPort ;
|
||||||
GDHandle origDev = NULL ;
|
GDHandle origDev ;
|
||||||
|
|
||||||
GetGWorld( &origPort , &origDev ) ;
|
GetGWorld( &origPort , &origDev ) ;
|
||||||
SetPort( m_txnPort );
|
SetPort( m_txnPort );
|
||||||
|
|
||||||
/* create the new edit field */
|
// create the new edit field
|
||||||
|
|
||||||
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle ) ;
|
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle ) ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
|
// the scrollbars are not correctly embedded but are inserted at the root:
|
||||||
// the scrollbars are not correctly embedded but are inserted at the root
|
// this gives us problems as we have erratic redraws even over the structure area
|
||||||
// this gives us problems as we have erratic redraws even over the structure
|
|
||||||
// area
|
|
||||||
|
|
||||||
m_sbHorizontal = 0 ;
|
m_sbHorizontal = 0 ;
|
||||||
m_sbVertical = 0 ;
|
m_sbVertical = 0 ;
|
||||||
@@ -2745,6 +2817,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
EmbedControl( m_sbVertical , m_controlRef ) ;
|
EmbedControl( m_sbVertical , m_controlRef ) ;
|
||||||
frameOptions &= ~kTXNWantVScrollBarMask ;
|
frameOptions &= ~kTXNWantVScrollBarMask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( frameOptions & kTXNWantHScrollBarMask )
|
if ( frameOptions & kTXNWantHScrollBarMask )
|
||||||
{
|
{
|
||||||
CreateScrollBarControl( m_txnWindow , &sb , 0 , 0 , 100 , 1 , true , gTXNScrollActionProc , &m_sbHorizontal ) ;
|
CreateScrollBarControl( m_txnWindow , &sb , 0 , 0 , 100 , 1 , true , gTXNScrollActionProc , &m_sbHorizontal ) ;
|
||||||
@@ -2763,29 +2836,20 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
kTXNTextensionFile,
|
kTXNTextensionFile,
|
||||||
kTXNSystemDefaultEncoding,
|
kTXNSystemDefaultEncoding,
|
||||||
&m_txn, &m_txnFrameID, NULL ) );
|
&m_txn, &m_txnFrameID, NULL ) );
|
||||||
/*
|
|
||||||
TXNCarbonEventInfo cInfo ;
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
TXNControlTag iControlTags[] = { kTXNUseCarbonEvents };
|
||||||
|
TXNControlData iControlData[] = { {(UInt32) &cInfo } };
|
||||||
|
int toptag = WXSIZEOF( iControlTags ) ;
|
||||||
|
TXNCarbonEventInfo cInfo ;
|
||||||
cInfo.useCarbonEvents = false ;
|
cInfo.useCarbonEvents = false ;
|
||||||
cInfo.filler = 0 ;
|
cInfo.filler = 0 ;
|
||||||
cInfo.flags = 0 ;
|
cInfo.flags = 0 ;
|
||||||
cInfo.fDictionary = NULL ;
|
cInfo.fDictionary = NULL ;
|
||||||
|
|
||||||
TXNControlTag iControlTags[] =
|
verify_noerr( TXNSetTXNObjectControls( m_txn, false , toptag, iControlTags, iControlData )) ;
|
||||||
{
|
#endif
|
||||||
kTXNUseCarbonEvents ,
|
|
||||||
};
|
|
||||||
TXNControlData iControlData[] =
|
|
||||||
{
|
|
||||||
{(UInt32) &cInfo },
|
|
||||||
};
|
|
||||||
|
|
||||||
int toptag = WXSIZEOF( iControlTags ) ;
|
|
||||||
|
|
||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false , toptag,
|
|
||||||
iControlTags, iControlData )) ;
|
|
||||||
|
|
||||||
*/
|
|
||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32) this);
|
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32) this);
|
||||||
#endif
|
#endif
|
||||||
@@ -2854,8 +2918,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
|
|||||||
|
|
||||||
OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
|
OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
|
||||||
{
|
{
|
||||||
return SetKeyboardFocus( GetControlOwner( m_textView ) ,
|
return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, focusPart ) ;
|
||||||
m_textView , focusPart ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMacMLTEHIViewControl::HasFocus() const
|
bool wxMacMLTEHIViewControl::HasFocus() const
|
||||||
@@ -2868,7 +2931,8 @@ bool wxMacMLTEHIViewControl::HasFocus() const
|
|||||||
void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
|
void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
|
||||||
{
|
{
|
||||||
wxMacMLTEControl::SetBackground( brush ) ;
|
wxMacMLTEControl::SetBackground( brush ) ;
|
||||||
/*
|
|
||||||
|
#if 0
|
||||||
CGColorSpaceRef rgbSpace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef rgbSpace = CGColorSpaceCreateDeviceRGB();
|
||||||
RGBColor col = MAC_WXCOLORREF(brush.GetColour().GetPixel()) ;
|
RGBColor col = MAC_WXCOLORREF(brush.GetColour().GetPixel()) ;
|
||||||
|
|
||||||
@@ -2881,7 +2945,7 @@ void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
|
|||||||
CGColorRef color = CGColorCreate (rgbSpace , component );
|
CGColorRef color = CGColorCreate (rgbSpace , component );
|
||||||
HITextViewSetBackgroundColor( m_textView , color ) ;
|
HITextViewSetBackgroundColor( m_textView , color ) ;
|
||||||
CGColorSpaceRelease( rgbSpace );
|
CGColorSpaceRelease( rgbSpace );
|
||||||
*/
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
|
#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
|
||||||
|
Reference in New Issue
Block a user