File indexing completed on 2024-04-21 04:05:09

0001 /*
0002     SPDX-FileCopyrightText: 2008 Ian Wadham <iandw.au@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SCENELABEL_H
0008 #define SCENELABEL_H
0009 
0010 #include <QString>
0011 #include <QFont>
0012 
0013 class QOpenGLWidget;
0014 
0015 class SceneLabel
0016 {
0017 public:
0018     explicit SceneLabel (const QString & labelText);
0019 
0020     void     setVisible (const bool onOff);
0021     void     move (const int xPos, const int yPos);
0022     void     setText (const QString & labelText);
0023     void     drawLabel (QOpenGLWidget * view);
0024 
0025     int      width () const;
0026     int      height () const;
0027 
0028 private:
0029     bool     visible;   // Whether to paint the scene-label.
0030     int      x;     // x-position in the QOpenGLWidget window.
0031     int      y;     // y-position in the QOpenGLWidget window.
0032     QString  text;  // Text of the scene-label (translated).
0033     QFont    font;  // Font for the label.
0034     int      textWidth; // Width of the text in the given font.
0035     int      lineHeight;// Height of the font + space between lines.
0036 };
0037 
0038 #endif  // SCENELABEL_H