X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3355efa93c7ef81088344b7ddbc7355c4730bb57..946fb2b9dd3be2f4805ddb2aca67e11f6f7c4cdd:/src/mac/stattext.cpp diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 39a5e39b06..15e3076d71 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -20,6 +20,7 @@ #include "wx/dc.h" #include "wx/dcclient.h" #include "wx/utils.h" +#include "wx/settings.h" #include @@ -60,10 +61,10 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString punct = " ,.-;:!?"; -void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph) +void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y) { int x = 0 ; - int y = 0 ; + int i = 0 ; long width, height ; bool linedrawn = true; @@ -127,45 +128,44 @@ void wxStaticText::OnDraw( wxDC &dc ) { if (m_width <= 0 || m_height <= 0) return; - - wxString paragraph; - int i = 0 ; - wxString text = m_label; - - PrepareDC(dc); - - bool doClear = true ; - WindowRef window = GetMacRootWindow() ; - if ( window ) - { - wxWindow* win = wxFindWinFromMacWindow( window ) ; - if ( win ) - { - wxWindow* parent = GetParent() ; - while ( parent ) - { - if( parent->MacGetWindowData() ) - { - break ; - } - - parent = parent->GetParent() ; - } - } - } +/* + dc.Clear() ; + wxRect rect(0,0,m_width,m_height) ; + dc.SetFont(*wxSMALL_FONT) ; - while (i < text.Length()) - { + dc.DrawRectangle(rect) ; +*/ + if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) && + ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE ) + || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) ) + { + dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ; + } + else + { + dc.SetTextForeground( GetForegroundColour() ) ; + } + + wxString paragraph; + int i = 0 ; + wxString text = m_label; + int y = 0 ; + while (i < text.Length()) + { + + if (text[i] == 13 || text[i] == 10) + { + DrawParagraph(dc, paragraph,y); + paragraph = "" ; + } + else + { paragraph += text[i]; - - if (text[i] == 13 || text[i] == 10) - DrawParagraph(dc, paragraph); - - ++i; } - - if (paragraph.Length() > 0) - DrawParagraph(dc, paragraph); + ++i; + } + if (paragraph.Length() > 0) + DrawParagraph(dc, paragraph,y); } void wxStaticText::OnPaint( wxPaintEvent &event ) @@ -176,7 +176,6 @@ void wxStaticText::OnPaint( wxPaintEvent &event ) wxSize wxStaticText::DoGetBestSize() const { - int x,y ; int widthTextMax = 0, widthLine, heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; @@ -227,13 +226,11 @@ wxSize wxStaticText::DoGetBestSize() const void wxStaticText::SetLabel(const wxString& st ) { - SetTitle( st ) ; - m_label = st ; - if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - SetSize( GetBestSize() ) ; - - Refresh() ; - MacUpdateImmediately() ; -// wxClientDC dc(this); -// OnDraw( dc ) ; + SetTitle( st ) ; + m_label = st ; + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + SetSize( GetBestSize() ) ; + + Refresh() ; + Update() ; }