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