Power System Platform  2026w23a-beta
Loading...
Searching...
No Matches
GCText.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef GCTEXT_H
19#define GCTEXT_H
20
21#include <wx/graphics.h>
22#include <wx/intl.h>
23
31class GCText
32{
33public:
34 GCText();
35 GCText(wxString text);
36 virtual ~GCText();
45 virtual void Draw(wxPoint2DDouble position, wxGraphicsContext* gc, double angle = 0.0, wxColour colour = *wxBLACK) const;
46
47 virtual void Draw(wxPoint2DDouble position, double width, double height, wxDC& dc, double angle = 0.0, wxColour colour = *wxBLACK) const;
53 virtual GCText* GetCopy();
54
60 virtual void SetText(wxString text);
61 virtual void SetText(wxString text, wxSize size);
62 virtual wxString GetText() const { return m_text; }
63 virtual int GetWidth() const { return m_size.GetWidth(); }
64 virtual int GetHeight() const { return m_size.GetHeight(); }
65 virtual void SetFontSize(int fontSize) { m_fontSize = fontSize; }
66 virtual int GetFontSize() { return m_fontSize; }
67 virtual void SetFont(wxFont font);
68 virtual wxFont GetFont() { return m_font; }
69 //virtual wxSize CalculateTextExtend();
70
71protected:
72
73 wxString m_text = _("Text");
74 int m_fontSize = 10;
75 wxFont m_font;
76 bool m_customFont = false;
77
78 wxSize m_size;
79};
80
81#endif // GCTEXT_H
Class to draw text on Graphics Context using wxWidgets.
Definition GCText.h:32
virtual GCText * GetCopy()
Get a deep text copy.
Definition GCText.cpp:99
virtual void Draw(wxPoint2DDouble position, wxGraphicsContext *gc, double angle=0.0, wxColour colour= *wxBLACK) const
Draw the text in wxGraphicsContext.
Definition GCText.cpp:35
virtual void SetText(wxString text)
Set correctly a new text string.
Definition GCText.cpp:68