1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticText base header
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATTEXT_H_BASE_
13 #define _WX_STATTEXT_H_BASE_
19 #include "wx/control.h"
24 #define wxST_NO_AUTORESIZE 0x0001
26 #define wxST_ELLIPSIZE_START 0x0004
27 #define wxST_ELLIPSIZE_MIDDLE 0x0008
28 #define wxST_ELLIPSIZE_END 0x0010
30 extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr
[];
32 class WXDLLIMPEXP_CORE wxStaticTextBase
: public wxControl
35 wxStaticTextBase() { }
37 // wrap the text of the control so that no line is longer than the given
38 // width (if possible: this function won't break words)
39 // This function will modify the value returned by GetLabel()!
42 // overridden base virtuals
43 virtual bool AcceptsFocus() const { return false; }
44 virtual bool HasTransparentBackground() { return true; }
46 bool IsEllipsized() const
48 return HasFlag(wxST_ELLIPSIZE_START
) ||
49 HasFlag(wxST_ELLIPSIZE_MIDDLE
) ||
50 HasFlag(wxST_ELLIPSIZE_END
);
53 protected: // functions required for wxST_ELLIPSIZE_* support
55 // choose the default border for this window
56 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
58 // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(),
59 // keeps the mnemonics instead of removing them.
60 virtual wxString
GetEllipsizedLabel() const;
62 // Replaces parts of the string with ellipsis according to the ellipsize
63 // style. Shouldn't be called if we don't have any.
64 wxString
Ellipsize(const wxString
& label
) const;
66 // to be called when updating the size of the static text:
67 // updates the label redoing ellipsization calculations
70 // These functions are platform-specific and must be overridden in ports
71 // which do not natively support ellipsization and they must be implemented
72 // in a way so that the m_labelOrig member of wxControl is not touched:
74 // returns the real label currently displayed inside the control.
75 virtual wxString
DoGetLabel() const { return wxEmptyString
; }
77 // sets the real label currently displayed inside the control,
78 // _without_ invalidating the size. The text passed is always markup-free
79 // but may contain the mnemonic characters.
80 virtual void DoSetLabel(const wxString
& WXUNUSED(str
)) { }
83 wxDECLARE_NO_COPY_CLASS(wxStaticTextBase
);
86 // see wx/generic/stattextg.h for the explanation
87 #ifndef wxNO_PORT_STATTEXT_INCLUDE
89 #if defined(__WXUNIVERSAL__)
90 #include "wx/univ/stattext.h"
91 #elif defined(__WXMSW__)
92 #include "wx/msw/stattext.h"
93 #elif defined(__WXMOTIF__)
94 #include "wx/motif/stattext.h"
95 #elif defined(__WXGTK20__)
96 #include "wx/gtk/stattext.h"
97 #elif defined(__WXGTK__)
98 #include "wx/gtk1/stattext.h"
99 #elif defined(__WXMAC__)
100 #include "wx/osx/stattext.h"
101 #elif defined(__WXCOCOA__)
102 #include "wx/cocoa/stattext.h"
103 #elif defined(__WXPM__)
104 #include "wx/os2/stattext.h"
105 #elif defined(__WXPALMOS__)
106 #include "wx/palmos/stattext.h"
109 #endif // !wxNO_PORT_STATTEXT_INCLUDE
111 #endif // wxUSE_STATTEXT
113 #endif // _WX_STATTEXT_H_BASE_