📄 widget_paint.c
字号:
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#include "widget.h"
#include "TimerEvents.h"
#include "wgui_categories.h"
#include "EventsDcl.h" /* ShutdownSystemOperation */
#include "L4Dr.h"
#include "gui.h" /* UI_cross_hatch_fill_rectangle */
#include "wgui_status_icons.h"
#ifdef __MMI_TOUCH_SCREEN__
#include "TouchScreenGprot.h"
#include "wgui_touch_screen.h"
#endif /* __MMI_TOUCH_SCREEN__ */
#include "wgui_softkeys.h"
#include "gpio/gpioInc/GPIOInc.h" /* Vibration/Backlight */
#include "mdi_datatype.h"
#include "mdi_video.h"
extern void mmi_phnset_disable_partial_ss(void);
extern void mmi_phnset_enable_partial_ss(void);
extern icontext_button MMI_softkeys[];
/****************************************************************
paint system
***************************************************************/
/////////////////////////////////////////////////////////////////////////////////////
// global variables
/////////////////////////////////////////////////////////////////////////////////////
/* previous focus candidate gadget position/size */
widget_header_struct *widget_prev_keyfocus;
MsfPosition widget_prev_widget_position;
MsfSize widget_prev_widget_size;
/* next focus candidate gadget position/size */
widget_header_struct *widget_next_keyfocus;
MsfPosition widget_next_widget_position;
MsfSize widget_next_widget_size;
/* current focused gadget position/size */
static MsfPosition widget_current_widget_position;
static kal_bool widget_current_widget_position_is_set;
/* currently, the min/max size of paintbox content */
int widget_min_x;
int widget_min_y;
int widget_max_x;
int widget_max_y;
extern BOOL r2lMMIFlag;
#ifndef __MTK_TARGET__
/*****************************************************************************
* FUNCTION
* widget_dump_hex
* DESCRIPTION
*
* PARAMETERS
* buf [IN]
* len [IN]
* RETURNS
* void
*****************************************************************************/
void widget_dump_hex(unsigned char *buf, int len)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
int i, pos;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
for (pos = 0; pos < len; pos += 16)
{
printf("%06d ", pos);
for (i = 0; i < 16; i++)
if (pos + i < len)
{
printf(" %02x", buf[pos + i]);
}
else
{
printf(" ");
}
printf(" ");
for (i = 0; i < 16; i++)
if (pos + i < len)
{
unsigned char c = buf[pos + i];
if (32 <= c && c <= 126)
{
printf("%c", c);
}
else
{
printf(".");
}
}
printf("\n");
}
}
/*****************************************************************************
* FUNCTION
* widget_show_info
* DESCRIPTION
*
* PARAMETERS
* handle [IN]
* RETURNS
* void
*****************************************************************************/
void widget_show_info(widget_header_struct *handle)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (_H(handle)->data_type)
{
case WIDGET_STYLE_TYPE:
printf("STYLE");
break;
case WIDGET_IMAGE_TYPE:
printf("IMAGE");
switch (_IMG(handle)->image_format)
{
case MsfPbm:
printf("(PBM)");
break;
case MsfGif:
printf("(GIF)");
break;
case MsfBmp:
printf("(BMP)");
break;
case MsfWbmp:
printf("(WBMP)");
break;
case MsfJpeg:
printf("(JPG)");
break;
case MsfPng:
printf("(PNG)");
break;
case MsfPictogram:
printf("(PIC)");
break;
}
if (_IMG(handle)->is_done)
{
printf("DONE");
}
break;
case WIDGET_ROOT_TYPE:
printf("ROOT");
break;
case WIDGET_SCREEN_TYPE:
printf("SCREEN");
break;
case WIDGET_STRING_TYPE:
printf("STRING");
break;
case WIDGET_PRE_STRING_TYPE:
printf("PRE_STRING");
break;
case WIDGET_PRE_IMAGE_TYPE:
printf("PRE_IMAGE");
break;
case WIDGET_CHOICE_ELEMENT_TYPE:
printf("CHOICE_ELEMENT");
break;
case WIDGET_ACTION_TYPE:
printf("ACTION");
break;
case WIDGET_SOUND_TYPE:
printf("SOUND");
break;
case WIDGET_RAW_DATA_TYPE:
printf("RAW_DATA");
break;
case WIDGET_PAINTBOX_TYPE:
printf("PAINTBOX");
if (_P(handle)->flag & WIDGET_FLAG_HAS_FOCUS)
{
printf("[FOCUS]");
}
break;
case WIDGET_FORM_TYPE:
printf("FORM");
break;
case WIDGET_DIALOG_TYPE:
printf("DIALOG");
break;
case WIDGET_MENU_TYPE:
printf("MENU");
break;
case WIDGET_EDITOR_TYPE:
printf("EDITOR");
break;
case WIDGET_CTK_TYPE:
printf("CTK");
break;
case WIDGET_ICON_TYPE:
printf("ICON");
break;
case WIDGET_GADGET_STRING_TYPE:
printf("GADGET_STRING");
break;
case WIDGET_GADGET_SELECT_GROUP_TYPE:
printf("GADGET_SELECT_GROUP");
break;
case WIDGET_GADGET_IMAGE_TYPE:
printf("GADGET_IMAGE ");
break;
case WIDGET_GADGET_DATE_TYPE:
printf("GADGET_DATE");
break;
case WIDGET_GADGET_BAR_TYPE:
printf("GADGET_BAR");
break;
case WIDGET_GADGET_INPUT_TYPE:
printf("GADGET_INPUT");
break;
default:
ASSERT(0);
}
}
/*****************************************************************************
* FUNCTION
* widget_show_action
* DESCRIPTION
*
* PARAMETERS
* action [IN]
* RETURNS
* void
*****************************************************************************/
void widget_show_action(widget_action_struct *action)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (action->action_mask)
{
case (1 << MsfHelp):
printf("MsfHelp\t");
break;
case (1 << MsfBack):
printf("MsfBack\t");
break;
case (1 << MsfCancel):
printf("MsfCancel\t");
break;
case (1 << MsfStop):
printf("MsfStop\t");
break;
case (1 << MsfExit):
printf("MsfExit\t");
break;
case (1 << MsfMenu):
printf("MsfMenu\t");
break;
case (1 << MsfSelect):
printf("MsfSelect\t");
break;
case (1 << MsfOk):
printf("MsfOk\t");
break;
}
}
#define if_print_bit(V,O,X) \
if( O & (1<<X) ) printf("["); \
if( V & (1<<X) ) {printf( #X " " );}\
if( O & (1<<X) ) printf("]");
/*****************************************************************************
* FUNCTION
* widget_show_event
* DESCRIPTION
*
* PARAMETERS
* handle [IN]
* RETURNS
* void
*****************************************************************************/
void widget_show_event(widget_window_struct *handle)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
int E = handle->event_mask;
int O = handle->event_override;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
printf("Event:");
if_print_bit(E, O, MsfKey_0);
if_print_bit(E, O, MsfKey_1);
if_print_bit(E, O, MsfKey_2);
if_print_bit(E, O, MsfKey_3);
if_print_bit(E, O, MsfKey_4);
if_print_bit(E, O, MsfKey_5);
if_print_bit(E, O, MsfKey_6);
if_print_bit(E, O, MsfKey_7);
if_print_bit(E, O, MsfKey_8);
if_print_bit(E, O, MsfKey_9);
if_print_bit(E, O, MsfKey_Star);
if_print_bit(E, O, MsfKey_Pound);
if_print_bit(E, O, MsfKey_Up);
if_print_bit(E, O, MsfKey_Down);
if_print_bit(E, O, MsfKey_Left);
if_print_bit(E, O, MsfKey_Right);
if_print_bit(E, O, MsfKey_Select);
if_print_bit(E, O, MsfKey_Clear);
if_print_bit(E, O, MsfKey_Yes);
if_print_bit(E, O, MsfKey_No);
if_print_bit(E, O, MsfKey_Menu);
if_print_bit(E, O, MsfKey_Soft1);
if_print_bit(E, O, MsfKey_Soft2);
if_print_bit(E, O, MsfKey_Soft3);
if_print_bit(E, O, MsfKey_Soft4);
if_print_bit(E, O, MsfKey_Function1);
if_print_bit(E, O, MsfKey_Function2);
if_print_bit(E, O, MsfKey_Function3);
if_print_bit(E, O, MsfKey_Function4);
if_print_bit(E, O, MsfPointer);
printf("\n");
}
#endif /* __MTK_TARGET__ */
/*****************************************************************************
* FUNCTION
* widget_paint_display_clipping_region
* DESCRIPTION
* Get the display clipping region. We should not overlap paintbox scrollbar in browser.
*
* It implies that widget screen will be repainted if scrollbars appear or disappear
*
* Note: WGUI->current_vertical_scrollbar is set after gadget bars are painted,
* Case1: this function is invoked in widget_paint_hdlr before gadget bars are painted
* => we do not know the bar size yet, however, the overlaped region with scrollbars
* will be erased after the scrollbars are painted
* Case 2: this function is invoked after gadget bars are painted
* => we should set clipping region according to the size and position of scrollbar
* PARAMETERS
* x1 [OUT] Left
* y1 [OUT] Top
* x2 [OUT] Right
* y2 [OUT] Bottom
* RETURNS
* void
*****************************************************************************/
void widget_paint_display_clipping_region(int *x1, int *y1, int *x2, int *y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
*x1 = WGUI_CTX->display_pos.x;
*x2 = WGUI_CTX->display_pos.x + WGUI_CTX->display_size.width - 1;
*y1 = WGUI_CTX->display_pos.y;
*y2 = WGUI_CTX->display_pos.y + WGUI_CTX->display_size.height - 1;
if (WGUI_CTX->in_paintbox)
{
if (WGUI_CTX->current_vertical_scrollbar)
{
*x2 -= WGUI_CTX->current_vertical_scrollbar->size.width;
}
if (WGUI_CTX->current_horizontal_scrollbar)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -