| 1 |
#ifndef DAPVARIABLELISTCTRL_HPP |
| 2 |
#define DAPVARIABLELISTCTRL_HPP |
| 3 |
|
| 4 |
#include "clThemedTreeCtrl.h" |
| 5 |
#include "dap/Client.hpp" |
| 6 |
|
| 7 |
#include <unordered_map> |
| 8 |
#include <vector> |
| 9 |
|
| 10 |
struct DAPVariableListCtrlItemData : public wxTreeItemData { |
| 11 |
int refId = wxNOT_FOUND; |
| 12 |
wxString value; |
| 13 |
DAPVariableListCtrlItemData(int id, const wxString& v) |
| 14 |
: refId(id) |
| 15 |
, value(v) |
| 16 |
{ |
| 17 |
} |
| 18 |
virtual ~DAPVariableListCtrlItemData() {} |
| 19 |
}; |
| 20 |
|
| 21 |
class DAPVariableListCtrl : public clThemedTreeCtrl |
| 22 |
{ |
| 23 |
protected: |
| 24 |
std::unordered_map<int, wxTreeItemId> m_pending_items; |
| 25 |
dap::Client* m_client = nullptr; |
| 26 |
dap::EvaluateContext m_dapContext = dap::EvaluateContext::HOVER; |
| 27 |
|
| 28 |
protected: |
| 29 |
void OnItemExpanding(wxTreeEvent& event); |
| 30 |
void OnMenu(wxTreeEvent& event); |
| 31 |
DAPVariableListCtrlItemData* GetItemData(const wxTreeItemId& item); |
| 32 |
|
| 33 |
public: |
| 34 |
DAPVariableListCtrl(wxWindow* parent, dap::Client* client, dap::EvaluateContext dapContext, |
| 35 |
wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, |
| 36 |
const wxSize& size = wxDefaultSize); |
| 37 |
virtual ~DAPVariableListCtrl(); |
| 38 |
/** |
| 39 |
* @brief add a watch to the list of watches |
| 40 |
*/ |
| 41 |
void AddWatch(const wxString& expression, const wxString& value, const wxString& type, int varRef); |
| 42 |
/** |
| 43 |
* @brief update the ui with the children of `varId` |
| 44 |
* @param varId |
| 45 |
* @param response |
| 46 |
*/ |
| 47 |
void UpdateChildren(int varId, dap::VariablesResponse* response); |
| 48 |
}; |
| 49 |
|
| 50 |
#endif // DAPVARIABLELISTCTRL_HPP |