summaryrefslogtreecommitdiff
path: root/src/ui/include/event_binding.hpp
blob: 19514db478361a9c5bf6f8f2632299aeefa448c0 (plain)
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
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <cstdint>

#include "lvgl.h"

#include "core/lv_event.h"
#include "core/lv_obj.h"
#include "nod/nod.hpp"

namespace ui {

class EventBinding {
 public:
  EventBinding(lv_obj_t* obj, lv_event_code_t ev);

  auto signal() -> nod::signal<void(lv_obj_t*)>& { return signal_; }

 private:
  lv_obj_t* obj_;
  nod::signal<void(lv_obj_t*)> signal_;
};

}  // namespace ui