2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2016-07-03 20:59:49 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GLPanel.h"
|
|
|
|
|
|
|
|
class MeterPanel : public GLPanel {
|
|
|
|
|
|
|
|
public:
|
2021-04-04 22:17:30 -04:00
|
|
|
MeterPanel(const std::string& name, float low, float high, float current);
|
|
|
|
~MeterPanel() override;
|
2016-07-06 23:16:25 -04:00
|
|
|
void setName(std::string name_in);
|
2016-07-07 22:37:57 -04:00
|
|
|
std::string getName();
|
2021-04-04 22:17:30 -04:00
|
|
|
void setRange(float low_in, float high_in);
|
|
|
|
float getLow() const;
|
|
|
|
float getHigh() const;
|
2016-07-06 23:16:25 -04:00
|
|
|
void setValue(float value);
|
|
|
|
void setHighlight(float value);
|
2016-07-07 22:37:57 -04:00
|
|
|
void setHighlightVisible(bool vis);
|
2021-04-04 22:17:30 -04:00
|
|
|
float getValue() const;
|
2016-07-06 23:16:25 -04:00
|
|
|
bool isMeterHit(CubicVR::vec2 mousePoint);
|
2017-05-29 14:08:45 -04:00
|
|
|
float getMeterHitValue(CubicVR::vec2 mousePoint);
|
2021-04-04 22:17:30 -04:00
|
|
|
void setChanged(bool changed_in);
|
|
|
|
bool getChanged() const;
|
2016-07-03 20:59:49 -04:00
|
|
|
|
|
|
|
protected:
|
2021-04-04 22:17:30 -04:00
|
|
|
void drawPanelContents() override;
|
2016-07-06 23:16:25 -04:00
|
|
|
void setValueLabel(std::string label);
|
2021-04-04 22:17:30 -04:00
|
|
|
void setPanelLevel(float setValue, GLPanel &panel) const;
|
2016-07-03 20:59:49 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string name;
|
|
|
|
float low, high, current;
|
2017-11-19 19:33:18 -05:00
|
|
|
bool changed = false;
|
2016-07-03 20:59:49 -04:00
|
|
|
GLPanel bgPanel;
|
|
|
|
GLPanel levelPanel;
|
|
|
|
GLPanel highlightPanel;
|
|
|
|
GLTextPanel labelPanel;
|
|
|
|
GLTextPanel valuePanel;
|
|
|
|
};
|