This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathview_common.h
97 lines (78 loc) · 3.11 KB
/
view_common.h
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*******************************************************************************
* (c) 2016 Ledger
* (c) 2018, 2019 ZondaX GmbH
* (c) 2019 All BNB Chain Developers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#pragma once
#include "os.h"
#include "cx.h"
#define MAX_CHARS_TITLE 32
#define MAX_CHARS_PER_KEY_LINE 64
#define MAX_CHARS_PER_VALUE_LINE 130
#define MAX_SCREEN_LINE_WIDTH 22
extern volatile char viewctl_DataKey[MAX_CHARS_PER_KEY_LINE];
extern volatile char viewctl_DataValue[MAX_CHARS_PER_VALUE_LINE];
extern volatile char viewctl_Title[MAX_SCREEN_LINE_WIDTH];
extern enum UI_DISPLAY_MODE viewctl_scrolling_mode;
enum UI_DISPLAY_MODE {
VALUE_SCROLLING,
KEY_SCROLLING_NO_VALUE,
KEY_SCROLLING_SHORT_VALUE,
PENDING
};
// Index of the currently displayed page
extern int viewctl_DetailsCurrentPage;
// Total number of displayable pages
extern int viewctl_DetailsPageCount;
// Below data is used to help split long messages that are scrolled
// into smaller chunks so they fit the memory buffer
// Index of currently displayed value chunk
extern int viewctl_ChunksIndex;
// Total number of displayable value chunks
extern int viewctl_ChunksCount;
// Delegate to update contents
typedef int (*viewctl_delegate_getData)(
char *title, int max_title_length,
char *key, int max_key_length,
char *value, int max_value_length,
int page_index,
int chunk_index,
int *page_count_out,
int *chunk_count_out);
// Delegate to handle exit view event
typedef void (*viewctl_delegate_exit)(unsigned int ignored);
// Delegate to handle exit view event
typedef void (*viewctl_delegate_ready)(unsigned int ignored);
// Delegate to handle exit view event
typedef void (*viewctl_delegate_display_ux)(int page, int count);
// Delegate to handle an accept event
typedef void (*viewctl_delegate_accept)();
// Delegate to handle a reject event
typedef void (*viewctl_delegate_reject)();
extern viewctl_delegate_getData viewctl_ehGetData;
extern viewctl_delegate_ready viewctl_ehReady;
extern viewctl_delegate_exit viewctl_ehExit;
extern viewctl_delegate_display_ux viewctl_display_ux;
void viewctl_start(int start_page,
bool single_page,
viewctl_delegate_getData ehUpdate,
viewctl_delegate_ready ehReady,
viewctl_delegate_exit ehExit,
viewctl_delegate_display_ux func_display_ux);
void viewctl_display_page();
void submenu_left();
void submenu_right();
void menu_left();
void menu_right();