mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 09:07:44 +00:00
LibGUI: Register many properties of AbstractView
This commit is contained in:
parent
68a758304a
commit
fc6ffbc006
2 changed files with 19 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
|
#include <LibCore/Object.h>
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibGUI/AbstractView.h>
|
#include <LibGUI/AbstractView.h>
|
||||||
#include <LibGUI/DragOperation.h>
|
#include <LibGUI/DragOperation.h>
|
||||||
|
@ -24,6 +25,21 @@ AbstractView::AbstractView()
|
||||||
, m_selection(*this)
|
, m_selection(*this)
|
||||||
{
|
{
|
||||||
REGISTER_BOOL_PROPERTY("activates_on_selection", activates_on_selection, set_activates_on_selection);
|
REGISTER_BOOL_PROPERTY("activates_on_selection", activates_on_selection, set_activates_on_selection);
|
||||||
|
REGISTER_BOOL_PROPERTY("editable", is_editable, set_editable);
|
||||||
|
REGISTER_BOOL_PROPERTY("searchable", is_searchable, set_searchable);
|
||||||
|
REGISTER_ENUM_PROPERTY("selection_behavior", selection_behavior, set_selection_behavior, SelectionBehavior,
|
||||||
|
{ SelectionBehavior::SelectItems, "SelectItems" },
|
||||||
|
{ SelectionBehavior::SelectRows, "SelectRows" });
|
||||||
|
REGISTER_ENUM_PROPERTY("selection_mode", selection_mode, set_selection_mode, SelectionMode,
|
||||||
|
{ SelectionMode::SingleSelection, "SingleSelection" },
|
||||||
|
{ SelectionMode::MultiSelection, "MultiSeleciton" },
|
||||||
|
{ SelectionMode::NoSelection, "NoSelection" });
|
||||||
|
REGISTER_INT_PROPERTY("key_column", key_column, set_key_column);
|
||||||
|
REGISTER_ENUM_PROPERTY("sort_order", sort_order, set_sort_order, SortOrder,
|
||||||
|
{ SortOrder::Ascending, "Ascending" },
|
||||||
|
{ SortOrder::Descending, "Descending" });
|
||||||
|
REGISTER_BOOL_PROPERTY("tab_key_navigation_enabled", is_tab_key_navigation_enabled, set_tab_key_navigation_enabled);
|
||||||
|
REGISTER_BOOL_PROPERTY("draw_item_text_with_shadow", does_draw_item_text_with_shadow, set_draw_item_text_with_shadow);
|
||||||
|
|
||||||
set_focus_policy(GUI::FocusPolicy::StrongFocus);
|
set_focus_policy(GUI::FocusPolicy::StrongFocus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,9 @@ public:
|
||||||
void set_key_column_and_sort_order(int column, SortOrder);
|
void set_key_column_and_sort_order(int column, SortOrder);
|
||||||
|
|
||||||
int key_column() const { return m_key_column; }
|
int key_column() const { return m_key_column; }
|
||||||
|
void set_key_column(int column) { set_key_column_and_sort_order(column, sort_order()); }
|
||||||
SortOrder sort_order() const { return m_sort_order; }
|
SortOrder sort_order() const { return m_sort_order; }
|
||||||
|
void set_sort_order(SortOrder order) { set_key_column_and_sort_order(key_column(), order); }
|
||||||
|
|
||||||
virtual void scroll_into_view(ModelIndex const&, [[maybe_unused]] bool scroll_horizontally = true, [[maybe_unused]] bool scroll_vertically = true) { }
|
virtual void scroll_into_view(ModelIndex const&, [[maybe_unused]] bool scroll_horizontally = true, [[maybe_unused]] bool scroll_vertically = true) { }
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ public:
|
||||||
void set_tab_key_navigation_enabled(bool enabled) { m_tab_key_navigation_enabled = enabled; }
|
void set_tab_key_navigation_enabled(bool enabled) { m_tab_key_navigation_enabled = enabled; }
|
||||||
|
|
||||||
void set_draw_item_text_with_shadow(bool b) { m_draw_item_text_with_shadow = b; }
|
void set_draw_item_text_with_shadow(bool b) { m_draw_item_text_with_shadow = b; }
|
||||||
|
bool does_draw_item_text_with_shadow() const { return m_draw_item_text_with_shadow; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractView();
|
AbstractView();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue