1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 
6 enum // SCROLLBARS
7 {
8 	// reserved
9 	SB_RES_1,
10 	SB_RES_2,
11 	SB_RES_3,
12 
13 	SB_POS_ED,
14 	SB_SAMPLE_LIST,
15 	SB_CHAN_SCROLL,
16 	SB_HELP_SCROLL,
17 	SB_SAMP_SCROLL,
18 
19 	// Instrument Editor
20 	SB_INST_VOL,
21 	SB_INST_PAN,
22 	SB_INST_FTUNE,
23 	SB_INST_FADEOUT,
24 	SB_INST_VIBSPEED,
25 	SB_INST_VIBDEPTH,
26 	SB_INST_VIBSWEEP,
27 
28 	// Instrument Editor Extension
29 	SB_INST_EXT_MIDI_CH,
30 	SB_INST_EXT_MIDI_PRG,
31 	SB_INST_EXT_MIDI_BEND,
32 
33 	// Config I/O devices
34 	SB_AUDIO_OUTPUT_SCROLL,
35 	SB_AUDIO_INPUT_SCROLL,
36 	SB_AMP_SCROLL,
37 	SB_MASTERVOL_SCROLL,
38 
39 	// Config Layout
40 	SB_PAL_R,
41 	SB_PAL_G,
42 	SB_PAL_B,
43 	SB_PAL_CONTRAST,
44 
45 	// Config Miscellaneous
46 	SB_MIDI_SENS,
47 
48 #ifdef HAS_MIDI
49 	// Config Midi
50 	SB_MIDI_INPUT_SCROLL,
51 #endif
52 
53 	// Disk Op.
54 	SB_DISKOP_LIST,
55 
56 	NUM_SCROLLBARS
57 };
58 
59 enum
60 {
61 	SCROLLBAR_UNPRESSED = 0,
62 	SCROLLBAR_PRESSED = 1,
63 	SCROLLBAR_HORIZONTAL = 0,
64 	SCROLLBAR_VERTICAL = 1,
65 	SCROLLBAR_THUMB_NOFLAT = 0,
66 	SCROLLBAR_THUMB_FLAT = 1
67 };
68 
69 typedef struct scrollBar_t // DO NOT TOUCH!
70 {
71 	uint16_t x, y, w, h;
72 	uint8_t type, thumbType;
73 	void (*callbackFunc)(uint32_t pos);
74 
75 	bool visible;
76 	uint8_t state;
77 	uint32_t pos, page, end;
78 	uint16_t thumbX, thumbY, thumbW, thumbH, realThumbLength;
79 } scrollBar_t;
80 
81 void drawScrollBar(uint16_t scrollBarID);
82 void showScrollBar(uint16_t scrollBarID);
83 void hideScrollBar(uint16_t scrollBarID);
84 void scrollBarScrollUp(uint16_t scrollBarID, uint32_t amount);
85 void scrollBarScrollDown(uint16_t scrollBarID, uint32_t amount);
86 void scrollBarScrollLeft(uint16_t scrollBarID, uint32_t amount);
87 void scrollBarScrollRight(uint16_t scrollBarID, uint32_t amount);
88 void setScrollBarPos(uint16_t scrollBarID, uint32_t pos, bool triggerCallBack);
89 uint32_t getScrollBarPos(uint16_t scrollBarID);
90 void setScrollBarEnd(uint16_t scrollBarID, uint32_t end);
91 void setScrollBarPageLength(uint16_t scrollBarID, uint32_t pageLength);
92 bool testScrollBarMouseDown(void);
93 void testScrollBarMouseRelease(void);
94 void handleScrollBarsWhileMouseDown(void);
95 void initializeScrollBars(void);
96