mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-06 22:04:10 +08:00
更换一版atp的函数签名,以后应该不用改了
This commit is contained in:
parent
59717d49fd
commit
906e12b207
@ -41,13 +41,30 @@ typedef void * atp_callerdata_t;
|
||||
#define ATP_PAGE_UPDATE 1 // UPDATE THE CURSOR ROW
|
||||
#define ATP_PAGE_REFRESH 2 // UPDATE THE WHOLE PAGE
|
||||
|
||||
typedef atp_error_t (*atp_lineinfo_t)(
|
||||
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_text_t) line_text_of_this_line,
|
||||
OUTPUT(atp_itemval_t) option_value_of_this_item,
|
||||
OUTPUT(atp_color_t) value_of_atp_color,
|
||||
OUTPUT(atp_placement_t) value_of_atp_placement
|
||||
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)(
|
||||
@ -60,14 +77,14 @@ typedef atp_pageopt_t (*atp_keyhandler_t)(
|
||||
|
||||
extern atp_error_t atp_show(
|
||||
INPUT(atp_counter_t) line_count_of_this_page,
|
||||
INPUT(atp_lineinfo_t) line_information_provider,
|
||||
INPUT(atp_lineprovider_t) line_information_provider,
|
||||
INPUT(atp_callerdata_t) some_data_from_caller
|
||||
);
|
||||
|
||||
extern atp_itemval_t atp_select(
|
||||
INPUT(atp_text_t) tips_for_this_select_page,
|
||||
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_lineinfo_t) item_information_provider,
|
||||
INPUT(atp_itemprovider_t) item_information_provider,
|
||||
INPUT(atp_keyhandler_t) extra_key_handler,
|
||||
INPUT(atp_callerdata_t) some_data_from_caller
|
||||
);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "arm11/drivers/hid.h"
|
||||
#include "drivers/gfx.h"
|
||||
|
||||
#define TITLE_MAX 8
|
||||
#define TIPS_MAX 64
|
||||
static char ta[TIPS_MAX] = {'\0'};
|
||||
static char tb[TIPS_MAX] = {'\0'};
|
||||
@ -82,12 +83,12 @@ static uint32_t waitKey()
|
||||
return down;
|
||||
}
|
||||
|
||||
static void paint_one_line( atp_lineinfo_t provider, acf_callerdata_t data, int idx, int row )
|
||||
static void paint_one_line( atp_lineprovider_t provider, acf_callerdata_t data, int idx, int row )
|
||||
{
|
||||
atp_text_t text;
|
||||
atp_color_t color = ATP_COLOR_WHITE;
|
||||
atp_placement_t align = ATP_PLACEMENT_LEFT;
|
||||
atp_error_t err = provider( data, idx, &text, NULL, &color, &align );
|
||||
atp_linecfg_t config;
|
||||
config.color = ATP_COLOR_WHITE;
|
||||
config.text_align = ATP_PLACEMENT_LEFT;
|
||||
atp_error_t err = provider( data, idx, &config );
|
||||
if( !err )
|
||||
{
|
||||
acf_put_text(
|
||||
@ -96,14 +97,14 @@ static void paint_one_line( atp_lineinfo_t provider, acf_callerdata_t data, int
|
||||
WINDOW_WIDTH,
|
||||
WINDOW_HEIGHT,
|
||||
CONTAINER_RECT_WIDTH,
|
||||
color > ATP_COLOR_WHITE ? ATP_COLOR_WHITE : color,
|
||||
align,
|
||||
text
|
||||
config.color > ATP_COLOR_WHITE ? ATP_COLOR_WHITE : config.color,
|
||||
config.text_align,
|
||||
config.text
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp_counter_t nlines, int top )
|
||||
static void container_paint( atp_lineprovider_t provider, atp_callerdata_t data, atp_counter_t nlines, int top )
|
||||
{
|
||||
int end = top + CONTAINER_MAX_LINES;
|
||||
if( end > (int)nlines ) end = nlines;
|
||||
@ -113,7 +114,7 @@ static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp
|
||||
}
|
||||
}
|
||||
|
||||
atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata_t data )
|
||||
atp_error_t atp_show( atp_counter_t cnt, atp_lineprovider_t provider, atp_callerdata_t data )
|
||||
{
|
||||
int idx_top = 0;
|
||||
screen_clean();
|
||||
@ -151,6 +152,13 @@ atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata
|
||||
}
|
||||
}
|
||||
|
||||
atp_itemval_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t provider, atp_keyhandler_t handler, atp_callerdata_t data )
|
||||
{
|
||||
uint8_t title_offset[TITLE_MAX];
|
||||
int idx_top = 0, title_len = 1;
|
||||
atp_itemcfg_t config;
|
||||
}
|
||||
|
||||
atp_error_t atp_tips( atp_text_t tipsA, atp_text_t tipsB )
|
||||
{
|
||||
if( tipsA != NULL )
|
||||
|
@ -90,11 +90,11 @@ static const char *page[] = {
|
||||
"女儿情长埋葬"
|
||||
};
|
||||
|
||||
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *, atp_color_t *, atp_placement_t * )
|
||||
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_itemcfg_t *pcfg )
|
||||
{
|
||||
if( idx < sizeof(page) )
|
||||
{
|
||||
*ptext = page[idx];
|
||||
pcfg->text = page[idx];
|
||||
return ATP_SUCCESS;
|
||||
}
|
||||
else return ATP_INDEX_OUTOFRANGE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user