NO_BORDER support backported into carbon subdir

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26397 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-03-27 05:37:31 +00:00
parent 3fd35d583b
commit 0047cda214

View File

@@ -216,8 +216,17 @@ static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart
InvalWindowRect( GetControlOwner( theControl ) , &oldbounds ) ; InvalWindowRect( GetControlOwner( theControl ) , &oldbounds ) ;
SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom); SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom); SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) ,
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2)); if (!wxFindControlFromMacControl(theControl)->HasFlag(wxNO_BORDER))
{
SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) ,
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2));
}
else
{
SetRect(&varsp->fRTextArea, bounds.left , bounds.top ,
bounds.right, bounds.bottom);
}
RectRgn(varsp->fTextBackgroundRgn, &varsp->fRTextOutline); RectRgn(varsp->fTextBackgroundRgn, &varsp->fRTextOutline);
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left, TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left,
@@ -237,9 +246,12 @@ static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart
TXNDraw(varsp->fTXNRec, NULL); TXNDraw(varsp->fTXNRec, NULL);
/* restore the drawing environment */ /* restore the drawing environment */
/* draw the text frame and focus frame (if necessary) */ /* draw the text frame and focus frame (if necessary) */
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); if (!wxFindControlFromMacControl(theControl)->HasFlag(wxNO_BORDER))
if ((**tpvars).fIsActive && varsp->fInFocus) {
DrawThemeFocusRect(&varsp->fRFocusOutline, true); DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
if ((**tpvars).fIsActive && varsp->fInFocus)
DrawThemeFocusRect(&varsp->fRFocusOutline, true);
}
/* release our globals */ /* release our globals */
HSetState((Handle) tpvars, state); HSetState((Handle) tpvars, state);
} }
@@ -419,9 +431,12 @@ static pascal void TPPaneActivateProc(ControlHandle theControl, Boolean activati
/* redraw the frame */ /* redraw the frame */
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
{ {
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); if (!wxFindControlFromMacControl(theControl)->HasFlag(wxNO_BORDER))
if (varsp->fInFocus) {
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive); DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
if (varsp->fInFocus)
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive);
}
} }
HSetState((Handle) tpvars, state); HSetState((Handle) tpvars, state);
} }
@@ -482,11 +497,14 @@ static pascal ControlPartCode TPPaneFocusProc(ControlHandle theControl, ControlF
new focus state */ new focus state */
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
{ {
/* save the drawing state */ if (!wxFindControlFromMacControl(theControl)->HasFlag(wxNO_BORDER))
SetPort((**tpvars).fDrawingEnvironment); {
wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ; /* save the drawing state */
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); SetPort((**tpvars).fDrawingEnvironment);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus); wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus);
}
} }
/* done */ /* done */
HSetState((Handle) tpvars, state); HSetState((Handle) tpvars, state);
@@ -548,8 +566,17 @@ OSStatus mUPOpenControl(ControlHandle theControl, long wxStyle )
GetControlBounds(theControl, &bounds); GetControlBounds(theControl, &bounds);
SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom); SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom); SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) , if ((wxStyle & wxNO_BORDER) != wxNO_BORDER)
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2)); {
SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) ,
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2));
}
else
{
SetRect(&varsp->fRTextArea, bounds.left , bounds.top ,
bounds.right, bounds.bottom);
}
/* calculate the background region for the text. In this case, it's kindof /* calculate the background region for the text. In this case, it's kindof
and irregular region because we're setting the scroll bar a little ways inside and irregular region because we're setting the scroll bar a little ways inside
of the text area. */ of the text area. */
@@ -731,7 +758,12 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
return FALSE; return FALSE;
wxSize mySize = size ; wxSize mySize = size ;
if ( m_macUsesTXN ) if (style & wxNO_BORDER)
{
m_macHorizontalBorder = 0 ;
m_macVerticalBorder = 0 ;
}
else if ( m_macUsesTXN )
{ {
m_macHorizontalBorder = 5 ; // additional pixels around the real control m_macHorizontalBorder = 5 ; // additional pixels around the real control
m_macVerticalBorder = 3 ; m_macVerticalBorder = 3 ;