Repository navigation
Expand file tree
/
Copy pathShellCheckPanel.h
More file actions
73 lines (62 loc) · 2.29 KB
/
Copy pathShellCheckPanel.h
File metadata and controls
73 lines (62 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef SHELLCHECK_PANEL_H
#define SHELLCHECK_PANEL_H
#include "JsonLite.h"
#include <windows.h>
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
struct PanelCallbacks {
std::function<void()> onRunRequested;
std::function<void(bool)> onLiveToggled;
std::function<void(bool)> onInlineToggled;
std::function<void(const std::wstring&)> onDialectChanged;
std::function<void(int line, int column)> onIssueActivated;
std::function<void(const std::vector<ShellCheckIssue>&)> onIssuesUpdated;
std::function<bool(uint64_t)> isCurrentGeneration;
};
class ShellCheckPanel {
public:
ShellCheckPanel();
~ShellCheckPanel();
void create(HINSTANCE hInst, HWND nppHandle, int dlgMenuCmdId, const PanelCallbacks& callbacks);
void show(bool visible);
bool isVisible() const;
HWND hwnd() const { return hwnd_; }
void setLiveChecked(bool checked);
void setInlineChecked(bool checked);
void setDialect(const std::wstring& dialect);
std::wstring selectedDialect() const;
void setStatus(const std::wstring& statusText);
void setIssues(const std::vector<ShellCheckIssue>& issues);
void clearIssues(const std::wstring& statusText);
void applyDarkMode(bool isDark, COLORREF bgColor, COLORREF textColor, COLORREF ctrlBgColor);
private:
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR handleMessage(UINT msg, WPARAM wParam, LPARAM lParam);
void initControls();
void layoutControls(int width, int height);
void rebuildFilteredList();
void updateDetailBox();
void activateSelectedIssue();
void showContextMenu(POINT screenPt);
void copySelectedMessage();
void openSelectedWiki();
HINSTANCE hInst_ = nullptr;
HWND nppHandle_ = nullptr;
HWND hwnd_ = nullptr;
HWND listHwnd_ = nullptr;
int dlgId_ = 0;
bool isRegistered_ = false;
bool isVisible_ = false;
bool isDark_ = false;
COLORREF bgColor_ = RGB(240, 240, 240);
COLORREF ctrlBgColor_ = RGB(255, 255, 255);
COLORREF textColor_ = RGB(30, 30, 30);
HBRUSH bgBrush_ = nullptr;
HBRUSH ctrlBgBrush_ = nullptr;
PanelCallbacks callbacks_;
std::vector<ShellCheckIssue> allIssues_;
std::vector<ShellCheckIssue> filteredIssues_;
};
#endif // SHELLCHECK_PANEL_H