| 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 | /// Update terminal dimensions. |
| 40 | void UpdateTerminalProperties(); |
| 41 | |
| 42 | enum ScrollWindowMode { |
| 43 | EnableStatusline, |
| 44 | DisableStatusline, |
| 45 | }; |
| 46 | |
| 47 | /// Set the scroll window for the given mode. |
| 48 | void UpdateScrollWindow(ScrollWindowMode mode); |
| 49 | |
| 50 | Debugger &m_debugger; |
| 51 | std::string m_last_str; |
| 52 | uint64_t m_terminal_width = 0; |
| 53 | uint64_t m_terminal_height = 0; |
| 54 | }; |
| 55 | } // namespace lldb_private |
| 56 | #endif // LLDB_CORE_STATUSLINE_H |
| 57 | |