1 // Copyright (c) Charles J. Cliffe 2 // SPDX-License-Identifier: GPL-2.0+ 3 4 #pragma once 5 6 #include "GLPanel.h" 7 8 class MeterPanel : public GLPanel { 9 10 public: 11 MeterPanel(const std::string& name, float low, float high, float current); 12 ~MeterPanel() override; 13 void setName(std::string name_in); 14 std::string getName(); 15 void setRange(float low_in, float high_in); 16 float getLow() const; 17 float getHigh() const; 18 void setValue(float value); 19 void setHighlight(float value); 20 void setHighlightVisible(bool vis); 21 float getValue() const; 22 bool isMeterHit(CubicVR::vec2 mousePoint); 23 float getMeterHitValue(CubicVR::vec2 mousePoint); 24 void setChanged(bool changed_in); 25 bool getChanged() const; 26 27 protected: 28 void drawPanelContents() override; 29 void setValueLabel(std::string label); 30 void setPanelLevel(float setValue, GLPanel &panel) const; 31 32 private: 33 std::string name; 34 float low, high, current; 35 bool changed = false; 36 GLPanel bgPanel; 37 GLPanel levelPanel; 38 GLPanel highlightPanel; 39 GLTextPanel labelPanel; 40 GLTextPanel valuePanel; 41 };