]>
Commit | Line | Data |
---|---|---|
2ecf902b | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/stattext.h |
2ecf902b | 3 | // Purpose: wxStaticText base header |
99d80019 | 4 | // Author: Julian Smart |
2ecf902b WS |
5 | // Modified by: |
6 | // Created: | |
99d80019 | 7 | // Copyright: (c) Julian Smart |
2ecf902b WS |
8 | // Licence: wxWindows licence |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
34138703 JS |
11 | #ifndef _WX_STATTEXT_H_BASE_ |
12 | #define _WX_STATTEXT_H_BASE_ | |
c801d85f | 13 | |
2ecf902b WS |
14 | #include "wx/defs.h" |
15 | ||
1e6feb95 VZ |
16 | #if wxUSE_STATTEXT |
17 | ||
18 | #include "wx/control.h" | |
19 | ||
39bc0347 VZ |
20 | /* |
21 | * wxStaticText flags | |
22 | */ | |
23 | #define wxST_NO_AUTORESIZE 0x0001 | |
3da9cffc | 24 | // free 0x0002 bit |
5c87527c FM |
25 | #define wxST_ELLIPSIZE_START 0x0004 |
26 | #define wxST_ELLIPSIZE_MIDDLE 0x0008 | |
27 | #define wxST_ELLIPSIZE_END 0x0010 | |
39bc0347 | 28 | |
53a2db12 | 29 | extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[]; |
1e6feb95 | 30 | |
53a2db12 | 31 | class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl |
1e6feb95 VZ |
32 | { |
33 | public: | |
fc7a2a60 VZ |
34 | wxStaticTextBase() { } |
35 | ||
5d1b4919 VZ |
36 | // wrap the text of the control so that no line is longer than the given |
37 | // width (if possible: this function won't break words) | |
39bc0347 | 38 | // This function will modify the value returned by GetLabel()! |
5d1b4919 VZ |
39 | void Wrap(int width); |
40 | ||
4c51a665 | 41 | // overridden base virtuals |
bd507486 | 42 | virtual bool AcceptsFocus() const { return false; } |
7c7a653b | 43 | virtual bool HasTransparentBackground() { return true; } |
fc7a2a60 | 44 | |
39bc0347 VZ |
45 | bool IsEllipsized() const |
46 | { | |
47 | return HasFlag(wxST_ELLIPSIZE_START) || | |
48 | HasFlag(wxST_ELLIPSIZE_MIDDLE) || | |
49 | HasFlag(wxST_ELLIPSIZE_END); | |
50 | } | |
51 | ||
39bc0347 VZ |
52 | protected: // functions required for wxST_ELLIPSIZE_* support |
53 | ||
dc797d8e JS |
54 | // choose the default border for this window |
55 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
56 | ||
3da9cffc VZ |
57 | // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(), |
58 | // keeps the mnemonics instead of removing them. | |
59 | virtual wxString GetEllipsizedLabel() const; | |
39bc0347 | 60 | |
3da9cffc VZ |
61 | // Replaces parts of the string with ellipsis according to the ellipsize |
62 | // style. Shouldn't be called if we don't have any. | |
39bc0347 VZ |
63 | wxString Ellipsize(const wxString& label) const; |
64 | ||
65 | // to be called when updating the size of the static text: | |
66 | // updates the label redoing ellipsization calculations | |
67 | void UpdateLabel(); | |
68 | ||
69 | // These functions are platform-specific and must be overridden in ports | |
70 | // which do not natively support ellipsization and they must be implemented | |
7517dcb5 | 71 | // in a way so that the m_labelOrig member of wxControl is not touched: |
39bc0347 VZ |
72 | |
73 | // returns the real label currently displayed inside the control. | |
74 | virtual wxString DoGetLabel() const { return wxEmptyString; } | |
75 | ||
76 | // sets the real label currently displayed inside the control, | |
7517dcb5 FM |
77 | // _without_ invalidating the size. The text passed is always markup-free |
78 | // but may contain the mnemonic characters. | |
39bc0347 VZ |
79 | virtual void DoSetLabel(const wxString& WXUNUSED(str)) { } |
80 | ||
fc7a2a60 | 81 | private: |
c0c133e1 | 82 | wxDECLARE_NO_COPY_CLASS(wxStaticTextBase); |
1e6feb95 VZ |
83 | }; |
84 | ||
bce49490 VZ |
85 | // see wx/generic/stattextg.h for the explanation |
86 | #ifndef wxNO_PORT_STATTEXT_INCLUDE | |
87 | ||
1e6feb95 VZ |
88 | #if defined(__WXUNIVERSAL__) |
89 | #include "wx/univ/stattext.h" | |
90 | #elif defined(__WXMSW__) | |
91 | #include "wx/msw/stattext.h" | |
2049ba38 | 92 | #elif defined(__WXMOTIF__) |
1e6feb95 | 93 | #include "wx/motif/stattext.h" |
1be7a35c | 94 | #elif defined(__WXGTK20__) |
1e6feb95 | 95 | #include "wx/gtk/stattext.h" |
1be7a35c MR |
96 | #elif defined(__WXGTK__) |
97 | #include "wx/gtk1/stattext.h" | |
34138703 | 98 | #elif defined(__WXMAC__) |
ef0e9220 | 99 | #include "wx/osx/stattext.h" |
e64df9bc DE |
100 | #elif defined(__WXCOCOA__) |
101 | #include "wx/cocoa/stattext.h" | |
1777b9bb | 102 | #elif defined(__WXPM__) |
1e6feb95 | 103 | #include "wx/os2/stattext.h" |
c801d85f KB |
104 | #endif |
105 | ||
bce49490 VZ |
106 | #endif // !wxNO_PORT_STATTEXT_INCLUDE |
107 | ||
1e6feb95 VZ |
108 | #endif // wxUSE_STATTEXT |
109 | ||
bce49490 | 110 | #endif // _WX_STATTEXT_H_BASE_ |