File: hex-edit.hpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (35 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (2)
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
#if defined(Hiro_HexEdit)
struct mHexEdit : mWidget {
  Declare(HexEdit)

  auto address() const -> u32;
  auto backgroundColor() const -> Color;
  auto columns() const -> u32;
  auto doRead(u32 offset) const -> u8;
  auto doWrite(u32 offset, u8 data) const -> void;
  auto foregroundColor() const -> Color;
  auto length() const -> u32;
  auto onRead(const function<u8 (u32)>& callback = {}) -> type&;
  auto onWrite(const function<void (u32, u8)>& callback = {}) -> type&;
  auto rows() const -> u32;
  auto setAddress(u32 address = 0) -> type&;
  auto setBackgroundColor(Color color = {}) -> type&;
  auto setColumns(u32 columns = 16) -> type&;
  auto setForegroundColor(Color color = {}) -> type&;
  auto setLength(u32 length) -> type&;
  auto setRows(u32 rows = 16) -> type&;
  auto update() -> type&;

//private:
  struct State {
    u32 address = 0;
    Color backgroundColor;
    u32 columns = 16;
    Color foregroundColor;
    u32 length = 0;
    function<u8 (u32)> onRead;
    function<void (u32, u8)> onWrite;
    u32 rows = 16;
  } state;
};
#endif