git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62725
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void SetStyle(long start, long end, const wxTextAttr& style);
virtual void CheckSpelling(bool check);
virtual void SetStyle(long start, long end, const wxTextAttr& style);
virtual void CheckSpelling(bool check);
+ virtual wxSize GetBestSize() const;
protected:
NSScrollView* m_scrollView;
protected:
NSScrollView* m_scrollView;
virtual int GetLineLength(long lineNo) const ;
virtual wxString GetLineText(long lineNo) const ;
virtual void CheckSpelling(bool WXUNUSED(check)) { }
virtual int GetLineLength(long lineNo) const ;
virtual wxString GetLineText(long lineNo) const ;
virtual void CheckSpelling(bool WXUNUSED(check)) { }
+
+ virtual wxSize GetBestSize() const { return wxDefaultSize; }
[m_textView setContinuousSpellCheckingEnabled: check];
}
[m_textView setContinuousSpellCheckingEnabled: check];
}
+wxSize wxNSTextViewControl::GetBestSize() const
+{
+ if (m_textView && [m_textView layoutManager])
+ {
+ NSRect rect = [[m_textView layoutManager] usedRectForTextContainer: [m_textView textContainer]];
+ wxSize size = wxSize(rect.size.width, rect.size.height);
+ size.x += [m_textView textContainerInset].width;
+ size.y += [m_textView textContainerInset].height;
+ return size;
+ }
+}
+
// wxNSTextFieldControl
wxNSTextFieldControl::wxNSTextFieldControl( wxTextCtrl *wxPeer, WXWidget w ) : wxWidgetCocoaImpl(wxPeer, w)
// wxNSTextFieldControl
wxNSTextFieldControl::wxNSTextFieldControl( wxTextCtrl *wxPeer, WXWidget w ) : wxWidgetCocoaImpl(wxPeer, w)
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
- GetTextPeer()->SetStyle( start , end , style ) ;
+ if (GetTextPeer())
+ GetTextPeer()->SetStyle( start , end , style ) ;
wxSize wxTextCtrl::DoGetBestSize() 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:
int wText, hText;
// these are the numbers from the HIG:
for (size_t i = 0; i < content.length() ; i++)
{
for (size_t i = 0; i < content.length() ; i++)
{
+#if wxOSX_USE_COCOA
+ if (content[i] == '\n')
+#else