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