Serenity Operating System
at master 60 lines 1.4 kB view raw
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 8#pragma once 9 10#include <LibGUI/AbstractTableView.h> 11 12namespace GUI { 13 14class TableView : public AbstractTableView { 15 C_OBJECT(TableView) 16public: 17 virtual ~TableView() override = default; 18 19 enum class GridStyle { 20 None, 21 Horizontal, 22 Vertical, 23 Both, 24 }; 25 26 enum class CursorStyle { 27 None, 28 Item, 29 Row, 30 }; 31 32 GridStyle grid_style() const { return m_grid_style; } 33 void set_grid_style(GridStyle); 34 35 void set_highlight_key_column(bool b) { m_highlight_key_column = b; } 36 bool is_key_column_highlighted() const { return m_highlight_key_column; } 37 38 virtual void move_cursor(CursorMovement, SelectionUpdate) override; 39 40protected: 41 TableView(); 42 43 virtual void keydown_event(KeyEvent&) override; 44 virtual void mousedown_event(MouseEvent&) override; 45 virtual void mouseup_event(MouseEvent&) override; 46 virtual void mousemove_event(MouseEvent&) override; 47 virtual void paint_event(PaintEvent&) override; 48 virtual void second_paint_event(PaintEvent&) override; 49 50private: 51 GridStyle m_grid_style { GridStyle::None }; 52 53 bool m_highlight_key_column { true }; 54 55 bool m_rubber_banding { false }; 56 int m_rubber_band_origin { 0 }; 57 int m_rubber_band_current { 0 }; 58}; 59 60}