]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/textctrl_osx.cpp
Fix needed to allow shaped windows, and other windows without a title bar, to get...
[wxWidgets.git] / src / osx / textctrl_osx.cpp
index 1ff3094dbc4d7c49ecec37b518bc5d5c23097642..ae3328808aa9aa6fb609aac8148668cab16c6b6e 100644 (file)
@@ -190,7 +190,8 @@ bool wxTextCtrl::SetFont( const wxFont& font )
 
 bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
 {
-    GetTextPeer()->SetStyle( start , end , style ) ;
+    if (GetTextPeer())
+        GetTextPeer()->SetStyle( start , end , style ) ;
 
     return true ;
 }
@@ -337,6 +338,13 @@ bool wxTextCtrl::AcceptsFocus() const
 
 wxSize wxTextCtrl::DoGetBestSize() const
 {
+    if (GetTextPeer())
+    {
+        wxSize size = GetTextPeer()->GetBestSize();
+        if (size.x > 0 && size.y > 0)
+            return size;
+    }
+    
     int wText, hText;
 
     // these are the numbers from the HIG:
@@ -373,6 +381,11 @@ wxSize wxTextCtrl::DoGetBestSize() const
     return wxSize(wText, hText);
 }
 
+bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
+{
+    return GetTextPeer()->GetStyle(position, style);
+}
+
 // ----------------------------------------------------------------------------
 // Undo/redo
 // ----------------------------------------------------------------------------
@@ -724,6 +737,12 @@ bool wxTextCtrl::MacSetupCursor( const wxPoint& pt )
 // implementation base class
 // ----------------------------------------------------------------------------
 
+bool wxTextWidgetImpl::GetStyle(long WXUNUSED(position),
+                                wxTextAttr& WXUNUSED(style))
+{
+    return false;
+}
+
 void wxTextWidgetImpl::SetStyle(long WXUNUSED(start),
                                 long WXUNUSED(end),
                                 const wxTextAttr& WXUNUSED(style))
@@ -815,7 +834,11 @@ int wxTextWidgetImpl::GetNumberOfLines() const
 
     for (size_t i = 0; i < content.length() ; i++)
     {
+#if wxOSX_USE_COCOA
+        if (content[i] == '\n')
+#else
         if (content[i] == '\r')
+#endif
             lines++;
     }