]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/stattext.h
adding missing defaults
[wxWidgets.git] / include / wx / stattext.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: stattext.h
3// Purpose: wxStaticText base header
4// Author: Julian Smart
5// Modified by:
6// Created:
7// Copyright: (c) Julian Smart
8// RCS-ID: $Id$
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_STATTEXT_H_BASE_
13#define _WX_STATTEXT_H_BASE_
14
15#include "wx/defs.h"
16
17#if wxUSE_STATTEXT
18
19#include "wx/control.h"
20
21/*
22 * wxStaticText flags
23 */
24#define wxST_NO_AUTORESIZE 0x0001
25#define wxST_MARKUP 0x0002
26
27#define wxST_ELLIPSIZE_START 0x0004
28#define wxST_ELLIPSIZE_MIDDLE 0x0008
29#define wxST_ELLIPSIZE_END 0x0010
30
31
32extern WXDLLEXPORT_DATA(const wxChar) wxStaticTextNameStr[];
33
34class WXDLLEXPORT wxStaticTextBase : public wxControl
35{
36public:
37 wxStaticTextBase() { }
38
39 // wrap the text of the control so that no line is longer than the given
40 // width (if possible: this function won't break words)
41 // This function will modify the value returned by GetLabel()!
42 void Wrap(int width);
43
44 // overriden base virtuals
45 virtual bool AcceptsFocus() const { return false; }
46 virtual bool HasTransparentBackground() { return true; }
47
48 bool IsEllipsized() const
49 {
50 return HasFlag(wxST_ELLIPSIZE_START) ||
51 HasFlag(wxST_ELLIPSIZE_MIDDLE) ||
52 HasFlag(wxST_ELLIPSIZE_END);
53 }
54
55 // get the string without mnemonic characters ('&') and without markup
56 // (if wxST_MARKUP is being used)
57 virtual wxString GetLabelText() const;
58
59 // public utilities (symmetric to those in wxControl about mnemonics):
60
61 // removes the markup accepted by wxStaticText when wxST_MARKUP is used,
62 // and then returns the cleaned string
63 static wxString RemoveMarkup(const wxString& str);
64
65 // escapes the alls special symbols (<>"'&) present inside the given string
66 // using the corresponding entities (&lt; &gt; &quot; &apos; &amp;)
67 static wxString EscapeMarkup(const wxString& str);
68
69
70protected: // functions required for wxST_ELLIPSIZE_* support
71
72 // just calls RemoveMarkup & Ellipsize on the original label.
73 virtual wxString GetEllipsizedLabelWithoutMarkup() const;
74
75 // replaces parts of the string with ellipsis if needed
76 wxString Ellipsize(const wxString& label) const;
77
78 // to be called when updating the size of the static text:
79 // updates the label redoing ellipsization calculations
80 void UpdateLabel();
81
82 // These functions are platform-specific and must be overridden in ports
83 // which do not natively support ellipsization and they must be implemented
84 // in a way so that the m_label member of wxControl is not touched:
85
86 // returns the real label currently displayed inside the control.
87 virtual wxString DoGetLabel() const { return wxEmptyString; }
88
89 // sets the real label currently displayed inside the control,
90 // _without_ invalidating the size. The text passed is always markup-free.
91 virtual void DoSetLabel(const wxString& WXUNUSED(str)) { }
92
93private:
94 DECLARE_NO_COPY_CLASS(wxStaticTextBase)
95};
96
97#if defined(__WXUNIVERSAL__)
98 #include "wx/univ/stattext.h"
99#elif defined(__WXMSW__)
100 #include "wx/msw/stattext.h"
101#elif defined(__WXMOTIF__)
102 #include "wx/motif/stattext.h"
103#elif defined(__WXGTK20__)
104 #include "wx/gtk/stattext.h"
105#elif defined(__WXGTK__)
106 #include "wx/gtk1/stattext.h"
107#elif defined(__WXMAC__)
108 #include "wx/mac/stattext.h"
109#elif defined(__WXCOCOA__)
110 #include "wx/cocoa/stattext.h"
111#elif defined(__WXPM__)
112 #include "wx/os2/stattext.h"
113#elif defined(__WXPALMOS__)
114 #include "wx/palmos/stattext.h"
115#endif
116
117#endif // wxUSE_STATTEXT
118
119#endif
120 // _WX_STATTEXT_H_BASE_