mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibGUI: Remove some unused cruft from GUI::IconView
This commit is contained in:
parent
89a9d8f45c
commit
8ebb9d350c
2 changed files with 5 additions and 12 deletions
|
@ -4,10 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibGUI/DragOperation.h>
|
|
||||||
#include <LibGUI/IconView.h>
|
#include <LibGUI/IconView.h>
|
||||||
#include <LibGUI/Model.h>
|
#include <LibGUI/Model.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
|
@ -60,7 +58,7 @@ void IconView::resize_event(ResizeEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconView::reinit_item_cache() const
|
void IconView::rebuild_item_cache() const
|
||||||
{
|
{
|
||||||
auto prev_item_count = m_item_data_cache.size();
|
auto prev_item_count = m_item_data_cache.size();
|
||||||
size_t new_item_count = item_count();
|
size_t new_item_count = item_count();
|
||||||
|
@ -94,7 +92,7 @@ void IconView::reinit_item_cache() const
|
||||||
auto IconView::get_item_data(int item_index) const -> ItemData&
|
auto IconView::get_item_data(int item_index) const -> ItemData&
|
||||||
{
|
{
|
||||||
if (!m_item_data_cache_valid)
|
if (!m_item_data_cache_valid)
|
||||||
reinit_item_cache();
|
rebuild_item_cache();
|
||||||
|
|
||||||
auto& item_data = m_item_data_cache[item_index];
|
auto& item_data = m_item_data_cache[item_index];
|
||||||
if (item_data.is_valid())
|
if (item_data.is_valid())
|
||||||
|
@ -164,7 +162,7 @@ void IconView::update_content_size()
|
||||||
set_content_size({ content_width, content_height });
|
set_content_size({ content_width, content_height });
|
||||||
|
|
||||||
if (!m_item_data_cache_valid)
|
if (!m_item_data_cache_valid)
|
||||||
reinit_item_cache();
|
rebuild_item_cache();
|
||||||
|
|
||||||
for (int item_index = 0; item_index < item_count(); item_index++) {
|
for (int item_index = 0; item_index < item_count(); item_index++) {
|
||||||
auto& item_data = m_item_data_cache[item_index];
|
auto& item_data = m_item_data_cache[item_index];
|
||||||
|
@ -221,11 +219,8 @@ void IconView::mousedown_event(MouseEvent& event)
|
||||||
return AbstractView::mousedown_event(event);
|
return AbstractView::mousedown_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.modifiers() & Mod_Ctrl) {
|
if (!(event.modifiers() & Mod_Ctrl)) {
|
||||||
m_rubber_banding_store_selection = true;
|
|
||||||
} else {
|
|
||||||
clear_selection();
|
clear_selection();
|
||||||
m_rubber_banding_store_selection = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto adjusted_position = to_content_position(event.position());
|
auto adjusted_position = to_content_position(event.position());
|
||||||
|
|
|
@ -26,7 +26,6 @@ public:
|
||||||
FlowDirection flow_direction() const { return m_flow_direction; }
|
FlowDirection flow_direction() const { return m_flow_direction; }
|
||||||
void set_flow_direction(FlowDirection);
|
void set_flow_direction(FlowDirection);
|
||||||
|
|
||||||
int content_width() const;
|
|
||||||
int horizontal_padding() const { return m_horizontal_padding; }
|
int horizontal_padding() const { return m_horizontal_padding; }
|
||||||
|
|
||||||
virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
||||||
|
@ -117,7 +116,7 @@ private:
|
||||||
void scroll_out_of_view_timer_fired();
|
void scroll_out_of_view_timer_fired();
|
||||||
int items_per_page() const;
|
int items_per_page() const;
|
||||||
|
|
||||||
void reinit_item_cache() const;
|
void rebuild_item_cache() const;
|
||||||
int model_index_to_item_index(const ModelIndex& model_index) const
|
int model_index_to_item_index(const ModelIndex& model_index) const
|
||||||
{
|
{
|
||||||
VERIFY(model_index.row() < item_count());
|
VERIFY(model_index.row() < item_count());
|
||||||
|
@ -148,7 +147,6 @@ private:
|
||||||
bool m_always_wrap_item_labels { false };
|
bool m_always_wrap_item_labels { false };
|
||||||
|
|
||||||
bool m_rubber_banding { false };
|
bool m_rubber_banding { false };
|
||||||
bool m_rubber_banding_store_selection { false };
|
|
||||||
RefPtr<Core::Timer> m_out_of_view_timer;
|
RefPtr<Core::Timer> m_out_of_view_timer;
|
||||||
Gfx::IntPoint m_out_of_view_position;
|
Gfx::IntPoint m_out_of_view_position;
|
||||||
Gfx::IntPoint m_rubber_band_origin;
|
Gfx::IntPoint m_rubber_band_origin;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue