56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
/*
|
|
nanogui/graph.h -- Simple graph widget for showing a function plot
|
|
|
|
NanoGUI was developed by Wenzel Jakob <wenzel@inf.ethz.ch>.
|
|
The widget drawing code is based on the NanoVG demo application
|
|
by Mikko Mononen.
|
|
|
|
All rights reserved. Use of this source code is governed by a
|
|
BSD-style license that can be found in the LICENSE.txt file.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <nanogui/widget.h>
|
|
|
|
NAMESPACE_BEGIN(nanogui)
|
|
|
|
class NANOGUI_EXPORT Graph : public Widget {
|
|
public:
|
|
Graph(Widget *parent, const std::string &caption = "Untitled");
|
|
|
|
const std::string &caption() const { return mCaption; }
|
|
void setCaption(const std::string &caption) { mCaption = caption; }
|
|
|
|
const std::string &header() const { return mHeader; }
|
|
void setHeader(const std::string &header) { mHeader = header; }
|
|
|
|
const std::string &footer() const { return mFooter; }
|
|
void setFooter(const std::string &footer) { mFooter = footer; }
|
|
|
|
const Color &backgroundColor() const { return mBackgroundColor; }
|
|
void setBackgroundColor(const Color &backgroundColor) { mBackgroundColor = backgroundColor; }
|
|
|
|
const Color &foregroundColor() const { return mForegroundColor; }
|
|
void setForegroundColor(const Color &foregroundColor) { mForegroundColor = foregroundColor; }
|
|
|
|
const Color &textColor() const { return mTextColor; }
|
|
void setTextColor(const Color &textColor) { mTextColor = textColor; }
|
|
|
|
const VectorXf &values() const { return mValues; }
|
|
VectorXf &values() { return mValues; }
|
|
void setValues(const VectorXf &values) { mValues = values; }
|
|
|
|
virtual Vector2i preferredSize(NVGcontext *ctx) const;
|
|
virtual void draw(NVGcontext *ctx);
|
|
|
|
virtual void save(Serializer &s) const;
|
|
virtual bool load(Serializer &s);
|
|
protected:
|
|
std::string mCaption, mHeader, mFooter;
|
|
Color mBackgroundColor, mForegroundColor, mTextColor;
|
|
VectorXf mValues;
|
|
};
|
|
|
|
NAMESPACE_END(nanogui)
|