// around text control.
static const wxCoord MARGIN = 6;
static const int POPUPWIDTH = 24;
+// this is the border a focus rect on OSX is needing
+static const int TEXTFOCUSBORDER = 3 ;
#else
static const wxCoord MARGIN = 2;
static const int POPUPWIDTH = 18;
+static const int TEXTFOCUSBORDER = 0 ;
#endif
static const int POPUPHEIGHT = 23;
if (sizeText.y > size.y)
size.y = sizeText.y;
size.x = POPUPWIDTH + sizeText.x + MARGIN;
+ size.x += TEXTFOCUSBORDER ;
+ size.y += 2 * TEXTFOCUSBORDER ;
}
-
return size;
}
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
- height = POPUPHEIGHT;
- int origin = 0;
-#if TARGET_API_MAC_OSX
- // give the controls some padding so that the text ctrl's borders
- // and blue highlight can appear
- origin = 4;
-#endif
-
- wxControl::DoMoveWindow(x, y, width + origin, height + origin);
-
+ wxControl::DoMoveWindow(x, y, width , height );
+
if ( m_text == NULL )
{
// we might not be fully constructed yet, therefore watch out...
else
{
wxCoord wText = width - POPUPWIDTH - MARGIN;
-#if TARGET_API_MAC_OSX
- // also, we need to shrink the size of the wxTextCtrl a bit
- // to make it appear properly on OS X.
- height -= 8;
- wText -= 8;
-#endif
- m_text->SetSize(origin, origin, wText, height);
- m_choice->SetSize(origin + wText + MARGIN, 0, POPUPWIDTH, -1);
+ m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1 );
+ m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN, TEXTFOCUSBORDER, POPUPWIDTH, -1);
}
}
else
{
m_text = new wxComboBoxText(this);
- if ( size.y == -1 ) {
- csize.y = m_text->GetSize().y ;
+ if ( size.y == -1 )
+ {
+ csize.y = m_text->GetSize().y ;
+ csize.y += 2 * TEXTFOCUSBORDER ;
}
}
// implementation available under OSX
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+
class wxMacMLTEHIViewControl : public wxMacMLTEControl
{
public :
HIViewRef m_textView ;
} ;
+#endif
+
class wxMacUnicodeTextControl : public wxMacTextControl
{
public :
#define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL
-#if TARGET_API_MAC_OSX
- #define wxMAC_USE_MLTE 1
- #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
- #define wxMAC_USE_MLTE_HIVIEW 1
- #else
- #define wxMAC_USE_MLTE_HIVIEW 0
- #endif
-#else
- // there is no unicodetextctrl on classic, and hopefully MLTE works better there
- #define wxMAC_USE_MLTE 1
- #define wxMAC_USE_MLTE_HIVIEW 0
-#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
m_macIsUserPane = FALSE ;
m_editable = true ;
- // base initialization
-
if ( !HasFlag(wxNO_BORDER) )
- {
-#if wxMAC_USE_MLTE
-#if wxMAC_USE_MLTE_HIVIEW
style |= wxSUNKEN_BORDER ;
-#endif
-#endif
- }
- else
- {
- }
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
return FALSE;
m_windowStyle |= wxTE_PROCESS_ENTER;
style |= wxTE_PROCESS_ENTER ;
}
-#if wxMAC_USE_MLTE
-#if wxMAC_USE_MLTE_HIVIEW
- m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
+#if TARGET_API_MAC_OSX
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ {
+ m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
+ }
+ else
+#endif
+ {
+ m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
+ }
#else
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
-#endif
-#else // wxMAC_USE_MLTE
- m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
#endif
+
MacPostControlCreate(pos,size) ;
if ( m_windowStyle & wxTE_READONLY)
break ;
}
-#if !wxMAC_USE_MLTE
- // unicode text control is using client size, ie 3 pixels on every side
- // TODO make this fit into normal window size concept, probably having
- // to reintroduce the margin vars
- hText -= 6 ;
-#endif
+ if ( HasFlag(wxNO_BORDER) )
+ hText -= 6 ;
if ( m_windowStyle & wxTE_MULTILINE )
{
if ( MacGetTopLevelWindow() && m_peer->NeedsFocusRect() )
{
- wxWindowDC dc(this) ;
- wxMacPortSetter helper(&dc) ;
+ wxMacWindowStateSaver sv( this ) ;
+// wxWindowDC dc(this) ;
+// wxMacPortSetter helper(&dc) ;
int w , h ;
+ int x , y ;
+ x = y = 0 ;
+ MacWindowToRootWindow( &x , &y ) ;
GetSize( &w , &h ) ;
- Rect rect = { dc.m_macLocalOrigin.y , dc.m_macLocalOrigin.x , h + dc.m_macLocalOrigin.y , w + dc.m_macLocalOrigin.x } ;
+ Rect rect = {y , x , h + y , w + x } ;
if ( event.GetEventType() == wxEVT_SET_FOCUS )
DrawThemeFocusRect( &rect , true ) ;