Adedeji Adebisi | 12c5f11 | 2021-07-22 18:07:52 +0000 | [diff] [blame^] | 1 | // Copyright 2021 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | #include "bargraph.hpp" |
| 18 | |
| 19 | #include <ncurses.h> |
| 20 | |
| 21 | #include <string> |
| 22 | |
| 23 | const int INVALID = -999; // Constant indicating invalid indices |
| 24 | struct Rect |
| 25 | { |
| 26 | int x, y, w, h; // X, Y, Width, Height |
| 27 | Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h) |
| 28 | {} |
| 29 | Rect() : x(0), y(0), w(1), h(1) |
| 30 | {} |
| 31 | }; |
| 32 | |
| 33 | int DrawTextWithWidthLimit(WINDOW* win, std::string txt, int y, int x, |
| 34 | int width, const std::string& delimiters); |
| 35 | std::string FloatToString(float value); |
| 36 | template <typename T> |
| 37 | void HistoryBarGraph(WINDOW* win, const Rect& rect, BarGraph<T>* bargraph); |