Debian Codegraph @

src/Gui/SoTextLabel.h

raw
1 /***************************************************************************
2 * Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #ifndef GUI_SOTEXTLABEL_H
24 #define GUI_SOTEXTLABEL_H
25
26 #include <Inventor/fields/SoSFBool.h>
27 #include <Inventor/fields/SoSFColor.h>
28 #include <Inventor/fields/SoSFEnum.h>
29 #include <Inventor/fields/SoSFFloat.h>
30 #include <Inventor/fields/SoSFInt32.h>
31 #include <Inventor/fields/SoSFName.h>
32 #include <Inventor/manips/SoTransformManip.h>
33 #include <Inventor/nodes/SoImage.h>
34 #include <Inventor/nodes/SoText2.h>
35 #include <FCGlobal.h>
36
37 #include "BitmapFactory.h"
38
39
40 namespace Gui
41 {
42
43 /**
44 * A text label with a background color.
45 * @author Werner Mayer
46 */
47 class GuiExport SoTextLabel: public SoText2
48 {
49 using inherited = SoText2;
50
51 SO_NODE_HEADER(SoTextLabel);
52
53 public:
54 static void initClass();
55 SoTextLabel();
56
57 SoSFColor backgroundColor;
58 SoSFBool background;
59 SoSFFloat frameSize;
60
61 protected:
62 ~SoTextLabel() override = default;
63 void GLRender(SoGLRenderAction* action) override;
64 };
65
66 /**
67 * A text label for the color bar.
68 * @author Werner Mayer
69 */
70 class GuiExport SoColorBarLabel: public SoText2
71 {
72 using inherited = SoText2;
73
74 SO_NODE_HEADER(SoColorBarLabel);
75
76 public:
77 static void initClass();
78 SoColorBarLabel();
79
80 protected:
81 void computeBBox(SoAction* action, SbBox3f& box, SbVec3f& center) override;
82 };
83
84 class GuiExport SoStringLabel: public SoNode
85 {
86 using inherited = SoNode;
87
88 SO_NODE_HEADER(SoStringLabel);
89
90 public:
91 static void initClass();
92 SoStringLabel();
93
94 SoMFString string;
95 SoSFColor textColor;
96 SoSFName name;
97 SoSFInt32 size;
98
99 protected:
100 ~SoStringLabel() override = default;
101 void GLRender(SoGLRenderAction* action) override;
102 };
103
104 class GuiExport SoFrameLabel: public SoImage
105 {
106 using inherited = SoImage;
107
108 SO_NODE_HEADER(SoFrameLabel);
109
110 public:
111 enum Justification
112 {
113 LEFT,
114 RIGHT,
115 CENTER
116 };
117
118 static void initClass();
119 SoFrameLabel();
120 void setIcon(const QPixmap& pixMap);
121
122 SoMFString string;
123 SoSFColor textColor;
124 SoSFColor backgroundColor;
125 SoSFEnum justification;
126 SoSFName name;
127 SoSFInt32 size;
128 SoSFBool frame;
129 SoSFBool border;
130 SoSFBool backgroundUseBaseColor;
131 SoSFBool textUseBaseColor;
132 // SoSFImage image;
133 QPixmap iconPixmap;
134
135 protected:
136 ~SoFrameLabel() override = default;
137 void notify(SoNotList* list) override;
138 void GLRender(SoGLRenderAction* action) override;
139
140 private:
141 void drawImage();
142 };
143
144 class GuiExport TranslateManip: public SoTransformManip
145 {
146 SO_NODE_HEADER(TranslateManip);
147
148 public:
149 // Constructor
150 TranslateManip();
151 static void initClass();
152
153 private:
154 // Destructor
155 ~TranslateManip() override;
156 };
157
158 } // namespace Gui
159
160 #endif // GUI_SOTEXTLABEL_H