Files
player/Project/Src/MyWin/Window/mywin_scrollbar.h

58 lines
1.5 KiB
C
Raw Normal View History

2025-06-27 00:32:57 +08:00
#ifndef MYWIN_SCROLLBAR_H__
#define MYWIN_SCROLLBAR_H__
#define SCROLLBAR_ITEM_MAXLEN 20
2025-07-06 18:46:13 +08:00
// <20><><EFBFBD><EFBFBD><E5B0B4><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>Ϣ
#define SCROLLBAR_PRESSED 0x00000001
typedef struct {
char *pic_path;
char txt[SCROLLBAR_ITEM_MAXLEN];
} Scrollbar_ItemStruct;
typedef struct {
WIN_WindowStruct win;
int index;
Scrollbar_ItemStruct *items;
int itemMaxNum;
int itemNum;
int y_step;
int y_offset;
uint32_t color_light;
uint32_t color_dark;
2025-07-06 18:46:13 +08:00
int x_inertia; // x<><78><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
int y_inertia; // y<><79><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
int num_inertia; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
int timer_inertia; // <20><><EFBFBD>Զ<EFBFBD>ʱ<EFBFBD><CAB1>
} WIN_ScrollbarStruct;
WIN_ScrollbarStruct *WIN_CreatScrollbar(
WIN_WindowStruct *base,
void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg), int x,
int y, int x_size, int y_size);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>
void SCROLLBAR_SetItemNum(WIN_ScrollbarStruct *bar, int itemNum);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
void SCROLLBAR_AddItem(WIN_ScrollbarStruct *bar, char *item, char *pic_path);
// Ĭ<>ϻ<EFBFBD><CFBB>ƺ<EFBFBD><C6BA><EFBFBD>
void SCROLLBAR_DefaultPaint(WIN_ScrollbarStruct *bar);
// Ĭ<><C4AC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void SCROLLBAR_DefaultMsgLoop(WIN_ScrollbarStruct *bar, WIN_MsgStruct *msg);
// <20><>ָ<EFBFBD><D6B8>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>˵<EFBFBD>
WIN_ScrollbarStruct *SCROLLBAR_SelectItem(WIN_WindowStruct *base, char **item,
int itemNum, int x, int y, int x_size,
int y_size);
WIN_ScrollbarStruct *SCROLLBAR_SelectNum(WIN_WindowStruct *base, int min,
int max, int x, int y, int x_size,
int y_size);
2025-06-27 00:32:57 +08:00
#endif