]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/stattextg.h
Don't return a dangling pointer from wxDateTime::ParseXXX(wxCStrData).
[wxWidgets.git] / include / wx / generic / stattextg.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/stattextg.h
3// Purpose: wxGenericStaticText header
4// Author: Marcin Wojdyr
5// Created: 2008-06-26
6// Id: $Id$
7// Copyright: Marcin Wojdyr
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_GENERIC_STATTEXTG_H_
12#define _WX_GENERIC_STATTEXTG_H_
13
14// prevent it from including the platform-specific wxStaticText declaration as
15// this is not going to compile if it derives from wxGenericStaticText defined
16// below (currently this is only the case in wxUniv but it could also happen
17// with other ports)
18#define wxNO_PORT_STATTEXT_INCLUDE
19#include "wx/stattext.h"
20#undef wxNO_PORT_STATTEXT_INCLUDE
21
22class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase
23{
24public:
25 wxGenericStaticText() { Init(); }
26
27 wxGenericStaticText(wxWindow *parent,
28 wxWindowID id,
29 const wxString& label,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxString& name = wxStaticTextNameStr)
34 {
35 Init();
36
37 Create(parent, id, label, pos, size, style, name);
38 }
39
40 bool Create(wxWindow *parent,
41 wxWindowID id,
42 const wxString& label,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = 0,
46 const wxString& name = wxStaticTextNameStr);
47
48 virtual ~wxGenericStaticText();
49
50
51 // overridden base class virtual methods
52 virtual void SetLabel(const wxString& label);
53 virtual bool SetFont(const wxFont &font);
54
55protected:
56 virtual wxSize DoGetBestClientSize() const;
57
58 virtual wxString DoGetLabel() const { return m_label; }
59 virtual void DoSetLabel(const wxString& label);
60
61 void DoSetSize(int x, int y, int width, int height, int sizeFlags);
62
63#if wxUSE_MARKUP
64 virtual bool DoSetLabelMarkup(const wxString& markup);
65#endif // wxUSE_MARKUP
66
67private:
68 void Init()
69 {
70#if wxUSE_MARKUP
71 m_markupText = NULL;
72#endif // wxUSE_MARKUP
73 }
74
75 void OnPaint(wxPaintEvent& event);
76
77 void DoDrawLabel(wxDC& dc, const wxRect& rect);
78
79 // These fields are only used if m_markupText == NULL.
80 wxString m_label;
81 int m_mnemonic;
82
83#if wxUSE_MARKUP
84 class wxMarkupText *m_markupText;
85#endif // wxUSE_MARKUP
86
87 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText)
88};
89
90#endif // _WX_GENERIC_STATTEXTG_H_
91