#include "stdint.h" #include "stddef.h" #include "stdio.h" #include "gdd.h" #include "gdd_button.h" #include "wjh_window.h" #include "page.h" // 调用头文件 #include "time.h" // 用于获取当前时间 #include "TimeEdit.h" u8 iconname2[][20] = {"address", "camera", "cart", "controller", "location", "music", "picture", "search", "time", "wifi", "table", "barchart"}; u32 iconflag2 = 0; // Button click and paint handlers static bool_t left_page_button_paint(struct WindowMsg *pMsg); static bool_t right_page_button_paint(struct WindowMsg *pMsg); static bool_t page_button_paint(struct WindowMsg *pMsg); static bool_t main_window_paint(struct WindowMsg *pMsg); static bool_t left_page_button_click(struct WindowMsg *pMsg); static bool_t right_page_button_click(struct WindowMsg *pMsg); // Implementation of the calendar and button layout page HWND enter_to_page2() { // Create the main window (1024x600) HWND main_window = wjh_createWindow( "calendar_page_window", 0, 0, 1024, 600, CN_WINBUF_PARENT, 0, CN_SYS_PF_DISPLAY, RGB(255, 255, 255), GDD_GetDesktopWindow(NULL), main_window_paint, NULL ); // Create the left page button (50x50) wjh_createButton("left_page_button", BS_NORMAL | WS_UNFILL, 20, 275, 50, 50, main_window, left_page_button_paint, left_page_button_click); // Create the right page button (50x50) wjh_createButton("right_page_button", BS_NORMAL | WS_UNFILL, 954, 275, 50, 50, main_window, right_page_button_paint, right_page_button_click); // Calendar control RECT rect = {100, 120, 520, 480}; TimeEditbutton_Create(main_window, rect); // Adjusted positions for icon buttons (aligned to the right) int icon_size = 90; // Button size adjusted to 90x90 int spacing_x = 40; // Horizontal spacing between buttons int spacing_y = 40; // Vertical spacing between buttons int x_start = 600; // Right-aligned start position int y_start = 190; // Buttons positioned lower on the screen // Create 6 icon buttons in 2 rows and 3 columns for (int i = 0; i < 2; ++i) { // 2 rows for (int j = 0; j < 3; ++j) { // 3 columns char button_name[20]; sprintf(button_name, "icon_button_%d_%d", i, j); wjh_createButton(button_name, BS_NORMAL | WS_UNFILL, x_start + j * (icon_size + spacing_x), y_start + i * (icon_size + spacing_y), icon_size, icon_size, main_window, page_button_paint, NULL); } } return main_window; } // Paint handlers for the main window static bool_t main_window_paint(struct WindowMsg *pMsg) { wjh_setBackBmp(pMsg->hwnd, wjh_Search_BMP("background1")); return true; } // Paint handlers for the left page button static bool_t left_page_button_paint(struct WindowMsg *pMsg) { HWND hwnd; HDC hdc; hwnd = pMsg->hwnd; if (hwnd == NULL) return false; hdc = GDD_BeginPaint(hwnd); if (hdc == NULL) return false; wjh_setBackBmp(hwnd, wjh_Search_BMP("turn_left")); GDD_EndPaint(hwnd, hdc); return true; } // Paint handlers for the right page button static bool_t right_page_button_paint(struct WindowMsg *pMsg) { HWND hwnd; HDC hdc; hwnd = pMsg->hwnd; if (hwnd == NULL) return false; hdc = GDD_BeginPaint(hwnd); if (hdc == NULL) return false; wjh_setBackBmp(hwnd, wjh_Search_BMP("turn_right")); GDD_EndPaint(hwnd, hdc); return true; } // Paint handlers for the icon buttons static bool_t page_button_paint(struct WindowMsg *pMsg) { HWND hwnd; HDC hdc; hwnd = pMsg->hwnd; if (hwnd == NULL) return false; hdc = GDD_BeginPaint(hwnd); if (hdc == NULL) return false; wjh_setBackBmp(hwnd, wjh_Search_BMP("button1_background")); wjh_setBackBmpHyaline(hwnd, wjh_Search_ICONBMP(iconname2[(iconflag2++)%12])); GDD_EndPaint(hwnd, hdc); return true; } // Click handlers for the left page button static bool_t left_page_button_click(struct WindowMsg *pMsg) { // Logic for navigating to the previous page wjh_deleteWindow(GDD_GetWindowParent(pMsg->hwnd)); enter_to_page1(); // Example of navigating to page1 return true; } // Click handlers for the right page button static bool_t right_page_button_click(struct WindowMsg *pMsg) { // Logic for navigating to the next page wjh_deleteWindow(GDD_GetWindowParent(pMsg->hwnd)); enter_to_page3(); // Example of navigating to page3 return true; }