cleanup - reformat (part 3)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -179,6 +179,10 @@ public :
|
||||
|
||||
virtual wxString GetStringValue() const = 0 ;
|
||||
virtual void SetStringValue( const wxString &val ) = 0 ;
|
||||
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 void SetStyle( long start, long end, const wxTextAttr& style ) ;
|
||||
virtual void Copy() ;
|
||||
virtual void Cut() ;
|
||||
@@ -188,9 +192,7 @@ public :
|
||||
virtual wxTextPos GetLastPosition() const ;
|
||||
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 ; }
|
||||
@@ -228,6 +230,7 @@ class wxMacMLTEControl : public wxMacTextControl
|
||||
{
|
||||
public :
|
||||
wxMacMLTEControl( wxTextCtrl *peer ) ;
|
||||
|
||||
virtual wxString GetStringValue() const ;
|
||||
virtual void SetStringValue( const wxString &str ) ;
|
||||
|
||||
@@ -422,15 +425,13 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
// Text item
|
||||
void wxTextCtrl::Init()
|
||||
{
|
||||
m_editable = true ;
|
||||
m_dirty = false;
|
||||
|
||||
m_privateContextMenu = NULL;
|
||||
|
||||
m_maxLength = TE_UNLIMITED_LENGTH ;
|
||||
m_privateContextMenu = NULL;
|
||||
}
|
||||
|
||||
wxTextCtrl::~wxTextCtrl()
|
||||
@@ -438,10 +439,12 @@ wxTextCtrl::~wxTextCtrl()
|
||||
delete m_privateContextMenu;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
bool wxTextCtrl::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& str,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
@@ -456,7 +459,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( m_windowStyle & wxTE_MULTILINE )
|
||||
{
|
||||
wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
|
||||
wxASSERT_MSG(
|
||||
!(m_windowStyle & wxTE_PROCESS_ENTER),
|
||||
wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") );
|
||||
|
||||
m_windowStyle |= wxTE_PROCESS_ENTER;
|
||||
@@ -466,7 +470,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
bool forceMLTE = false ;
|
||||
|
||||
#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) )
|
||||
{
|
||||
forceMLTE = true ;
|
||||
}
|
||||
@@ -474,7 +478,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
#ifdef __WXMAC_OSX__
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
|
||||
if ( UMAGetSystemVersion() >= 0x1030 && forceMLTE == false )
|
||||
if ( UMAGetSystemVersion() >= 0x1030 && !forceMLTE )
|
||||
{
|
||||
if ( m_windowStyle & wxTE_MULTILINE )
|
||||
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
|
||||
@@ -483,15 +487,13 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( !m_peer )
|
||||
{
|
||||
if ( !(m_windowStyle & wxTE_MULTILINE) && forceMLTE == false )
|
||||
if ( !(m_windowStyle & wxTE_MULTILINE) && !forceMLTE )
|
||||
m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !m_peer )
|
||||
{
|
||||
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
|
||||
}
|
||||
|
||||
MacPostControlCreate(pos, size) ;
|
||||
|
||||
@@ -737,12 +739,11 @@ bool wxTextCtrl::AcceptsFocus() const
|
||||
|
||||
wxSize wxTextCtrl::DoGetBestSize() const
|
||||
{
|
||||
int wText = 100 ;
|
||||
|
||||
int hText;
|
||||
int wText, hText;
|
||||
|
||||
// these are the numbers from the HIG:
|
||||
// we reduce them by the borders first
|
||||
wText = 100 ;
|
||||
|
||||
switch ( m_windowVariant )
|
||||
{
|
||||
@@ -986,14 +987,16 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
{
|
||||
// perform keystroke handling
|
||||
if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
|
||||
{
|
||||
CallNextEventHandler( (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef(), (EventRef)wxTheApp->MacGetCurrentEvent() ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventRecord rec ;
|
||||
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
|
||||
{
|
||||
EventRecord *ev = &rec ;
|
||||
short keycode, keychar ;
|
||||
EventRecord *ev = &rec ;
|
||||
keychar = short(ev->message & charCodeMask);
|
||||
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
||||
|
||||
@@ -1536,6 +1539,7 @@ wxString wxMacMLTEControl::GetStringValue() const
|
||||
wxString result ;
|
||||
OSStatus err ;
|
||||
Size actualSize = 0;
|
||||
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
Handle theText ;
|
||||
@@ -1555,7 +1559,7 @@ wxString wxMacMLTEControl::GetStringValue() const
|
||||
|
||||
#if SIZEOF_WCHAR_T == 2
|
||||
ptr = new wxChar[actualSize + 1] ;
|
||||
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
|
||||
wxStrncpy( ptr , (wxChar*)(*theText) , actualSize ) ;
|
||||
#else
|
||||
SetHandleSize( theText, (actualSize + 1) * sizeof(UniChar) ) ;
|
||||
HLock( theText ) ;
|
||||
@@ -1612,8 +1616,8 @@ wxString wxMacMLTEControl::GetStringValue() const
|
||||
void wxMacMLTEControl::SetStringValue( const wxString &str )
|
||||
{
|
||||
wxString st = str;
|
||||
|
||||
wxMacConvertNewlines10To13( &st );
|
||||
|
||||
{
|
||||
wxMacWindowClipper c( m_peer );
|
||||
|
||||
@@ -1629,38 +1633,34 @@ void wxMacMLTEControl::SetStringValue( const wxString &str )
|
||||
|
||||
TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle )
|
||||
{
|
||||
TXNFrameOptions frameOptions =
|
||||
kTXNDontDrawCaretWhenInactiveMask
|
||||
TXNFrameOptions frameOptions = kTXNDontDrawCaretWhenInactiveMask;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
| kTXNDoFontSubstitutionMask
|
||||
frameOptions |= kTXNDoFontSubstitutionMask;
|
||||
#endif
|
||||
;
|
||||
|
||||
if ( ! (wxStyle & wxTE_NOHIDESEL) )
|
||||
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
|
||||
|
||||
if ( wxStyle & (wxHSCROLL | wxTE_DONTWRAP) )
|
||||
frameOptions |= kTXNWantHScrollBarMask ;
|
||||
|
||||
if ( wxStyle & wxTE_MULTILINE )
|
||||
{
|
||||
if ( ! ( wxStyle & wxTE_DONTWRAP ) )
|
||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||
else
|
||||
{
|
||||
frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
|
||||
frameOptions |= kTXNWantHScrollBarMask ;
|
||||
}
|
||||
|
||||
if ( !(wxStyle & wxTE_NO_VSCROLL) )
|
||||
{
|
||||
frameOptions |= kTXNWantVScrollBarMask ;
|
||||
|
||||
if ( frameOptions & kTXNWantHScrollBarMask )
|
||||
frameOptions |= kTXNDrawGrowIconMask ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
frameOptions |= kTXNSingleLineOnlyMask ;
|
||||
|
||||
if ( wxStyle & wxHSCROLL )
|
||||
frameOptions |= kTXNWantHScrollBarMask ;
|
||||
}
|
||||
|
||||
return frameOptions ;
|
||||
}
|
||||
@@ -1682,10 +1682,10 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo
|
||||
|
||||
if ( m_windowStyle & wxTE_MULTILINE )
|
||||
{
|
||||
if (m_windowStyle & wxTE_DONTWRAP)
|
||||
iControlData[1].uValue = kTXNNoAutoWrap ;
|
||||
else
|
||||
iControlData[1].uValue = kTXNAutoWrap ;
|
||||
iControlData[1].uValue =
|
||||
(m_windowStyle & wxTE_DONTWRAP)
|
||||
? kTXNNoAutoWrap
|
||||
: kTXNAutoWrap;
|
||||
}
|
||||
|
||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) ) ;
|
||||
@@ -1708,9 +1708,10 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo
|
||||
{ kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } ,
|
||||
} ;
|
||||
|
||||
verify_noerr( TXNSetTypeAttributes (m_txn, sizeof( typeAttr ) / sizeof(TXNTypeAttributes) , typeAttr,
|
||||
kTXNStartOffset,
|
||||
kTXNEndOffset) );
|
||||
verify_noerr(
|
||||
TXNSetTypeAttributes(
|
||||
m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
|
||||
typeAttr, kTXNStartOffset, kTXNEndOffset ) );
|
||||
}
|
||||
|
||||
if ( m_windowStyle & wxTE_PASSWORD )
|
||||
@@ -1976,8 +1977,7 @@ long wxMacMLTEControl::XYToPosition(long x, long y) const
|
||||
// line metrics of a certain line, we don't get its starting
|
||||
// position, so it would probably be rather a binary search
|
||||
// for the start position
|
||||
long xpos = 0 ;
|
||||
long ypos = 0 ;
|
||||
long xpos = 0, ypos = 0 ;
|
||||
int lastHeight = 0 ;
|
||||
ItemCount n ;
|
||||
|
||||
@@ -2017,7 +2017,7 @@ bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
|
||||
lastpos = GetLastPosition() ;
|
||||
if ( pos <= lastpos )
|
||||
{
|
||||
// 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
|
||||
// position, so it would probably be rather a binary search
|
||||
// for the start position
|
||||
@@ -2256,8 +2256,7 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef
|
||||
break ;
|
||||
|
||||
case kControlIndicatorPart :
|
||||
delta = value -
|
||||
( isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue ) ;
|
||||
delta = value - (isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue) ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
@@ -2433,11 +2432,13 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
||||
#endif
|
||||
#else
|
||||
|
||||
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
||||
TXNSetFrameBounds(
|
||||
m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
||||
wxMax( m_txnControlBounds.bottom, m_txnControlBounds.top ),
|
||||
wxMax( m_txnControlBounds.right, m_txnControlBounds.left ), m_txnFrameID );
|
||||
#endif
|
||||
// the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a
|
||||
|
||||
// the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
|
||||
// movement, therefore we have to force it
|
||||
|
||||
// this problem has been reported in OSX as well, so we use this here once again
|
||||
@@ -2521,8 +2522,8 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxIn
|
||||
case kControlEditTextPart :
|
||||
{
|
||||
wxMacWindowClipper clipper( textctrl ) ;
|
||||
|
||||
EventRecord rec ;
|
||||
|
||||
ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
||||
TXNClick( m_txn, &rec );
|
||||
}
|
||||
@@ -2589,12 +2590,11 @@ void wxMacMLTEClassicControl::MacControlUserPaneActivateProc( bool activating)
|
||||
|
||||
wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
|
||||
{
|
||||
ControlPartCode focusResult;
|
||||
ControlPartCode focusResult = kControlFocusNoPart;
|
||||
|
||||
focusResult = kControlFocusNoPart;
|
||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
||||
if ( textctrl == NULL )
|
||||
return 0;
|
||||
return focusResult;
|
||||
|
||||
wxMacWindowClipper clipper( textctrl ) ;
|
||||
|
||||
@@ -2633,9 +2633,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
|
||||
m_windowStyle = style ;
|
||||
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
|
||||
|
||||
short featureSet;
|
||||
|
||||
featureSet =
|
||||
short featureSet =
|
||||
kControlSupportsEmbedding | kControlSupportsFocus | kControlWantsIdle
|
||||
| kControlWantsActivate | kControlHandlesTracking
|
||||
// | kControlHasSpecialBackground
|
||||
@@ -2802,6 +2800,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
||||
#endif
|
||||
|
||||
// calculate the rectangles used by the control
|
||||
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
|
||||
|
||||
@@ -2849,11 +2848,10 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
||||
|
||||
#endif
|
||||
|
||||
verify_noerr(TXNNewObject(NULL, m_txnWindow , &bounds,
|
||||
frameOptions ,
|
||||
kTXNTextEditStyleFrameType,
|
||||
kTXNTextensionFile,
|
||||
kTXNSystemDefaultEncoding,
|
||||
verify_noerr(
|
||||
TXNNewObject(
|
||||
NULL, m_txnWindow, &bounds, frameOptions,
|
||||
kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
|
||||
&m_txn, &m_txnFrameID, NULL ) );
|
||||
|
||||
#if 0
|
||||
|
Reference in New Issue
Block a user