2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2022-02-26 10:50:04 -07:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-02-28 10:57:09 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-06 20:33:02 +01:00
|
|
|
#include <LibGUI/AbstractTableView.h>
|
2019-02-28 10:57:09 +01:00
|
|
|
|
2020-02-02 15:07:41 +01:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
|
|
class TableView : public AbstractTableView {
|
|
|
|
|
C_OBJECT(TableView)
|
2019-02-28 10:57:09 +01:00
|
|
|
public:
|
2022-02-26 10:50:04 -07:00
|
|
|
virtual ~TableView() override = default;
|
2019-02-28 10:57:09 +01:00
|
|
|
|
2020-08-28 16:52:06 +02:00
|
|
|
enum class GridStyle {
|
|
|
|
|
None,
|
|
|
|
|
Horizontal,
|
|
|
|
|
Vertical,
|
|
|
|
|
Both,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class CursorStyle {
|
|
|
|
|
None,
|
|
|
|
|
Item,
|
2020-10-27 16:18:35 +01:00
|
|
|
Row,
|
2020-08-28 16:52:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GridStyle grid_style() const { return m_grid_style; }
|
|
|
|
|
void set_grid_style(GridStyle);
|
|
|
|
|
|
2021-03-11 10:35:40 -05:00
|
|
|
void set_highlight_key_column(bool b) { m_highlight_key_column = b; }
|
|
|
|
|
bool is_key_column_highlighted() const { return m_highlight_key_column; }
|
|
|
|
|
|
2020-08-28 21:02:46 +02:00
|
|
|
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
|
|
|
|
|
2019-09-21 16:03:59 +02:00
|
|
|
protected:
|
2020-02-23 12:07:13 +01:00
|
|
|
TableView();
|
2019-09-21 16:03:59 +02:00
|
|
|
|
2020-05-21 13:40:52 +02:00
|
|
|
virtual void keydown_event(KeyEvent&) override;
|
2020-02-02 15:07:41 +01:00
|
|
|
virtual void paint_event(PaintEvent&) override;
|
2020-08-28 16:52:06 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
GridStyle m_grid_style { GridStyle::None };
|
2021-03-11 10:35:40 -05:00
|
|
|
|
|
|
|
|
bool m_highlight_key_column { true };
|
2019-02-28 10:57:09 +01:00
|
|
|
};
|
2020-02-02 15:07:41 +01:00
|
|
|
|
|
|
|
|
}
|