/////////////////////////////////////////////////////////////////////////////
-// Name: stattext.cpp
+// Name: src/mac/classic/stattext.cpp
// Purpose: wxStaticText
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "stattext.h"
-#endif
+#include "wx/wxprec.h"
-#include "wx/app.h"
#include "wx/stattext.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/utils.h"
+ #include "wx/dc.h"
+ #include "wx/dcclient.h"
+ #include "wx/settings.h"
+#endif
+
#include "wx/notebook.h"
#include "wx/tabctrl.h"
-#include "wx/dc.h"
-#include "wx/dcclient.h"
-#include "wx/utils.h"
-#include "wx/settings.h"
#include <stdio.h>
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
-#endif
#include "wx/mac/uma.h"
void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
{
long width, height ;
-
- if (paragraph.Length() == 0)
+
+ if (paragraph.length() == 0)
{
// empty line
dc.GetTextExtent( wxT("H"), &width, &height );
y += height;
-
+
return;
}
int x = 0 ;
bool linedrawn = true;
- while( paragraph.Length() > 0 )
+ while( paragraph.length() > 0 )
{
dc.GetTextExtent( paragraph , &width , &height ) ;
-
+
if ( width > m_width )
{
- for ( size_t p = paragraph.Length() - 1 ; p > 0 ; --p )
+ for ( size_t p = paragraph.length() - 1 ; p > 0 ; --p )
{
if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn)
{
int blank = (paragraph[p] == ' ') ? 0 : 1;
-
+
dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ;
-
+
if ( width <= m_width )
{
int pos = x ;
{
pos += ( m_width - width ) ;
}
-
+
dc.DrawText( paragraph.Left(p + blank), pos , y) ;
y += height ;
paragraph = paragraph.Mid(p+1) ;
}
}
}
-
+
linedrawn = false;
}
else
{
pos += ( m_width - width ) ;
}
-
+
dc.DrawText( paragraph, pos , y) ;
paragraph=wxEmptyString;
y += height ;
dc.Clear() ;
wxRect rect(0,0,m_width,m_height) ;
dc.SetFont(*wxSMALL_FONT) ;
-
+
dc.DrawRectangle(rect) ;
*/
if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
{
dc.SetTextForeground( GetForegroundColour() ) ;
}
-
+
wxString paragraph;
size_t i = 0 ;
wxString text = m_label;
int y = 0 ;
- while (i < text.Length())
+ while (i < text.length())
{
-
+
if (text[i] == 13 || text[i] == 10)
{
DrawParagraph(dc, paragraph,y);
}
++i;
}
- if (paragraph.Length() > 0)
+ if (paragraph.length() > 0)
DrawParagraph(dc, paragraph,y);
}
void wxStaticText::SetLabel(const wxString& st )
{
- SetTitle( st ) ;
+ wxStaticTextBase::SetLabel( st ) ;
m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
{
{
bool ret = wxControl::SetFont(font);
- if ( ret )
- {
- // adjust the size of the window to fit to the label unless autoresizing is
- // disabled
- if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
- {
- // temporary fix until layout measurement and drawing are in synch again
- Refresh() ;
- InvalidateBestSize();
- SetSize( GetBestSize() );
- }
- }
+ if ( ret )
+ {
+ // adjust the size of the window to fit to the label unless autoresizing is
+ // disabled
+ if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+ {
+ // temporary fix until layout measurement and drawing are in synch again
+ Refresh() ;
+ InvalidateBestSize();
+ SetSize( GetBestSize() );
+ }
+ }
return ret;
}