2024-08-22 22:13:20 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ͼ<>갴ť<EAB0B4><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>ť
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ TimeEditbutton_Create(main_window, rect)<29><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-20 19:34:19 +08:00
|
|
|
|
#include "stdint.h"
|
|
|
|
|
|
#include "stddef.h"
|
|
|
|
|
|
#include "stdio.h"
|
|
|
|
|
|
#include "gdd.h"
|
|
|
|
|
|
#include "gdd_button.h"
|
|
|
|
|
|
#include "wjh_window.h"
|
|
|
|
|
|
#include "page.h" // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
#include "time.h" // <20><><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
#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) {
|
2024-08-22 22:13:20 +08:00
|
|
|
|
HWND hwnd = pMsg->hwnd;
|
|
|
|
|
|
if(hwnd == NULL)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
HDC hdc = GDD_BeginPaint(hwnd);
|
|
|
|
|
|
if(hdc == NULL)
|
|
|
|
|
|
return false;
|
2024-08-20 19:34:19 +08:00
|
|
|
|
wjh_setBackBmp(pMsg->hwnd, wjh_Search_BMP("background1"));
|
2024-08-22 22:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ǰҳ<C7B0><D2B3>
|
|
|
|
|
|
GDD_SetDrawColor(hdc, RGB(200, 200, 200));
|
|
|
|
|
|
GDD_FillCircle(hdc, 507, 570, 5);
|
|
|
|
|
|
GDD_SetDrawColor(hdc, RGB(125, 125, 125));
|
|
|
|
|
|
GDD_FillCircle(hdc, 487, 570, 5);
|
|
|
|
|
|
GDD_FillCircle(hdc, 527, 570, 5);
|
|
|
|
|
|
|
|
|
|
|
|
GDD_EndPaint(hwnd, hdc);
|
2024-08-20 19:34:19 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|