wgui_calendar.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:258k
源码类别:
MTK
开发平台:
C/C++
- /*******************************************************************************
- * Modification Notice:
- * --------------------------
- * This software is modified by MediaTek Inc. and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *******************************************************************************/
- /*******************************************************************************
- * Filename:
- * ---------
- * wgui_calendar.c
- *
- * Project:
- * --------
- * Maui_Software
- *
- * Description:
- * ------------
- * calendar related funtions
- *
- * Author:
- * -------
- * -------
- *
- *------------------------------------------------------------------------------
- * $Log$
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- * Go to 1970/1/1 or 2030/12/31 when highlighted date is out of the boundary.
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- * Modified right arrow key blt region
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- */
- /**********************************************************************************
- Filename: wgui_calendar.c
- Author: manju
- Date Created: July-07-2003
- Contains: Contains the calendar control wrappers and category screens
- **********************************************************************************/
- /* Wrappers functions for use by category screens and applications */
- #include "GlobalDefs.h"
- #include "CustDataRes.h"
- #include "CustDataProts.h"
- #include "gui_themes.h"
- #include "wgui_categories.h"
- #include "wgui_status_icons.h"
- #include "wgui_softkeys.h"
- #include "wgui_calendar.h"
- #include "MMI_features.h"
- #include "DebugInitDef.h"
- #include "wgui_draw_manager.h"
- #include "DateTimeGprot.h"
- #include "DateTimeType.h"
- #include "wgui_categories_defs.h"
- #include "wgui_softkeys.h"
- #include "wgui_categories_defs.h"
- #include "CalendarDef.h" /* Calendar image */
- #include "CalendarProt.h"
- #if(ENABLE_CALENDAR_CONTROL)
- #ifdef __MMI_TOUCH_SCREEN__
- static S32 calendar_arrow_width, calendar_arrow_height;
- #endif
- #define CALENDAR_FULL_SCREEN_BACKGROUND 1
- #define CALENDAR_BORDERED_TITLES 1
- /* Calendar popup widht */
- #define CALENDAR_POPUP_WIDTH 100 /* Maximum width allowed for calendar pop up */
- /* Calendar popup height */
- #define CALENDAR_POPUP_HEIGHT 100 /* Maximum height allowed for calendar pop up */
- /* start x position of calendar popup */
- #define CALENDAR_POPUP_X 1 /* If using Fixed position, (x,y) are relative / absolute values to screen corners */
- /* start y position of calendar popup */
- #define CALENDAR_POPUP_Y 0 /* Otherwise, (x,y) are relative to the highlighted day on calendar */
- #define CALENDAR_POPUP_FIXED_POSITION 0 /* 1:Show at fixed location (fixed with respect to screen corners) */
- #define CALENDAR_POPUP_FIXED_RIGHT 0 /* 1:Show to right side of screen, 0:Show to left side */
- #define CALENDAR_POPUP_FIXED_BOTTOM 0 /* 1:Show to bottom of screen, 0:Show from top of screen */
- /* popup time duration */
- #define CALENDAR_POPUP_WAIT_TIME 2000 /* Milliseconds before the pop up is displayed after highlighting a day */
- /* External Global variables and funtion declaration */
- extern S32 UI_get_font_height(UI_font_type f);
- extern BOOL r2lMMIFlag;
- extern pBOOL IsChineseSet(void);
- extern U8 matrix_main_menu_highlight_bitmap_data[];
- extern icontext_button MMI_softkeys[];
- /* global variable of calendar_control */
- calendar_control MMI_calendar_control;
- /* store monthly days */
- U8 MMI_calendar_days[MAX_CALENDAR_DAYS];
- /* store hightlighted day */
- S32 MMI_calendar_highlighted_day = -1;
- /* Lunar calendar specific title display */
- U8 *Cat82_title1;
- U8 *Cat82_title2;
- U8 *Cat82_title3;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- U8 *Cat82_title1_month;
- #ifdef __MMI_TOUCH_SCREEN__
- BOOL Cat82_title1_arrow_disable = MMI_FALSE;
- BOOL Cat82_title1_month_arrow_disable = MMI_FALSE;
- #endif /* __MMI_TOUCH_SCREEN__ */
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- U8 MMI_calendar_title_string[CLNDR_TITLE_LEN];
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- U8 MMI_calendar_title_string_month[CLNDR_TITLE_LEN]; /* get from getstring() so don't need buffer */
- #endif
- S16 MMI_calendar_current_month = -1;
- S16 MMI_calendar_current_year = -1;
- BOOL lunar_calendar_present = MMI_FALSE;
- static void UI_dummy_function_s32s32s32(S32 day, S32 month, S32 year);
- static void (*MMI_calendar_control_update_handler) (S32 day, S32 month, S32 year) = UI_dummy_function_s32s32s32;
- /* a func pointer of calendar control highhlight handler */
- void (*MMI_calendar_control_highlight_handler) (S32 day) = UI_dummy_function_s32;
- /* global varibales of mesage for lunar calendar */
- U8 *MMI_calendar_messages1 = NULL;
- U8 *MMI_calendar_messages2 = NULL;
- U8 *MMI_calendar_messages3 = NULL;
- pBOOL calendar_show_title2 = 1;
- pBOOL calendar_show_title3 = 1;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- pBOOL calendar_show_title_month = 1;
- #endif
- UI_font_type calendar_title_font;
- void SetCategory82Title1(U8 *title);
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- void SetCategory82Title1Month(U8 *title);
- #endif
- /* Category functions for calendar related screens */
- S32 cat82_title1_x1; /* start x position of lunar calendar title1 */
- S32 cat82_title1_y1; /* start y position of lunar calendar title1 */
- S32 cat82_title1_x2; /* end x position of lunar calendar title1 */
- S32 cat82_title1_y2; /* end y position of lunar calendar title1 */
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- S32 cat82_title1_month_x1; /* start x position of lunar calendar title1 month */
- S32 cat82_title1_month_y1; /* start y position of lunar calendar title1 month */
- S32 cat82_title1_month_x2; /* end x position of lunar calendar title1 month */
- S32 cat82_title1_month_y2; /* end y position of lunar calendar title1 month */
- UI_font_type calendar_title_month_font;
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- S32 cat82_title2_x1; /* start x position of lunar calendar title2 */
- S32 cat82_title2_y1; /* start y position of lunar calendar title2 */
- S32 cat82_title2_x2; /* end x position of lunar calendar title2 */
- S32 cat82_title2_y2; /* end y position of lunar calendar title2 */
- S32 cat82_title3_x1; /* start x position of lunar calendar title3 */
- S32 cat82_title3_y1; /* start y position of lunar calendar title3 */
- S32 cat82_title3_x2; /* end x position of lunar calendar title3 */
- S32 cat82_title3_y2; /* end y position of lunar calendar title 3 */
- /* global variable store the calendar bkg image */
- PU8 calendar_control_background_image = NULL;
- /* global variable store the calendar title image */
- PU8 calendar_control_title_image = NULL;
- /* global variable store strat y position of calndar bkg */
- S32 calendar_control_background_y1 = 0;
- /* global variable store end y position of calndar bkg */
- S32 calendar_control_background_y2 = 0;
- /* store calendar popup start x position */
- S32 *wgui_calendar_ppx1 = NULL;
- /* store calendar popup end x position */
- S32 *wgui_calendar_ppx2 = NULL;
- /* store calendar popup start y position */
- S32 *wgui_calendar_ppy1 = NULL;
- /* store calendar popup end y position */
- S32 *wgui_calendar_ppy2 = NULL;
- /* current day */
- S32 wgui_calendar_pp_day = -1;
- /* Health calendar message1 */
- UI_string_type cat81_message1 = NULL;
- /* Health calendar message2 */
- UI_string_type cat81_message2 = NULL;
- /* Functions to setup the background image and display theme for the calendar */
- /* theme colr of calendar normal day */
- const UI_filled_area _calendar_normal_day_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND,
- NULL,
- NULL,
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- 0
- };
- /* theme color of calendar task day */
- const UI_filled_area _calendar_task_day_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {255, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /* theme color of calendar selected day */
- const UI_filled_area _calendar_selected_day_filler = {UI_FILLED_AREA_TYPE_COLOR,
- NULL,
- NULL,
- {20, 124, 86, 100},
- {0, 0, 0, 0},
- {255, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /* theme color of calendar current day */
- const UI_filled_area _calendar_current_day_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {20, 124, 86, 100},
- {0, 0, 0, 0},
- {0, 192, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /* special day theme color , Move to wgui_calendar.c */
- const UI_filled_area _calendar_special1_day_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {255, 100, 100, 100},
- {0, 0, 0, 0},
- {255, 100, 100, 100},
- {0, 0, 0, 0},
- 0
- };
- const UI_filled_area _calendar_special2_day_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {255, 200, 100, 100},
- {0, 0, 0, 0},
- {255, 200, 100, 100},
- {0, 0, 0, 0},
- 0
- };
- const UI_filled_area _calendar_special3_day_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {255, 255, 100, 100},
- {0, 0, 0, 0},
- {255, 255, 100, 100},
- {0, 0, 0, 0},
- 0
- };
- const UI_filled_area _calendar_special4_day_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- NULL,
- NULL,
- {205, 234, 180, 100},
- {0, 0, 0, 0},
- {151, 171, 160, 100},
- {0, 0, 0, 0},
- 0
- };
- /* theme color of calendar */
- calendar_theme _calendar_control_theme_data =
- {
- &MMI_small_font,
- {0, 0, 0, 100},
- {0, 0, 0, 100},
- {0, 0, 0, 100},
- {255, 255, 255, 100},
- {200, 0, 0, 100},
- {0, 128, 0, 100},
- {0, 0, 0, 100},
- {0, 0, 0, 100},
- {0, 0, 0, 100},
- {0, 0, 0, 100},
- (UI_filled_area *)&_calendar_normal_day_filler,
- (UI_filled_area *)&_calendar_normal_day_filler,
- (UI_filled_area *)&_calendar_task_day_filler,
- (UI_filled_area *)&_calendar_current_day_filler,
- (UI_filled_area *)&_calendar_selected_day_filler,
- (UI_filled_area *)&_calendar_normal_day_filler,
- (UI_filled_area *)&_calendar_normal_day_filler,
- (UI_filled_area *)&_calendar_special1_day_filler,
- (UI_filled_area *)&_calendar_special2_day_filler,
- (UI_filled_area *)&_calendar_special3_day_filler,
- (UI_filled_area *)&_calendar_special4_day_filler,
- };
- /*****************************************************************************
- * FUNCTION
- * UI_dummy_function_s32s32s32
- * DESCRIPTION
- *
- * PARAMETERS
- * day [IN]
- * month [IN]
- * year [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UI_dummy_function_s32s32s32(S32 day, S32 month, S32 year)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(day);
- UI_UNUSED_PARAMETER(month);
- UI_UNUSED_PARAMETER(year);
- }
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- /* PMT VIKAS START 20051217 */
- #if ( defined (__MMI_MAINLCD_128X128__) || defined (__MMI_MAINLCD_128X160__) )
- #define DALMATIAN_CALENDAR_WEEK_IMAGE_START 2
- #elif defined( __MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)
- #define DALMATIAN_CALENDAR_WEEK_IMAGE_START 4
- #endif
- /* PMT VIKAS END 20051217 */
- static S32 gdalmatian_current_month = 0;
- static S32 gdalmatian_current_year = 0;
- static S32 gdalmatian_current_day = 0;
- static S32 gdalmatian_week_num = 1;
- static S32 gdalmatian_calendar_highlighter = 1;
- wgui_dalmatian_calendar_highlighter_styles dalmatian_calendar_highlighter_style =
- DALMATIAN_CALENDAR_HIGHLIGHTER_MOVE_WITH_SELECT;
- UI_filled_area *backup_selected_day_filler;
- UI_filled_area image_box_selected_day_filler;
- typedef struct _calendar_highlighter
- {
- color horizontal;
- color vertical;
- } calendar_highlighter;
- typedef struct _calendar_highlighter_box
- {
- color box_color;
- } calendar_highlighter_box;
- /* Use diff structure for make seperation easy if required i.e. if border is not required */
- typedef struct _calendar_highlighter_box_border
- {
- color box_border_color;
- } calendar_highlighter_box_border;
- calendar_highlighter color_opacity_lookup_Table_calendar_highlighter[] =
- {
- {{51, 126, 184, 50}, {141, 165, 186, 60}},
- {{253, 72, 53, 50}, {253, 113, 113, 60}},
- {{253, 146, 60, 50}, {251, 209, 82, 60}},
- {{156, 93, 51, 50}, {253, 212, 143, 60}},
- {{251, 216, 51, 50}, {248, 183, 8, 60}},
- {{153, 209, 56, 50}, {220, 252, 2, 60}},
- {{95, 184, 51, 50}, {171, 249, 36, 60}},
- {{54, 233, 253, 50}, {80, 198, 247, 60}},
- {{251, 154, 184, 50}, {253, 52, 114, 60}},
- {{160, 125, 204, 50}, {177, 78, 188, 60}},
- {{160, 56, 81, 50}, {215, 65, 100, 60}},
- {{51, 126, 184, 50}, {141, 165, 186, 60}}
- };
- calendar_highlighter_box color_opacity_lookup_Table_calendar_highlighter_box[] =
- {
- {128, 128, 128, 100},
- {214, 4, 4, 100},
- {252, 154, 13, 100},
- {132, 54, 3, 100},
- {250, 119, 3, 100},
- {92, 143, 4, 100},
- {108, 174, 5, 100},
- {4, 120, 169, 100},
- {200, 4, 64, 100},
- {173, 86, 247, 100},
- {205, 25, 63, 100},
- {128, 128, 128, 100}
- };
- calendar_highlighter_box_border color_opacity_lookup_Table_calendar_highlighter_box_border[] =
- {
- {1, 6, 0, 100},
- {3, 0, 0, 100},
- {168, 69, 3, 100},
- {1, 6, 0, 100},
- {90, 28, 1, 100},
- {1, 6, 0, 100},
- {11, 53, 2, 100},
- {2, 46, 90, 100},
- {102, 4, 50, 100},
- {37, 3, 51, 100},
- {90, 28, 1, 100},
- {1, 6, 0, 100}
- };
- /*****************************************************************************
- * FUNCTION
- * wgui_read_calendar_highlighter_horizontal_color
- * DESCRIPTION
- * Returns the highlighter color of horizontal bar
- * PARAMETERS
- * month [IN]
- * RETURNS
- * color
- *****************************************************************************/
- color wgui_read_calendar_highlighter_horizontal_color(S32 month)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return color_opacity_lookup_Table_calendar_highlighter[month].horizontal;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_read_calendar_highlighter_vertical_color
- * DESCRIPTION
- * Returns the highlighter color of vertical bar
- * PARAMETERS
- * month [IN]
- * RETURNS
- * color
- *****************************************************************************/
- color wgui_read_calendar_highlighter_vertical_color(S32 month)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return color_opacity_lookup_Table_calendar_highlighter[month].vertical;
- }
- /*****************************************************************************
- * FUNCTION
- * set_current_month_year_for_dalmatian
- * DESCRIPTION
- * Set the globel values for the current date
- * PARAMETERS
- * current_day [IN] S32 current_month S32 current_year
- * current_month [IN]
- * current_year [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_month_year_for_dalmatian(S32 current_day, S32 current_month, S32 current_year)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdalmatian_current_day = current_day;
- gdalmatian_current_month = current_month;
- gdalmatian_current_year = current_year;
- }
- /*****************************************************************************
- * FUNCTION
- * draw_current_week_highlighter
- * DESCRIPTION
- * Draw the week highlighter for current date
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void draw_current_week_highlighter(calendar_control *c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, x2, y1, y2;
- S32 cell_width = c->cell_width;
- S32 cell_height = c->cell_height;
- S32 n_rows = c->n_rows;
- S32 n_columns = c->n_columns;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_month == gdalmatian_current_month && MMI_calendar_current_year == gdalmatian_current_year)
- {
- get_current_date_highlighter_coordinates(&MMI_calendar_control, &x1, &y1);
- x2 = x1 + cell_width;
- y2 = y1 + cell_height - 1;
- /* PMT VIKAS START 20051217 */
- #ifdef __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__
- /* PMT VIKAS END 20051217 */
- gui_transparent_color_filler(
- x1 - 1,
- c->y,
- x2,
- c->y2,
- wgui_read_calendar_highlighter_vertical_color(MMI_calendar_current_month - 1));
- gui_transparent_color_filler(
- c->x + 1,
- y1 + 1,
- c->x + ((cell_width) * n_columns) - 1,
- y2 + 1,
- wgui_read_calendar_highlighter_horizontal_color(MMI_calendar_current_month - 1));
- #else /* __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__ */
- gui_draw_rectangle(
- x1 - 1,
- c->y,
- x2,
- c->y2,
- wgui_read_calendar_highlighter_vertical_color(MMI_calendar_current_month - 1));
- gui_draw_rectangle(
- c->x + 1,
- y1 + 1,
- c->x + ((cell_width) * n_columns) - 1,
- y2 + 1,
- wgui_read_calendar_highlighter_horizontal_color(MMI_calendar_current_month - 1));
- #endif /* __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__ */
- /* For current date reselection. */
- gui_draw_rectangle(x1, y1 + 1, x2 - 1, y2 + 1, MMI_calendar_control.theme->current_day_filler->c);
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * get_current_date_highlighter_coordinates
- * DESCRIPTION
- * Return the date highlighter coordinates
- * PARAMETERS
- * c [IN]
- * x [OUT]
- * y [OUT]
- * RETURNS
- * void
- *****************************************************************************/
- void get_current_date_highlighter_coordinates(calendar_control *c, S32 *x, S32 *y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, j, x1, x2, y1, y2;
- S32 cell_width = c->cell_width;
- S32 cell_height = c->cell_height;
- S32 ox = c->x1;
- S32 oy = c->y1;
- S32 n_rows = c->n_rows;
- S32 n_columns = c->n_columns;
- S32 index = 0;
- U8 *list_of_items = c->list_of_items;
- S32 current_day = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- y1 = oy;
- for (j = 0; j < n_rows; j++)
- {
- x1 = ox;
- for (i = 0; i < n_columns; i++)
- {
- x2 = x1 + cell_width - 1;
- y2 = y1 + cell_height - 1;
- if ((index >= c->first_item) && (index <= c->last_item))
- {
- if ((list_of_items[current_day] & 0x3f) == CALENDAR_CURRENT_DAY)
- {
- *x = x1;
- *y = y1;
- return;
- }
- current_day++;
- }
- x1 += cell_width;
- index++;
- }
- y1 += cell_height;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * draw_current_day_highlighter
- * DESCRIPTION
- * Draw the date highlighter for current date
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void draw_current_day_highlighter(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- color day_highlighter_color;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- day_highlighter_color = MMI_calendar_control.theme->current_day_filler->c;
- get_current_date_highlighter_coordinates(&MMI_calendar_control, &x1, &y1);
- x2 = x1 + MMI_calendar_control.cell_width;
- y2 = y1 + MMI_calendar_control.cell_height - 1;
- if ( MMI_calendar_current_month == gdalmatian_current_month && MMI_calendar_current_year==gdalmatian_current_year )
- {
- gui_draw_rectangle(x1, y1 + 1, x2 - 1, y2 + 1, day_highlighter_color);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * draw_current_week_highlighter_with_current_selection
- * DESCRIPTION
- * Draw the week highlighter for current date selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void draw_current_week_highlighter_with_current_selection(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, col;
- S32 x11, y11, x21, y21;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- gdi_layer_push_clip();
- gui_reset_clip();
- /* PMT VIKAS START 20051217 */
- #ifdef __MMI_MAINLCD_128X160__
- gui_push_clip();
- gui_set_clip(0, 0, MMI_calendar_control.x2, MMI_calendar_control.y2);
- #endif /* __MMI_MAINLCD_128X160__ */
- /* PMT VIKAS END 20051217 */
- gui_show_image(0, 0, calendar_control_background_image);
- gui_show_calendar(&MMI_calendar_control);
- /* PMT VIKAS START 20051217 */
- #ifdef __MMI_MAINLCD_128X160__
- gui_pop_clip();
- #endif
- /* PMT VIKAS END 20051217 */
- row = MMI_calendar_control.highlighted_item / MMI_calendar_control.n_columns;
- col = MMI_calendar_control.highlighted_item % MMI_calendar_control.n_columns;
- x11 = MMI_calendar_control.x1 + MMI_calendar_control.cell_width * col;
- y11 = MMI_calendar_control.y1 + MMI_calendar_control.cell_height * row;
- x21 = x11 + MMI_calendar_control.cell_width;
- y21 = y11 + MMI_calendar_control.cell_height;
- /* PMT VIKAS START 20051217 */
- #ifdef __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__
- /* PMT VIKAS END 20051217 */
- gui_transparent_color_filler(
- x11,//-1
- MMI_calendar_control.y+1,
- x21-1,
- MMI_calendar_control.y2,
- wgui_read_calendar_highlighter_vertical_color(MMI_calendar_current_month - 1));
- gui_transparent_color_filler(
- MMI_calendar_control.x ,
- y11 + 1,
- MMI_calendar_control.x + ((MMI_calendar_control.cell_width) * MMI_calendar_control.n_columns) - 1,
- y21,
- wgui_read_calendar_highlighter_horizontal_color(MMI_calendar_current_month - 1));
- #else /* __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__ */
- gui_draw_rectangle(
- x11 - 1,
- MMI_calendar_control.y,
- x21,
- MMI_calendar_control.y2,
- wgui_read_calendar_highlighter_vertical_color(MMI_calendar_current_month - 1));
- gui_draw_rectangle(
- MMI_calendar_control.x + 1,
- y11 + 1,
- MMI_calendar_control.x + ((MMI_calendar_control.cell_width) * MMI_calendar_control.n_columns) - 1,
- y21 + 1,
- wgui_read_calendar_highlighter_horizontal_color(MMI_calendar_current_month - 1));
- #endif /* __MMI_UI_TRANSPARENT_EFFECT_IN_DALMATIAN_CALENDAR__ */
- gui_calendar_refresh_highlight(&MMI_calendar_control, 0, MMI_calendar_control.highlighted_item);
- draw_current_day_highlighter();
- gdi_layer_pop_clip();
- gdi_layer_unlock_frame_buffer();
- }
- /*****************************************************************************
- * FUNCTION
- * set_dalmatian_calendar_highlighter_box
- * DESCRIPTION
- * Draw the highlighter box for current date selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void set_dalmatian_calendar_highlighter_box(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* for color filler */
- backup_selected_day_filler = MMI_calendar_control.theme->selected_day_filler;
- image_box_selected_day_filler = *backup_selected_day_filler;
- MMI_calendar_control.theme->selected_day_filler = &image_box_selected_day_filler;
- MMI_calendar_control.theme->selected_day_filler->c =
- color_opacity_lookup_Table_calendar_highlighter_box[MMI_calendar_current_month - 1].box_color;
- MMI_calendar_control.theme->selected_day_filler->border_color =
- color_opacity_lookup_Table_calendar_highlighter_box_border[MMI_calendar_current_month - 1].box_border_color;
- MMI_calendar_control.theme->selected_day_filler->flags = UI_FILLED_AREA_TYPE_COLOR;
- MMI_calendar_control.theme->selected_day_filler->flags =
- MMI_calendar_control.theme->selected_day_filler->flags | UI_FILLED_AREA_SINGLE_BORDER;
- }
- /*****************************************************************************
- * FUNCTION
- * dalmatian_calendar_current_week_image
- * DESCRIPTION
- * Draw the week highlighter image for current date selected
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16 dalmatian_calendar_current_week_image(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (IsChineseSet())
- {
- return CAL_CHINESE_DAYS_IMAGE;
- }
- else
- {
- return (DALMATIAN_WEEK_HIGHLIGHTER_IMAGE_ID_JAN + MMI_calendar_current_month - 1);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * set_dalmatian_calendar_highlighter_enable
- * DESCRIPTION
- * It enable the flag gdalmatian_calendar_highlighter
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void set_dalmatian_calendar_highlighter_enable(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdalmatian_calendar_highlighter = 1;
- }
- /*****************************************************************************
- * FUNCTION
- * set_dalmatian_calendar_highlighter_disable
- * DESCRIPTION
- * It disable the flag gdalmatian_calendar_highlighter
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void set_dalmatian_calendar_highlighter_disable(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdalmatian_calendar_highlighter = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * dalmatian_calendar_highlighter_status
- * DESCRIPTION
- * It returns the value of flag gdalmatian_calendar_highlighter
- * PARAMETERS
- * void
- * RETURNS
- * S32
- *****************************************************************************/
- S32 dalmatian_calendar_highlighter_status(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return gdalmatian_calendar_highlighter;
- }
- /*****************************************************************************
- * FUNCTION
- * set_dalmatian_current_week_num
- * DESCRIPTION
- * It returns the value of flag gdalmatian_calendar_highlighter
- * PARAMETERS
- * void
- * RETURNS
- * S32(?)
- *****************************************************************************/
- void set_dalmatian_current_week_num(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, no_of_days, is_leap, week_day, numdays_inmonth, day_on_firstjan, day_on_last_day;
- calendar_control *c = &MMI_calendar_control;
- S32 handler_sunday_saterday = 2;
- S32 no_of_days_inweek = 7;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- no_of_days = 0;
- is_leap = 0;
- for (i = MMI_calendar_current_month - 1; i > 0; i--)
- {
- /* get the num of days in todays month */
- numdays_inmonth = LastDayOfMonth((U8) i, (U16) MMI_calendar_current_year);
- no_of_days += numdays_inmonth;
- }
- day_on_firstjan = DOW(MMI_calendar_current_year, 1, 1);
- day_on_last_day = DOW(MMI_calendar_current_year, (U8) MMI_calendar_current_month, 1);
- /* Total no of days/ weekdays */
- no_of_days += (day_on_firstjan - handler_sunday_saterday + c->highlighted_item - day_on_last_day + 1);
- week_day = (no_of_days) / no_of_days_inweek;
- gdalmatian_week_num = week_day + 1;
- }
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- #ifdef __MMI_UI_DALMATIAN_SOFTKEYS__
- /*****************************************************************************
- * FUNCTION
- * shuffle_softkey_draw_dalmatian_calender_image
- * DESCRIPTION
- * shuffle the softkey by drawing the calendar background
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void shuffle_softkey_draw_dalmatian_calender_image(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_show_image(0, 0, calendar_control_background_image);
- }
- #endif /* __MMI_UI_DALMATIAN_SOFTKEYS__ */
- /*****************************************************************************
- * FUNCTION
- * ShowCalendarCommomCategoryScreen
- * DESCRIPTION
- * key board handler of calendar
- * PARAMETERS
- * left_softkey [IN]
- * left_softkey_icon [IN]
- * right_softkey [IN]
- * right_softkey_icon [IN]
- * history_buffer [?]
- * S32(?) [IN] Key_state key state
- * RETURNS
- * void
- *****************************************************************************/
- void ShowCalendarCommomCategoryScreen(
- U16 left_softkey,
- U16 left_softkey_icon,
- U16 right_softkey,
- U16 right_softkey_icon,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 tmpString[CLNDR_TITLE_LEN];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ADD_SCREEN_STRINGS((2, left_softkey, right_softkey));
- ADD_SCREEN_IMAGES((2, left_softkey_icon, right_softkey_icon));
- entry_full_screen();
- UI_UNUSED_PARAMETER(history_buffer);
- gdi_layer_lock_frame_buffer();
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- memset(MMI_calendar_title_string, 0, sizeof(MMI_calendar_title_string));
- memset(MMI_calendar_title_string_month, 0, sizeof(MMI_calendar_title_string));
- sprintf(tmpString, "%d", MMI_calendar_current_year);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- if (IsChineseSet())
- {
- sprintf(tmpString, "%d", MMI_calendar_current_month);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string_month, tmpString);
- }
- else
- {
- pfnUnicodeStrcpy(
- (S8*) MMI_calendar_title_string_month,
- GetString((U16) (STR_GUI_MONTH_BASE + MMI_calendar_current_month)));
- }
- #else /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- memset(MMI_calendar_title_string, 0, sizeof(MMI_calendar_title_string));
- if (IsChineseSet())
- {
- sprintf(tmpString, "%d %02d", MMI_calendar_current_year, MMI_calendar_current_month);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- }
- else
- {
- sprintf(tmpString, "%d ", MMI_calendar_current_year);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- pfnUnicodeStrcat(
- (S8*) MMI_calendar_title_string,
- GetString((U16) (STR_GUI_MONTH_BASE + MMI_calendar_current_month)));
- }
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- if (lunar_calendar_present)
- {
- Cat82_title2 = MMI_calendar_title_string;
- }
- else
- {
- MMI_title_string = (UI_string_type) MMI_calendar_title_string;
- }
- #ifdef __MMI_SLIM_CALENDAR__
- SetCalendarBackground((U16) IMG_CALENDAR_JAN);
- #else
- SetCalendarBackground((U16) (IMG_CALENDAR_JAN + MMI_calendar_current_month - 1));
- #endif
- clear_category_screen_key_handlers();
- change_left_softkey(left_softkey, left_softkey_icon);
- change_right_softkey(right_softkey, right_softkey_icon);
- clear_left_softkey();
- clear_right_softkey();
- register_left_softkey_handler();
- register_right_softkey_handler();
- register_default_hide_softkeys();
- /* register calendat key handlers */
- wgui_register_calendar_keys();
- gdi_layer_unlock_frame_buffer();
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_keyboard_key_handler
- * DESCRIPTION
- * key board handler of calendar
- * PARAMETERS
- * vkey_code [IN] Key code
- * key_state [IN] Key state
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_keyboard_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- gui_calendar_previous_day(&MMI_calendar_control); /* move to previous day */
- break;
- case 39:
- gui_calendar_next_day(&MMI_calendar_control); /* move to next day */
- break;
- case 38:
- gui_calendar_previous_row(&MMI_calendar_control); /* move to previous row */
- break;
- case 40:
- gui_calendar_next_row(&MMI_calendar_control); /* move to next row */
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_control_highlight_handler
- * DESCRIPTION
- * highlight handler of calendar
- * PARAMETERS
- * day [IN] Selected day
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_control_highlight_handler(S32 day)
- { /* store selected day */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_calendar_highlighted_day = day;
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- if (dalmatian_calendar_highlighter_status() == 1)
- {
- set_dalmatian_calendar_highlighter_box();
- }
- if (dalmatian_calendar_highlighter_style == DALMATIAN_CALENDAR_HIGHLIGHTER_MOVE_WITH_SELECT &&
- dalmatian_calendar_highlighter_status() == 1)
- {
- draw_current_week_highlighter_with_current_selection();
- }
- //set_dalmatian_current_week_num();
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- /* highlight the selected day */
- MMI_calendar_control_highlight_handler(day);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_control_update_handler
- * DESCRIPTION
- * update the content of the calendar control
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void wgui_calendar_control_update_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 DayOnFirst, NumDaysInMonth;
- S32 i;
- S8 tmpString[CLNDR_TITLE_LEN];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DayOnFirst = DOW(MMI_calendar_current_year, (U8) MMI_calendar_current_month, 1);
- /* get the num of days in todays month */
- NumDaysInMonth = LastDayOfMonth((U8) MMI_calendar_current_month, MMI_calendar_current_year);
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- memset(MMI_calendar_title_string, 0, sizeof(MMI_calendar_title_string));
- memset(MMI_calendar_title_string_month, 0, sizeof(MMI_calendar_title_string));
- sprintf(tmpString, "%d", MMI_calendar_current_year);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- if (IsChineseSet())
- {
- if (lunar_calendar_present)
- {
- Cat82_title2 = MMI_calendar_title_string;
- }
- else
- {
- MMI_title_string = (UI_string_type) MMI_calendar_title_string;
- }
- sprintf(tmpString, "%d", MMI_calendar_current_month);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string_month, tmpString);
- }
- else
- {
- MMI_title_string = (UI_string_type) MMI_calendar_title_string;
- pfnUnicodeStrcpy(
- (S8*) MMI_calendar_title_string_month,
- GetString((U16) (STR_GUI_MONTH_BASE + MMI_calendar_current_month)));
- }
- #else /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- memset(MMI_calendar_title_string, 0, sizeof(MMI_calendar_title_string));
- if (IsChineseSet())
- {
- sprintf(tmpString, "%d %02d", MMI_calendar_current_year, MMI_calendar_current_month);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- if (lunar_calendar_present)
- {
- Cat82_title2 = MMI_calendar_title_string;
- }
- else
- {
- MMI_title_string = (UI_string_type) MMI_calendar_title_string;
- }
- }
- else
- {
- sprintf(tmpString, "%d ", MMI_calendar_current_year);
- AnsiiToUnicodeString((S8*) MMI_calendar_title_string, tmpString);
- pfnUnicodeStrcat(
- (S8*) MMI_calendar_title_string,
- GetString((U16) (STR_GUI_MONTH_BASE + MMI_calendar_current_month)));
- MMI_title_string = (UI_string_type) MMI_calendar_title_string;
- }
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- #ifdef __MMI_SLIM_CALENDAR__
- calendar_control_background_image = get_image((U16) IMG_CALENDAR_JAN);
- #else
- calendar_control_background_image = get_image((U16) (IMG_CALENDAR_JAN + MMI_calendar_current_month - 1));
- #endif
- for (i = 0; i < MAX_CALENDAR_DAYS; i++)
- {
- MMI_calendar_days[i] = CALENDAR_NORMAL_DAY; /* Clear all flags before updating */
- }
- MMI_calendar_control_update_handler(
- MMI_calendar_highlighted_day,
- MMI_calendar_current_month,
- MMI_calendar_current_year);
- gui_set_calendar_days(&MMI_calendar_control, DayOnFirst, NumDaysInMonth, MMI_calendar_days);
- if (IsChineseSet() && lunar_calendar_present)
- {
- RedrawCategory82Screen();
- }
- else
- {
- RedrawCategory80Screen();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_display_calendar_pop_up
- * DESCRIPTION
- * create popup dialog box of calendar
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_display_calendar_pop_up(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* These can be obtained from theme data */
- const UI_filled_area popup_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {47, 55, 143, 80},
- {0, 0, 0, 0},
- {0, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- color tc = *(current_MMI_theme->UI_white_color);
- UI_font_type text_font = &MMI_medium_font;
- S32 x1 = *wgui_calendar_ppx1;
- S32 y1 = *wgui_calendar_ppy1;
- S32 x2 = *wgui_calendar_ppx2;
- S32 px1, py1, px2, py2;
- S32 width, height, y;
- S32 w1, w2, w3, h1, h2, h3;
- /* set message 1 of popup */
- UI_string_type msg1 = (UI_string_type) MMI_calendar_messages1;
- /* set message 2 of popup */
- UI_string_type msg2 = (UI_string_type) MMI_calendar_messages2;
- /* set message 3 of popup */
- UI_string_type msg3 = (UI_string_type) MMI_calendar_messages3;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* set font of popup */
- gui_set_font(text_font);
- if ((msg1 == NULL) && (msg2 == NULL) && (msg3 == NULL))
- {
- MMI_calendar_control.flags &= ~CALENDAR_POPUP_BACKUP;
- return;
- }
- if (msg1 == NULL)
- {
- h1 = 0;
- w1 = 0;
- }
- else
- {
- gui_measure_string(msg1, &w1, &h1); /* measue width and height of msg1 */
- }
- if (msg2 == NULL)
- {
- h2 = 0;
- w2 = 0;
- }
- else
- {
- gui_measure_string(msg2, &w2, &h2); /* measue width and height of msg1 */
- }
- if (msg3 == NULL)
- {
- h3 = 0;
- w3 = 0;
- }
- else
- {
- gui_measure_string(msg3, &w3, &h3); /* measue width and height of msg1 */
- }
- height = h1 + h2 + h3 + 8;
- width = w1;
- if (w2 > width)
- {
- width = w2;
- }
- if (w3 > width)
- {
- width = w3;
- }
- width += 8;
- if (width > CALENDAR_POPUP_WIDTH)
- {
- width = CALENDAR_POPUP_WIDTH;
- }
- if (height > CALENDAR_POPUP_HEIGHT)
- {
- height = CALENDAR_POPUP_HEIGHT;
- }
- #if(CALENDAR_POPUP_FIXED_POSITION)
- /* Not complete: Overlaps need to be handled */
- #if(CALENDAR_POPUP_FIXED_RIGHT)
- px1 = CALENDAR_POPUP_X - width;
- #else
- px1 = CALENDAR_POPUP_X;
- #endif
- #if(CALENDAR_POPUP_FIXED_BOTTOM)
- py1 = CALENDAR_POPUP_Y - height;
- #else
- py1 = CALENDAR_POPUP_Y;
- #endif
- #else /* (CALENDAR_POPUP_FIXED_POSITION) */
- px1 = x2 + CALENDAR_POPUP_X;
- py1 = y1 + CALENDAR_POPUP_Y;
- #endif /* (CALENDAR_POPUP_FIXED_POSITION) */
- if ((px1 + width - 1) > MMI_calendar_control.x2)
- {
- px1 = x1 - width - CALENDAR_POPUP_X;
- if (px1 < MMI_calendar_control.x1)
- {
- px1 = MMI_calendar_control.x1;
- }
- }
- if ((py1 + height - 1) > MMI_calendar_control.y2)
- {
- py1 = MMI_calendar_control.y2 - height;
- if (py1 < MMI_calendar_control.y1)
- {
- py1 = MMI_calendar_control.y1;
- }
- }
- px2 = px1 + width - 1;
- py2 = py1 + height - 1;
- gui_reset_clip();
- /* Temporarily disabled pop up bitmap backup since there is no available buffer to use on hardware */
- /* _get_bitmap(px1,py1,px2,py2,&MMI_calendar_control.popup_save_bitmap); */
- MMI_calendar_control.flags |= CALENDAR_POPUP_BACKUP;
- /* fill the color of popup */
- gui_draw_filled_area(px1, py1, px2, py2, (UI_filled_area*)&popup_filler);
- gdi_layer_set_text_clip(px1, py1, px2, py2);
- /* set text color */
- gui_set_text_color(tc);
- y = py1 + 4;
- if (msg1 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w1, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg1);
- y += h1;
- }
- if (msg2 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w2, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg2);
- y += h2;
- }
- if (msg3 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w3, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg3);
- y += h3;
- }
- *wgui_calendar_ppx1 = px1;
- *wgui_calendar_ppy1 = py1;
- *wgui_calendar_ppx2 = px2;
- *wgui_calendar_ppy2 = py2;
- gdi_layer_blt_previous(px1, py1, px2, py2);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_show_calendar_pop_up
- * DESCRIPTION
- * Show calendar popup start time of diosplay popup
- * PARAMETERS
- * day [IN] Highlighted day
- * x1_p [IN] Start x position of popup
- * y1_p [IN] Start y position of popup
- * x2_p [IN] End x position of popup
- * y2_p [IN] End y position of popup
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_show_calendar_pop_up(S32 day, S32 *x1_p, S32 *y1_p, S32 *x2_p, S32 *y2_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_calendar_ppx1 = x1_p;
- wgui_calendar_ppy1 = y1_p;
- wgui_calendar_ppx2 = x2_p;
- wgui_calendar_ppy2 = y2_p;
- wgui_calendar_pp_day = day;
- MMI_calendar_control.flags &= ~CALENDAR_POPUP_BACKUP;
- /* start timer of display popup */
- gui_start_timer(CALENDAR_POPUP_WAIT_TIME, wgui_display_calendar_pop_up);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_setup_calendar
- * DESCRIPTION
- * create calendar ..set the values of calendar control
- * PARAMETERS
- * x [IN] Start x position of calendar
- * y [IN] Start y position of calendar
- * cell_width [IN] One cell width
- * cell_height [IN] One cell height
- * first_dow [IN] First day of month
- * last_day [IN] Last day of month
- * current_day [IN] Current day
- * current_month [IN] Current month
- * current_year [IN] Current year
- * flags [IN] Flags for enable popup
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_setup_calendar(
- S32 x,
- S32 y,
- S32 cell_width,
- S32 cell_height,
- S32 first_dow,
- S32 last_day,
- S32 current_day,
- S32 current_month,
- S32 current_year,
- U32 flags)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* initilize the calendar daya */
- for (i = 0; i < MAX_CALENDAR_DAYS; i++)
- {
- MMI_calendar_days[i] = CALENDAR_NORMAL_DAY;
- }
- /* create calendar */
- gui_create_calendar(&MMI_calendar_control, x, y, CALENDAR_N_COLUMNS, CALENDAR_N_ROWS, cell_width, cell_height);
- MMI_calendar_current_month = current_month;
- MMI_calendar_current_year = current_year;
- /* set the bitmap of calndar */
- #ifdef MMI_ON_HARDWARE_P
- MMI_calendar_control.cursor_save_bitmap.data = (U8*) matrix_main_menu_highlight_bitmap_data;
- #else
- MMI_calendar_control.cursor_save_bitmap.data = (U8*) gui_malloc(cell_width * 16 * (cell_height + 1));
- #endif
- gui_set_calendar_days(&MMI_calendar_control, first_dow, last_day, MMI_calendar_days);
- /* set current day */
- MMI_calendar_highlighted_day = current_day;
- if (MMI_calendar_highlighted_day < 1)
- {
- MMI_calendar_highlighted_day = 1;
- }
- if (MMI_calendar_highlighted_day > last_day)
- {
- MMI_calendar_highlighted_day = last_day;
- }
- /* set function pointer of highlight function */
- MMI_calendar_control.item_highlighted_function = wgui_calendar_control_highlight_handler;
- if (flags & CALENDAR_ENABLE_POPUP) /* check if display popup is enable or not */
- {
- MMI_calendar_control.flags |= CALENDAR_ENABLE_POPUP;
- /* Temporarily disabled pop up bitmap backup since there is no available buffer to use on hardware */
- MMI_calendar_control.display_popup = wgui_show_calendar_pop_up;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_move_calendar
- * DESCRIPTION
- * move calendar to particular x,y position
- * PARAMETERS
- * x [IN] Start x position of calendar
- * y [IN] Start y position of calendar
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_move_calendar(S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_move_calendar(&MMI_calendar_control, x, y);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_reset_calendar_params
- * DESCRIPTION
- * resets calendars to new parameters
- * PARAMETERS
- * x [IN] Start x position of calendar
- * y [IN] Start y position of calendar
- * n_columns [IN] No of columns of calendar
- * n_rows [IN] No of rows of calendar
- * cell_width [IN] Width of each cell of calendar
- * cell_height [IN] Height of each cell of calendar
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_reset_calendar_params(S32 x, S32 y, S32 n_columns, S32 n_rows, S32 cell_width, S32 cell_height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_calendar_control.n_columns = n_columns;
- MMI_calendar_control.n_rows = n_rows;
- MMI_calendar_control.cell_width = cell_width;
- MMI_calendar_control.cell_height = cell_height;
- gui_move_calendar(&MMI_calendar_control, x, y);
- }
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- /*****************************************************************************
- * FUNCTION
- * wgui_set_calendar_info_box
- * DESCRIPTION
- * set calendars info box
- * PARAMETERS
- * InfoBoxX [IN] Start x position of infobox
- * InfoBoxY [IN] Start y position of infobox
- * InfoBoxWidth [IN] Width of info box
- * InfoBoxHeight [IN] Hegiht of infobox
- * InfoBoxMax [IN] Max lines of infobox
- * InfoBoxShow [IN] Flag to decide if show info box or not
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_set_calendar_info_box(
- S32 InfoBoxX,
- S32 InfoBoxY,
- S32 InfoBoxWidth,
- S32 InfoBoxHeight,
- S32 InfoBoxMax,
- U16 InfoBoxShow)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_calendar_control.info_x1 = InfoBoxX;
- MMI_calendar_control.info_y1 = InfoBoxY;
- MMI_calendar_control.info_x2 = InfoBoxX + InfoBoxWidth - 1;
- MMI_calendar_control.info_y2 = InfoBoxY + InfoBoxHeight - 1;
- MMI_calendar_control.max_n_info = InfoBoxMax;
- if (InfoBoxMax)
- {
- MMI_calendar_control.flags |= CALENDAR_SHOW_INFO_BOX;
- }
- else
- {
- MMI_calendar_control.flags &= ~CALENDAR_SHOW_INFO_BOX;
- }
- }
- #endif /* __MMI_UI_CALENDAR_WITH_INFO_BOX__ */
- /*****************************************************************************
- * FUNCTION
- * wgui_show_calendar
- * DESCRIPTION
- * show calendar
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_show_calendar(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* show calendar */
- gui_show_calendar(&MMI_calendar_control);
- MMI_calendar_control.highlighted_item = -1;
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- if (dalmatian_calendar_highlighter_style == DALMATIAN_CALENDAR_HIGHLIGHTER_MOVE_WITH_CURRENT &&
- MMI_calendar_current_month == gdalmatian_current_month && (dalmatian_calendar_highlighter_status() == 1))
- {
- draw_current_week_highlighter(&MMI_calendar_control);
- }
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- /* highlight day of calendar */
- gui_calendar_highlight_day(&MMI_calendar_control, MMI_calendar_highlighted_day);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_close_calendar
- * DESCRIPTION
- * close calndar deallocate the memory allocated by calendar
- * stop the popup timer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_close_calendar(void)
- { /* free memory allocated by calendar bitmap */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* set the calendar highlight handler to dummy func */
- MMI_calendar_control_highlight_handler = UI_dummy_function_s32;
- MMI_calendar_control_update_handler = UI_dummy_function_s32s32s32;
- if (MMI_calendar_control.flags & CALENDAR_ENABLE_POPUP)
- {
- /* Temporarily disabled pop up bitmap backup since there is no available buffer to use on hardware */
- gui_cancel_timer(wgui_display_calendar_pop_up); /* stop the timer */
- }
- calendar_control_background_image = NULL;
- calendar_control_title_image = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_previous_day
- * DESCRIPTION
- * Move highlight to previous day
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_previous_day(void)
- {
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- set_dalmatian_calendar_highlighter_box();
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- gui_calendar_previous_day(&MMI_calendar_control);
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(0, 0, UI_device_width, UI_device_height);
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_next_day
- * DESCRIPTION
- * Move highlight to next day
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_next_day(void)
- {
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- set_dalmatian_calendar_highlighter_box();
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- gui_calendar_next_day(&MMI_calendar_control);
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(0, 0, UI_device_width, UI_device_height);
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_previous_row
- * DESCRIPTION
- * Move highlight to previous row
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_previous_row(void)
- {
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- set_dalmatian_calendar_highlighter_box();
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- gui_calendar_previous_row(&MMI_calendar_control);
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(0, 0, UI_device_width, UI_device_height);
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_next_row
- * DESCRIPTION
- * Move highlight to next row
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_next_row(void)
- {
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- set_dalmatian_calendar_highlighter_box();
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- gui_calendar_next_row(&MMI_calendar_control);
- #ifdef __MMI_UI_DALMATIAN_CALENDAR__
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(0, 0, UI_device_width, UI_device_height);
- #endif /* __MMI_UI_DALMATIAN_CALENDAR__ */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_register_calendar_keys
- * DESCRIPTION
- * register calendar key handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_register_calendar_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_keyboard_key_handler(wgui_calendar_keyboard_key_handler);
- SetKeyHandler(wgui_calendar_previous_day, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_calendar_next_day, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_calendar_previous_row, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_calendar_next_row, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- }
- /* High level functions for use by applications */
- /*****************************************************************************
- * FUNCTION
- * SetCalendarPopupTitleLunarFunc
- * DESCRIPTION
- * set the function pointer of popuptitle of lunar calendar
- * PARAMETERS
- * popuptitle [IN] ) (U8 ,U8 ) a function pointer with 2 U* parmeters
- * RETURNS
- * void
- *****************************************************************************/
- void SetCalendarPopupTitleLunarFunc(void (*popuptitle) (U8, U8, U8, U8))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (popuptitle != NULL)
- {
- MMI_calendar_control.popuptitle_lunarcalendar = popuptitle;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetCalendarMonthFunctions
- * DESCRIPTION
- * Register function pointers of months navigation ofcalendar
- * PARAMETERS
- * month_previous_day [IN] )(void) a function pointer which handle navigation to months previous day
- * month_next_day [IN] )(void) a function pointer which handle navigation to months next day
- * month_previous_week [IN] )(void) a function pointer which handle navigation to months previous week
- * month_next_week [IN] )(void) a function pointer which handle navigation to months next week
- * RETURNS
- * void
- *****************************************************************************/
- void SetCalendarMonthFunctions(
- void (*month_previous_day) (void),
- void (*month_next_day) (void),
- void (*month_previous_week) (void),
- void (*month_next_week) (void))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (month_previous_day != NULL)
- {
- MMI_calendar_control.month_previous_day_function = month_previous_day;
- }
- if (month_next_day != NULL)
- {
- MMI_calendar_control.month_next_day_function = month_next_day;
- }
- if (month_previous_week != NULL)
- {
- MMI_calendar_control.month_previous_week_function = month_previous_week;
- }
- if (month_next_week != NULL)
- {
- MMI_calendar_control.month_next_week_function = month_next_week;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_previous_month
- * DESCRIPTION
- * Side up key handler, go to 1st day of previous month.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_previous_month(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_year != CLNDR_FIRST_NAVI_YEAR || MMI_calendar_current_month != 1)
- {
- MYTIME myTime, incTime, resultTime;;
- memset(&myTime, 0, sizeof(MYTIME));
- memset(&incTime, 0, sizeof(MYTIME));
- myTime.nDay = 1;
- myTime.nMonth = (U8) MMI_calendar_current_month;
- myTime.nYear = MMI_calendar_current_year;
- incTime.nMonth = 1;
- DecrementTime(myTime, incTime, &resultTime);
- MMI_calendar_highlighted_day = resultTime.nDay;
- MMI_calendar_current_month = resultTime.nMonth;
- MMI_calendar_current_year = resultTime.nYear;
- }
- else
- {
- MMI_calendar_highlighted_day = 1;
- MMI_calendar_current_month = 12;
- MMI_calendar_current_year = CLNDR_LAST_NAVI_YEAR;
- }
- wgui_calendar_control_update_handler();
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_next_month
- * DESCRIPTION
- * Side down key handler, go to 1st day of next month.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_next_month(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_year != CLNDR_LAST_NAVI_YEAR || MMI_calendar_current_month != 12)
- {
- MYTIME myTime, incTime, resultTime;;
- memset(&myTime, 0, sizeof(MYTIME));
- memset(&incTime, 0, sizeof(MYTIME));
- myTime.nDay = 1;
- myTime.nMonth = (U8) MMI_calendar_current_month;
- myTime.nYear = MMI_calendar_current_year;
- incTime.nMonth = 1;
- IncrementTime(myTime, incTime, &resultTime);
- MMI_calendar_highlighted_day = resultTime.nDay;
- MMI_calendar_current_month = resultTime.nMonth;
- MMI_calendar_current_year = resultTime.nYear;
- }
- else
- {
- MMI_calendar_highlighted_day = 1;
- MMI_calendar_current_month = 1;
- MMI_calendar_current_year = CLNDR_FIRST_NAVI_YEAR;
- }
- wgui_calendar_control_update_handler();
- }
- #if defined (__MMI_TOUCH_SCREEN__) && defined (__MMI_UI_CALENDAR_WITH_INFO_BOX__)
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_previous_year
- * DESCRIPTION
- * Side up key handler, go to 1st day of previous year.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_previous_year(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_year != CLNDR_FIRST_NAVI_YEAR)
- {
- MYTIME myTime, incTime, resultTime;;
- memset(&myTime, 0, sizeof(MYTIME));
- memset(&incTime, 0, sizeof(MYTIME));
- myTime.nDay = 1;
- myTime.nMonth = (U8)MMI_calendar_current_month;
- myTime.nYear = MMI_calendar_current_year;
- incTime.nYear = 1;
- DecrementTime(myTime, incTime, &resultTime);
- MMI_calendar_highlighted_day = resultTime.nDay;
- MMI_calendar_current_month = resultTime.nMonth;
- MMI_calendar_current_year = resultTime.nYear;
- }
- else
- {
- MMI_calendar_highlighted_day = 1;
- MMI_calendar_current_year = CLNDR_LAST_NAVI_YEAR;
- }
- wgui_calendar_control_update_handler();
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_next_year
- * DESCRIPTION
- * Side down key handler, go to 1st day of next year.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_next_year(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_year != CLNDR_LAST_NAVI_YEAR)
- {
- MYTIME myTime, incTime, resultTime;;
- memset(&myTime, 0, sizeof(MYTIME));
- memset(&incTime, 0, sizeof(MYTIME));
- myTime.nDay = 1;
- myTime.nMonth = (U8)MMI_calendar_current_month;
- myTime.nYear = MMI_calendar_current_year;
- incTime.nYear = 1;
- IncrementTime(myTime, incTime, &resultTime);
- MMI_calendar_highlighted_day = resultTime.nDay;
- MMI_calendar_current_month = resultTime.nMonth;
- MMI_calendar_current_year = resultTime.nYear;
- }
- else
- {
- MMI_calendar_highlighted_day = 1;
- MMI_calendar_current_year = CLNDR_FIRST_NAVI_YEAR;
- }
- wgui_calendar_control_update_handler();
- }
- #endif /* defined (__MMI_TOUCH_SCREEN__) && defined (__MMI_UI_CALENDAR_WITH_INFO_BOX__) */
- /*****************************************************************************
- * FUNCTION
- * wgui_calendar_next_month_day
- * DESCRIPTION
- * Side down key handler, go to 1st day of next month.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_next_month_day(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_calendar_current_year != CLNDR_LAST_NAVI_YEAR || MMI_calendar_current_month != 12)
- {
- MYTIME myTime, incTime, resultTime;