数组:MMI_status_icon MMI_status_icons[MAX_STATUS_ICONS]里,定制status icons。
结构体:
typedef struct _MMI_status_icon
{
S32 x, y;
S32 width, height;
MMI_ID_TYPE icon_ID;
U32 flags;
U8 state;
U8 group_ID;
U8 priority;
PU8 icon_data;
S16 n_frames;
S16 current_frame;
} MMI_status_icon;
x,y--------ICON的位置。
例如: 信号IMG_SI_SIGNAL_STRENGTH(x,y)=(1,2)
电池IMG_SI_BATTERY_STRENGTH(x,y)=(111,4)
短信IMG_SLSI_SMS_INDICATOR(x,y)=(11,2)
如果设置成(0,0),表示自动计算位置。only valid with Icon bars having STATUS_ICON_BAR_ARRANGE_XXXXXXXX
width, height—固定:(0,0)
FLAGS--------- Set status icon specific flags here
STATE---------- Set the default state of a multi-state status icon here(默认状态,针对有多种而言)
GROUP---------ICON分组。0 = Icon is not grouped
PRIORITY------ Set the status icon priority here.当很多个ICONs需要在同一个位置显示时,就按照
优先级来决定SHOW哪个ICON。
IMAGE----------Pointer to Icons image data. Autocalculated. Always set to NULL
NFRAMES--------Number of frames in the image. Autocalculated. Always set to 0
几个IDLE界面的有关ICON函数:
1. void IdleSetStatusIcon(S16 index)
{
ShowStatusIcon(index);
UpdateStatusIcons();
}
2. void ShowStatusIcon(S16 icon_ID)
{
MMI_status_icons[icon_ID].flags |= STATUS_ICON_DISPLAY;
IsReArrangeNeeded = 1;
}
3.void UpdateStatusIcons(void) //rearrange and refresh status icons
{
if (IsReArrangeNeeded)
{
arrange_status_icons(); //计算ICONs的位置
IsReArrangeNeeded = 0;
}
refresh_status_icon_display(); //重新显示所有的status icons
}
4. void IdleResetStatusIcon(S16 index)
{
HideStatusIcon(index);
UpdateStatusIcons();
}
5. void HideStatusIcon(S16 icon_ID)
{
MMI_status_icons[icon_ID].flags = 0;
IsReArrangeNeeded = 1;
mmi_flight_mode_is_status_icon_visible(icon_ID, 0);// Hide status icon in flight mode
}
6. void BlinkStatusIcon(S16 icon_ID)
{
ShowStatusIcon(icon_ID);
blink_status_icon(icon_ID);
}
7. void blink_status_icon(S16 icon_ID)
{
MMI_status_icons[icon_ID].flags |= STATUS_ICON_BLINK;
setup_status_icon_blink_animate();
}
以闹钟ICON为例:STATUS_ICON_ALARM
在文件:Wgui_status_iocns.h的枚举:enum STATUS_ICON_LIST中,添加Icon Name: STATUS_ICON_ALARM。
在文件:Wgui_status_icons.c的数组const S16 MMI_status_icons_pool1[]中,添加这个ICON ID:STATUS_ICON_ALARM。
注意: 在文件Wgui_status_icons.c中,定义了3个数组:
const S16 MMI_status_icons_pool1[]:main LCD使用到的ICON IDs
const S16 MMI_status_icons_pool2[]:sub LCD使用到的ICON IDs
const S16 MMI_status_icons_pool_partial_display[]:其他的一些ICON IDs
这3个数组中的ICON IDs全部在Wgui_status_iocns.h的枚举enum STATUS_ICON_LIST 中声明。
显示闹钟ICON
void AlmActivateIndicator(void)
{
ShowStatusIcon(STATUS_ICON_ALARM);
UpdateStatusIcons();
}
隐藏闹钟ICON
void AlmDeactivateIndicator(void)
{
HideStatusIcon(STATUS_ICON_ALARM);
UpdateStatusIcons();
}