mcu_hi3321_watch/tjd/ui/app/female_health/TjdUiFemaleCalenderPage.h
2025-05-26 20:15:20 +08:00

80 lines
2.5 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description:
*
* Author: huangshuyi
*
* Create: 2024-8
*--------------------------------------------------------------------------*/
#ifndef TJDUI_FEMALE_CALENDER_PAGE_H
#define TJDUI_FEMALE_CALENDER_PAGE_H
#include <string>
#include <time.h>
#include "components/ui_view_group.h"
#include "View.h"
#include "components/ui_label.h"
#include "components/root_view.h"
#include "components/ui_view_group.h"
#include "components/ui_image_view.h"
#include "components/ui_label_button.h"
#include "components/abstract_adapter.h"
#include "components/ui_scroll_view.h"
#include "font/ui_font_bitmap.h"
#include "font/ui_font.h"
#include "graphic_config.h"
#include "animator/animator_manager.h"
#include "time.h"
#include "sys/time.h"
#include "sql_message.h"
#include "TjdUiScreenDrag.h"
#define MAX_DAYS_OF_MONTH 31
namespace TJD {
class TjdUiFemaleCalenderPage : public TjdUiScreenDragListener, public OHOS::UIView::OnClickListener
{
public:
struct CurrentDateInfo {
uint8_t day;
uint8_t month;
uint16_t year;
};
//static const int MAX_DAYS_OF_MONTH = 31;
TjdUiFemaleCalenderPage();
virtual ~TjdUiFemaleCalenderPage();
static TjdUiFemaleCalenderPage *GetInstance(void);
OHOS::UIViewGroup *PageInit(void);
bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override;
void ShowView(void);
void HideView(void);
private:
bool g_pv_isExit_{true};
int16_t dragStartX_{0};
int16_t dragCurrentX_{0};
int32_t dragDistance_{0};
uint8_t daysInMonth = 0;//记录当前月有多少天
uint8_t weekDaysOfMonth = 0;//记录当前月第一天是星期几
OHOS::UIImageView* iconLeft_{nullptr};
OHOS::UIImageView* iconRight_{nullptr};
OHOS::UIImageView* imageRetry_{nullptr};
OHOS::UIViewGroup* pageGroup_{nullptr};
OHOS::UIImageView* curWeekday_{nullptr};
OHOS::UILabel* labelMonth_{nullptr};
CurrentDateInfo curDateInfo;
//OHOS::UILabel* CalendarLabel[MAX_DAYS_OF_MONTH];
OHOS::UIViewGroup* CalendarGroup[MAX_DAYS_OF_MONTH];
OHOS::UILabel* CalendarLabel[MAX_DAYS_OF_MONTH];
OHOS::UIImageView* CalendarImage[MAX_DAYS_OF_MONTH];
uint8_t lastMonth_;
uint16_t lastYear_;
uint8_t GetDaysOfCurrentMonth(uint8_t month, uint16_t year);
int GetDaysOfCurrentWeek(int year, int month, int day);
void UpdateInfo(CurrentDateInfo curDateInfo, uint8_t month, uint16_t year);
}; // namespace OHOS
}
#endif