1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 20:15:00 +00:00
serenity/Userland/DevTools/HackStudio/Git/GitFilesView.h
Lenny Maiorani 68f76b9e37 Userland: Change typedef to using directive
Problem:
- `typedef`s are read backwards making it confusing.
- `using` statements can be used in template aliases.
- `using` provides similarity to most other C++ syntax.

- C++ core guidelines say to prefer `using` over `typedef`:
  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using

Solution:
- Switch these where appropriate.
2021-05-21 10:07:22 +01:00

36 lines
920 B
C++

/*
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/LexicalPath.h>
#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(const LexicalPath& file)>;
class GitFilesView : public GUI::ListView {
C_OBJECT(GitFilesView)
public:
virtual ~GitFilesView() override;
protected:
GitFilesView(GitFileActionCallback, NonnullRefPtr<Gfx::Bitmap> action_icon);
private:
virtual void paint_list_item(GUI::Painter& painter, int row_index, int painted_item_index);
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;
};
}