"AI生成"
This commit is contained in:
parent
f3e1eba561
commit
05bc5e94e6
|
@ -7,6 +7,7 @@
|
|||
#include "page.h" // 调用头文件
|
||||
u8 iconname1[][20] = {"address", "camera", "cart", "controller", "location", "music", "picture", "search", "time", "wifi", "table", "barchart"};
|
||||
u32 iconflag1 = 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);
|
||||
|
@ -30,22 +31,28 @@ HWND enter_to_page1() {
|
|||
// 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);
|
||||
|
||||
// Create the clock control at the top-left (150x150)
|
||||
wjh_GetClockControl(main_window, 150, 100);
|
||||
// Create the clock control at the center of the screen
|
||||
int clock_width = 340;
|
||||
int clock_height = 70;
|
||||
int clock_x = (1024 - clock_width) / 2;
|
||||
int clock_y = (600 - clock_height) / 2;
|
||||
wjh_GetClockControl(main_window, clock_x, clock_y);
|
||||
|
||||
// Adjusted positions for icon buttons to ensure even spacing
|
||||
// Adjusted positions for icon buttons
|
||||
int icon_size = 90; // Button size adjusted to 90x90
|
||||
int spacing_x = 60; // Horizontal spacing between buttons
|
||||
int spacing_y = 50; // Vertical spacing between buttons
|
||||
int x_start = 150; // Start position adjusted to reduce left-side crowding
|
||||
int y_start = 250; // Buttons are positioned lower on the screen
|
||||
int spacing_x = (1024 - 5 * icon_size - 4 * 60) / 2; // Horizontal spacing to center the buttons
|
||||
int spacing_y = 20; // Vertical spacing between buttons
|
||||
int x_start = spacing_x;
|
||||
int y_start_upper = clock_y - icon_size - spacing_y; // Upper row start position
|
||||
int y_start_lower = clock_y + clock_height + spacing_y; // Lower row start position
|
||||
|
||||
// Create 10 icon buttons in 2 rows and 5 columns
|
||||
for (int i = 0; i < 2; ++i) { // 2 rows
|
||||
int y_start = (i == 0) ? y_start_upper : y_start_lower;
|
||||
for (int j = 0; j < 5; ++j) { // 5 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),
|
||||
wjh_createButton(button_name, BS_NORMAL | WS_UNFILL, x_start + j * (icon_size + spacing_x), y_start,
|
||||
icon_size, icon_size, main_window, page_button_paint, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -63,82 +70,64 @@ static bool_t main_window_paint(struct WindowMsg *pMsg) {
|
|||
return false;
|
||||
wjh_setBackBmp(pMsg->hwnd, wjh_Search_BMP("background1"));
|
||||
|
||||
//通过画圆来记录当前页面,这段代码不要动,颜色也不要改
|
||||
// Draw circles to indicate the current page
|
||||
GDD_SetDrawColor(hdc, RGB(200, 200, 200));
|
||||
GDD_FillCircle(hdc, 487, 570, 5);
|
||||
GDD_SetDrawColor(hdc, RGB(125, 125, 125));
|
||||
GDD_FillCircle(hdc, 507, 570, 5);
|
||||
GDD_FillCircle(hdc, 527, 570, 5);
|
||||
|
||||
|
||||
GDD_EndPaint(hwnd, hdc);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Paint handlers for the left page button
|
||||
static bool_t left_page_button_paint(struct WindowMsg *pMsg) {
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
hwnd = pMsg->hwnd;
|
||||
if (hwnd == NULL) return false;
|
||||
hdc = GDD_BeginPaint(hwnd);
|
||||
HWND hwnd = pMsg->hwnd;
|
||||
HDC 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;
|
||||
RECT rect;
|
||||
hwnd = pMsg->hwnd;
|
||||
if (hwnd == NULL) return false;
|
||||
hdc = GDD_BeginPaint(hwnd);
|
||||
HWND hwnd = pMsg->hwnd;
|
||||
HDC hdc = GDD_BeginPaint(hwnd);
|
||||
if (hdc == NULL) return false;
|
||||
|
||||
wjh_setBackBmp(hwnd, wjh_Search_BMP("turn_right"));
|
||||
|
||||
GDD_EndPaint(hwnd, hdc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool_t page_button_paint(struct WindowMsg *pMsg) {
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
hwnd = pMsg->hwnd;
|
||||
if (hwnd == NULL) return false;
|
||||
hdc = GDD_BeginPaint(hwnd);
|
||||
HWND hwnd = pMsg->hwnd;
|
||||
HDC hdc = GDD_BeginPaint(hwnd);
|
||||
if (hdc == NULL) return false;
|
||||
|
||||
wjh_setBackBmp(hwnd, wjh_Search_BMP("button1_background"));
|
||||
wjh_setBackBmpHyaline(hwnd, wjh_Search_ICONBMP(iconname1[(iconflag1++)%12]));
|
||||
wjh_setBackBmpHyaline(hwnd, wjh_Search_ICONBMP(iconname1[(iconflag1++) % 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_page3(); // Example of navigating to page3
|
||||
enter_to_page3(); // Navigate to page3
|
||||
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
|
||||
HWND hwnd = GDD_GetWindowParent(pMsg->hwnd);
|
||||
wjh_deleteWindow(hwnd);
|
||||
|
||||
enter_to_page2(); // Example of navigating to page2
|
||||
enter_to_page2(); // Navigate to page2
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user