-
Notifications
You must be signed in to change notification settings - Fork 0
/
Button.h
60 lines (52 loc) · 1.83 KB
/
Button.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef BUTTON_H
#define BUTTON_H
#include "Global.h"
enum Type{menu = 0, action = 1, song = 2, others = 3};
struct Button{
enum Type buttonType;
struct Frame* Panel;
struct Range* range;
int id;
int type, bg_color, frame;
int x_pos, y_pos;
int isClicked, startAnimate;
char* name;
struct Image* stats[2]; // show diff image when clicked
void (*draw)(struct Button*);
void (*collide) (struct Button*);
};
struct Button* initButton();
struct Button* initMenuButton(int, char*, int, struct Frame*);
struct Button* initSongButton(int, int, char*, int, struct Frame*);
struct Button* initPlaylistButton(int, int, char*, int, struct Frame*);
struct Button* initActionButton(int, struct Frame*);
struct Button* initScrollButton(int, int, int, struct Frame*);
struct Button* initVolumeButton(int, int, int, struct Frame*);
void drawTxtButton(struct Button*);
void drawActionButton(struct Button*);
void dummyDraw(struct Button*);
void menuButtonCollide(struct Button*);
void playlistMenuButtonCollide(struct Button*);
void allSongsMenuButtonCollide(struct Button*);
void actionButtonCollide(struct Button*);
void playButtonCollide(struct Button*);
void stopButtonCollide(struct Button*);
void pauseButtonCollide(struct Button*);
void prevButtonCollide(struct Button*);
void nextButtonCollide(struct Button*);
void volumeButtonCollide(struct Button*);
void dummyCollide(struct Button*);
void songButtonCollide(struct Button*);
void playlistButtonCollide(struct Button*);
void highlightButton(struct Button*);
void highlightSongWithID(int);
// helper functions
int getXActionBtn(int);
int getYActionBtn(int);
void drawRange(struct Button*);
void animateButton(struct Button*, int);
void updateVolumeValue(int);
struct Button* querySongButtonFromID(int);
void playSongsFromSongPanel(int, int, int);
void killSongButton(struct Button**);
#endif /* BUTTON_H_ */