2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: stattext.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxStaticText
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxStaticText
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A static text control displays one or more lines of read-only text.
|
2011-02-27 07:47:26 -05:00
|
|
|
wxStaticText supports the three classic text alignments, label
|
|
|
|
ellipsization i.e. replacing parts of the text with the ellipsis ("...") if
|
|
|
|
the label doesn't fit into the provided space and also formatting markup
|
|
|
|
with wxControl::SetLabelMarkup().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxALIGN_LEFT}
|
2008-12-28 16:16:00 -05:00
|
|
|
Align the text to the left.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxALIGN_RIGHT}
|
2008-12-28 16:16:00 -05:00
|
|
|
Align the text to the right.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxALIGN_CENTRE}
|
2008-12-28 16:16:00 -05:00
|
|
|
Center the text (horizontally).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxST_NO_AUTORESIZE}
|
2008-03-08 08:52:38 -05:00
|
|
|
By default, the control will adjust its size to exactly fit to the
|
2010-03-21 17:39:15 -04:00
|
|
|
size of the text when SetLabel() is called. If this style flag is
|
2008-03-08 08:52:38 -05:00
|
|
|
given, the control will not change its size (this style is
|
2010-03-21 17:39:15 -04:00
|
|
|
especially useful with controls which also have the @c wxALIGN_RIGHT or
|
2011-02-27 07:47:26 -05:00
|
|
|
the @c wxALIGN_CENTRE style because otherwise they won't make sense any
|
2010-03-21 17:39:15 -04:00
|
|
|
longer after a call to SetLabel()).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxST_ELLIPSIZE_START}
|
2008-12-28 14:24:13 -05:00
|
|
|
If the labeltext width exceeds the control width, replace the beginning
|
2008-12-28 16:16:00 -05:00
|
|
|
of the label with an ellipsis; uses wxControl::Ellipsize.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxST_ELLIPSIZE_MIDDLE}
|
2008-12-28 14:24:13 -05:00
|
|
|
If the label text width exceeds the control width, replace the middle
|
2008-12-28 16:16:00 -05:00
|
|
|
of the label with an ellipsis; uses wxControl::Ellipsize.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxST_ELLIPSIZE_END}
|
2008-12-28 14:24:13 -05:00
|
|
|
If the label text width exceeds the control width, replace the end
|
2008-12-28 16:16:00 -05:00
|
|
|
of the label with an ellipsis; uses wxControl::Ellipsize.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2008-10-13 04:05:18 -04:00
|
|
|
@appearance{statictext.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxStaticBitmap, wxStaticBox
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxStaticText : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-29 10:10:52 -04:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxStaticText();
|
2008-10-07 12:57:34 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a text control.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Should not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Control identifier. A value of -1 denotes a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
Text label.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxStaticText.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxStaticText(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxStaticTextNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creation function, for two-step construction. For details see wxStaticText().
|
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxString& name = wxStaticTextNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-12-28 14:24:13 -05:00
|
|
|
/**
|
|
|
|
Returns @true if the window styles for this control contains one of the
|
|
|
|
@c wxST_ELLIPSIZE_START, @c wxST_ELLIPSIZE_MIDDLE or @c wxST_ELLIPSIZE_END styles.
|
|
|
|
*/
|
|
|
|
bool IsEllipsized() const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
This functions wraps the controls label so that each of its lines becomes at
|
2008-03-09 08:33:59 -04:00
|
|
|
most @a width pixels wide if possible (the lines are broken at words
|
2008-10-07 12:57:34 -04:00
|
|
|
boundaries so it might not be the case if words are too long).
|
|
|
|
|
|
|
|
If @a width is negative, no wrapping is done. Note that this width is not
|
2008-05-12 08:47:59 -04:00
|
|
|
necessarily the total width of the control, since a few pixels for the
|
|
|
|
border (depending on the controls border style) may be added.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-21 06:34:23 -04:00
|
|
|
@since 2.6.2
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void Wrap(int width);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|