ladybird/Userland/DevTools/HackStudio/Git/GitFilesView.h
Lenny Maiorani 7070713ec8 DevTools: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-16 07:33:15 -05:00

36 lines
956 B
C++

/*
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/ListView.h>
#include <LibGfx/Bitmap.h>
namespace HackStudio {
// A "GitFileAction" is either the staging or the unstaging of a file.
using GitFileActionCallback = Function<void(String const& file)>;
class GitFilesView : public GUI::ListView {
C_OBJECT(GitFilesView)
public:
virtual ~GitFilesView() override = default;
protected:
GitFilesView(GitFileActionCallback, NonnullRefPtr<Gfx::Bitmap> action_icon);
private:
virtual void paint_list_item(GUI::Painter& painter, int row_index, int painted_item_index) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual Gfx::IntRect action_icon_rect(size_t painted_item_index);
GitFileActionCallback m_action_callback;
NonnullRefPtr<Gfx::Bitmap> m_action_icon;
};
}