blob: 4c68dc9bbda3456d8af6a17ce15bd7c8dcbefe68 [file] [log] [blame]
Adedeji Adebisi684ec912021-07-22 18:07:52 +00001// 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
23const int INVALID = -999; // Constant indicating invalid indices
24struct Rect
25{
26 int x, y, w, h; // X, Y, Width, Height
Patrick Williamsf5c0b9d2023-03-14 09:31:01 -050027 Rect(int _x, int _y, int _w, int _h) : x(_x), y(_y), w(_w), h(_h) {}
28 Rect() : x(0), y(0), w(1), h(1) {}
Adedeji Adebisi684ec912021-07-22 18:07:52 +000029};
30
31int DrawTextWithWidthLimit(WINDOW* win, std::string txt, int y, int x,
32 int width, const std::string& delimiters);
33std::string FloatToString(float value);
34template <typename T>
35void HistoryBarGraph(WINDOW* win, const Rect& rect, BarGraph<T>* bargraph);
Sui Chen8c5208f2023-04-21 14:10:05 -070036void DBusTopUpdateFooterView();