mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 13:54:09 +08:00
109 lines
3.5 KiB
C
109 lines
3.5 KiB
C
#ifndef _ANOD_TEXT_PAGE_
|
|
#define _ANOD_TEXT_PAGE_
|
|
|
|
#include <stdint.h>
|
|
|
|
#define INPUT(type) type
|
|
#define OUTPUT(type) type*
|
|
|
|
typedef uint32_t atp_counter_t;
|
|
typedef int32_t atp_itemval_t;
|
|
typedef const char* atp_text_t;
|
|
typedef uint8_t atp_boolean_t;
|
|
typedef uint8_t atp_pageopt_t;
|
|
typedef uint8_t atp_color_t;
|
|
typedef uint8_t atp_placement_t;
|
|
typedef uint8_t atp_error_t;
|
|
typedef void * atp_callerdata_t;
|
|
|
|
// error type
|
|
#define ATP_SUCCESS 0
|
|
#define ATP_POWER_OFF 1
|
|
#define ATP_INDEX_OUTOFRANGE 2
|
|
#define ATP_NO_ACTION 3
|
|
#define ATP_INVALID_VALUE 4
|
|
|
|
// color type SAME AS console
|
|
#define ATP_COLOR_LIGHT 0
|
|
#define ATP_COLOR_RED 1
|
|
#define ATP_COLOR_GREEN 2
|
|
#define ATP_COLOR_YELLOW 3
|
|
#define ATP_COLOR_BLUE 4
|
|
#define ATP_COLOR_MAGENTA 5
|
|
#define ATP_COLOR_CYAN 6
|
|
#define ATP_COLOR_WHITE 7
|
|
|
|
// text align
|
|
#define ATP_PLACEMENT_LEFT 0
|
|
#define ATP_PLACEMENT_RIGHT 1
|
|
#define ATP_PLACEMENT_CENTER 2
|
|
|
|
// page option
|
|
#define ATP_PAGE_NOOPTION 0
|
|
#define ATP_PAGE_UPDATE 1 // UPDATE THE CURSOR ROW
|
|
#define ATP_PAGE_REFRESH 2 // UPDATE THE WHOLE PAGE
|
|
|
|
typedef struct {
|
|
atp_text_t text;
|
|
atp_text_t extra_text;
|
|
atp_itemval_t value;
|
|
atp_color_t text_color;
|
|
atp_color_t extra_text_color;
|
|
} atp_itemcfg_t;
|
|
|
|
typedef struct {
|
|
atp_text_t text;
|
|
atp_color_t text_color;
|
|
atp_placement_t text_align;
|
|
} atp_linecfg_t;
|
|
|
|
typedef atp_error_t (*atp_lineprovider_t)(
|
|
INPUT(atp_callerdata_t) some_data_provided_by_caller,
|
|
INPUT(atp_counter_t) line_index_of_this_page,
|
|
|
|
OUTPUT(atp_linecfg_t) configuration_of_this_line
|
|
);
|
|
|
|
typedef atp_error_t (*atp_itemprovider_t)(
|
|
INPUT(atp_callerdata_t) some_data_provided_by_caller,
|
|
INPUT(atp_counter_t) index_of_current_option_item,
|
|
|
|
OUTPUT(atp_itemcfg_t) configuration_of_current_option_item
|
|
);
|
|
|
|
typedef atp_pageopt_t (*atp_keyhandler_t)(
|
|
INPUT(atp_callerdata_t) some_data_provided_by_caller,
|
|
INPUT(atp_boolean_t) is_x_key_down,
|
|
INPUT(atp_boolean_t) is_y_key_down,
|
|
INPUT(atp_boolean_t) is_l_key_down,
|
|
INPUT(atp_boolean_t) is_r_key_down,
|
|
INPUT(atp_boolean_t) is_start_key_down,
|
|
INPUT(atp_boolean_t) is_select_key_down
|
|
);
|
|
|
|
extern atp_error_t atp_show(
|
|
INPUT(atp_counter_t) line_count_of_this_page,
|
|
INPUT(atp_lineprovider_t) line_information_provider,
|
|
INPUT(atp_callerdata_t) some_data_from_caller
|
|
);
|
|
|
|
extern atp_error_t atp_select(
|
|
INPUT(atp_text_t) title_lessthan_9lines_for_this_select_page,
|
|
INPUT(atp_counter_t) item_count_exclude_title_of_this_select_page,
|
|
INPUT(atp_itemprovider_t) item_information_provider,
|
|
INPUT(atp_keyhandler_t) extra_key_handler,
|
|
INPUT(atp_callerdata_t) some_data_from_caller,
|
|
INPUT(atp_counter_t) index_of_default_selected_item,
|
|
INPUT(atp_boolean_t) ignore_no_action,
|
|
|
|
OUTPUT(atp_itemval_t) value_of_select_item
|
|
);
|
|
|
|
extern atp_error_t atp_tips(
|
|
INPUT(atp_text_t) tips
|
|
);
|
|
|
|
#undef INPUT
|
|
#undef OUTPUT
|
|
|
|
#endif//_ANOD_TEXT_PAGE_
|