]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/stattext_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/stattext.cpp
3 // Purpose: wxStaticText
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: stattext.cpp 54845 2008-07-30 14:52:41Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/stattext.h"
22 #include "wx/dcclient.h"
23 #include "wx/settings.h"
26 #include "wx/notebook.h"
27 #include "wx/tabctrl.h"
29 #include "wx/osx/private.h"
33 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
)
36 bool wxStaticText::Create( wxWindow
*parent
,
38 const wxString
& label
,
42 const wxString
& name
)
44 m_macIsUserPane
= false;
46 if ( !wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
49 m_peer
= wxWidgetImpl::CreateStaticText( this, parent
, id
, label
, pos
, size
, style
, GetExtraStyle() );
51 MacPostControlCreate( pos
, size
);
58 void wxStaticText::SetLabel(const wxString
& label
)
62 // middle/end ellipsization is handled by the OS:
63 if ( HasFlag(wxST_ELLIPSIZE_END
) || HasFlag(wxST_ELLIPSIZE_MIDDLE
) )
67 if (HasFlag(wxST_MARKUP
))
68 str
= RemoveMarkup(label
);
70 // and leave ellipsization to the OS
73 else // not supported natively
75 DoSetLabel(GetEllipsizedLabelWithoutMarkup());
78 if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE
) &&
79 !IsEllipsized() ) // don't resize if we adjust to current size
82 SetSize( GetBestSize() );
87 // we shouldn't need forced updates
91 bool wxStaticText::SetFont(const wxFont
& font
)
93 bool ret
= wxControl::SetFont( font
);
97 if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE
) )
100 SetSize( GetBestSize() );
107 void wxStaticText::DoSetLabel(const wxString
& label
)
110 m_label
= RemoveMnemonics(label
);
111 m_peer
->SetLabel(m_label
, GetFont().GetEncoding() );
114 wxString
wxStaticText::DoGetLabel() const
120 FIXME: UpdateLabel() should be called on size events when wxST_ELLIPSIZE_START is set
121 to allow correct dynamic ellipsizing of the label
124 #endif //if wxUSE_STATTEXT