summaryrefslogtreecommitdiffstats
path: root/menu_demo/button.h
blob: 454b77ef6b7d027bfa2b6101b5005bd143d77cea (plain)
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
#ifndef _CBUTTON_H
#define _CBUTTON_H

#include "bitmap.h"

#define BUTTON_MAX_TITLE 256
#define BUTTON_MAX_IMGS  3
#define BUTTON_CLICK_HEIGHT 49

struct ButtonStruct {
  int m_dXPos;        // x positie
  int m_dYPos;        // y positie
  int m_dCenterWidth; // breedte van middenstuk
  int m_dWidth;       // totale breedte
  int m_dHeight;      // totale hoogte
  int m_bPressed;     // pressed or not
  int m_bHover;       // mouse hovering or not
  int m_iType;        // button type

  // button caption/title
  char m_pcTitle[BUTTON_MAX_TITLE];

  // button images
  struct BitmapStruct m_piImgNormal[BUTTON_MAX_IMGS];
  struct BitmapStruct m_piImgHover[BUTTON_MAX_IMGS];
  struct BitmapStruct m_piImgPressed[BUTTON_MAX_IMGS];
};

enum ButtonType {
  BUTTON_CLICK,
  BUTTON_RADIO,
  BUTTON_LABEL
};

struct ButtonStruct ButtonCreate(int f_dXPos, int f_dYPos, int f_dCenterWidth, int f_dHeight, char *f_pcTitle, int f_iType);
int ButtonGetType(struct ButtonStruct *f_sButton);
void ButtonRender(struct ButtonStruct *f_sButton);
void ButtonEnter(struct ButtonStruct *f_sButton);
void ButtonExit(struct ButtonStruct *f_sButton);
void ButtonPress(struct ButtonStruct *f_sButton);
void ButtonRelease(struct ButtonStruct *f_sButton);

#endif