TableView.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibGUI/AbstractTableView.h>
  9. namespace GUI {
  10. class TableView : public AbstractTableView {
  11. C_OBJECT(TableView)
  12. public:
  13. virtual ~TableView() override = default;
  14. enum class GridStyle {
  15. None,
  16. Horizontal,
  17. Vertical,
  18. Both,
  19. };
  20. enum class CursorStyle {
  21. None,
  22. Item,
  23. Row,
  24. };
  25. GridStyle grid_style() const { return m_grid_style; }
  26. void set_grid_style(GridStyle);
  27. void set_highlight_key_column(bool b) { m_highlight_key_column = b; }
  28. bool is_key_column_highlighted() const { return m_highlight_key_column; }
  29. virtual void move_cursor(CursorMovement, SelectionUpdate) override;
  30. protected:
  31. TableView();
  32. virtual void keydown_event(KeyEvent&) override;
  33. virtual void paint_event(PaintEvent&) override;
  34. private:
  35. GridStyle m_grid_style { GridStyle::None };
  36. bool m_highlight_key_column { true };
  37. };
  38. }