1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00
planetblupi/src/button.h

66 lines
1.6 KiB
C
Raw Normal View History

2017-01-21 17:27:46 +01:00
2017-01-21 23:44:30 +01:00
#pragma once
2017-01-21 17:27:46 +01:00
2017-02-08 22:50:19 +01:00
#include <vector>
2017-01-21 17:27:46 +01:00
class CButton
{
public:
CButton();
~CButton();
2017-01-21 17:27:46 +01:00
bool Create (CPixmap *pPixmap, CSound *pSound,
POINT pos, Sint32 type,
Sint32 *pMenu, Sint32 nbMenu,
const char **pToolTips,
Sint32 region, Uint32 message);
void Draw();
Sint32 GetState();
void SetState (Sint32 state);
2017-01-21 17:27:46 +01:00
Sint32 GetMenu();
void SetMenu (Sint32 menu);
2017-01-21 17:27:46 +01:00
bool GetEnable();
void SetEnable (bool bEnable);
2017-01-21 17:27:46 +01:00
bool GetHide();
void SetHide (bool bHide);
2017-01-21 17:27:46 +01:00
bool TreatEvent (const SDL_Event &event);
bool MouseOnButton (POINT pos);
const char *GetToolTips (POINT pos);
2017-01-21 17:27:46 +01:00
protected:
bool Detect (POINT pos);
bool MouseDown (POINT pos);
bool MouseMove (POINT pos);
bool MouseUp (POINT pos);
2017-01-21 17:27:46 +01:00
protected:
CPixmap *m_pPixmap;
CDecor *m_pDecor;
CSound *m_pSound;
Sint32 m_type; // type de bouton
bool m_bEnable; // true si bouton actif
bool m_bHide; // true si bouton caché
Uint32 m_message; // message envoyé si bouton actionné
POINT m_pos; // coin sup/gauche
POINT m_dim; // dimensions
Sint32 m_state; // 0=relâché, 1=pressé, +2=survollé
Sint32 m_mouseState; // 0=relâché, 1=pressé, +2=survollé
Sint32 m_iconMenu[20]; // icônes du sous-menu
2017-01-21 17:27:46 +01:00
const char **m_toolTips; // info-bulles
Sint32 m_nbMenu; // nb de case du sous-menu
Sint32 m_nbToolTips; // nb d'info-bulles
Sint32 m_selMenu; // sous-menu sélectionné
bool m_bMouseDown; // true -> bouton souris pressé
};