Power System Platform  2026w10a-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 wxString GetText() const { return m_text; }
62 virtual int GetWidth() const { return m_size.GetWidth(); }
63 virtual int GetHeight() const { return m_size.GetHeight(); }
64 virtual void SetFontSize(int fontSize) { m_fontSize = fontSize; }
65 virtual int GetFontSize() { return m_fontSize; }
66 //virtual void SetFontWeight(wxFontWeight fontWeight) { m_fontWeight = fontWeight; }
67 //virtual void SetFontStyle(wxFontStyle fontStyle) { m_fontStyle = fontStyle; }
68 //virtual void SetFontFamily(wxFontFamily fontFamily) { m_fontFamily = fontFamily; }
69 virtual void SetFont(wxFont font);
70 virtual wxFont GetFont() { return m_font; }
71 //virtual wxSize CalculateTextExtend();
72
73protected:
74
75 wxString m_text = _("Text");
76 int m_fontSize = 10;
77 //wxFontWeight m_fontWeight = wxFONTWEIGHT_NORMAL;
78 //wxFontStyle m_fontStyle = wxFONTSTYLE_NORMAL;
79 //wxFontFamily m_fontFamily = wxFONTFAMILY_DEFAULT;
80 wxFont m_font;
81 bool m_customFont = false;
82
83 wxSize m_size;
84};
85
86#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:161
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