xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Core/Statusline.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===-- Statusline.h -----------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_STATUSLINE_H
10 #define LLDB_CORE_STATUSLINE_H
11 
12 #include "lldb/lldb-forward.h"
13 #include <cstdint>
14 #include <string>
15 
16 namespace lldb_private {
17 class Statusline {
18 public:
19   Statusline(Debugger &debugger);
20   ~Statusline();
21 
22   /// Reduce the scroll window and draw the statusline.
23   void Enable();
24 
25   /// Hide the statusline and extend the scroll window.
26   void Disable();
27 
28   /// Redraw the statusline. If update is false, this will redraw the last
29   /// string.
30   void Redraw(bool update = true);
31 
32   /// Inform the statusline that the terminal dimensions have changed.
33   void TerminalSizeChanged();
34 
35 private:
36   /// Draw the statusline with the given text.
37   void Draw(std::string msg);
38 
39   enum ScrollWindowMode {
40     EnableStatusline,
41     DisableStatusline,
42     ResizeStatusline,
43   };
44 
45   /// Set the scroll window for the given mode.
46   void UpdateScrollWindow(ScrollWindowMode mode);
47 
48   Debugger &m_debugger;
49   std::string m_last_str;
50   uint64_t m_terminal_width = 0;
51   uint64_t m_terminal_height = 0;
52 };
53 } // namespace lldb_private
54 #endif // LLDB_CORE_STATUSLINE_H
55