| 1 |
|
| 2 |
#ifndef header_button_style_zz |
| 3 |
#define header_button_style_zz |
| 4 |
|
| 5 |
#if _MSC_VER > 1000 |
| 6 |
#pragma once |
| 7 |
#endif |
| 8 |
|
| 9 |
#include <ClanLib/gui.h> |
| 10 |
#include <ClanLib/core.h> |
| 11 |
#include <ClanLib/display.h> |
| 12 |
|
| 13 |
class CL_Button; |
| 14 |
class CL_StyleManager_ZZ; |
| 15 |
class CL_ResourceManager; |
| 16 |
class CL_Font; |
| 17 |
class CL_DomElement; |
| 18 |
|
| 19 |
class CL_Button_ZZ : public CL_ComponentStyle |
| 20 |
{ |
| 21 |
public: |
| 22 |
enum ButtonType { |
| 23 |
type_text, |
| 24 |
type_bitmap |
| 25 |
}; |
| 26 |
enum ButtonSize { |
| 27 |
size_normal, |
| 28 |
size_big |
| 29 |
}; |
| 30 |
public: |
| 31 |
CL_Button_ZZ( |
| 32 |
CL_Button *button, |
| 33 |
CL_StyleManager_ZZ *style, ButtonType btn_type = type_text, |
| 34 |
ButtonSize = size_normal); |
| 35 |
|
| 36 |
virtual ~CL_Button_ZZ(); |
| 37 |
public: |
| 38 |
void set_button_type(ButtonType const button_type); |
| 39 |
void set_button_size(ButtonSize const button_size); |
| 40 |
|
| 41 |
void set_font(CL_Font * font); |
| 42 |
void set_surface_up(CL_Surface * surface); |
| 43 |
void set_surface_down(CL_Surface * surface); |
| 44 |
void set_surface_highlighted(CL_Surface * surface); |
| 45 |
void set_surface_disabled(CL_Surface * surface); |
| 46 |
void set_surfaces(CL_Surface * surface_up, |
| 47 |
CL_Surface * surface_down, |
| 48 |
CL_Surface * surface_highlighted, |
| 49 |
CL_Surface * surface_disabled); |
| 50 |
private: |
| 51 |
void on_paint(); |
| 52 |
void on_paint_texture(); |
| 53 |
void on_paint_anim(); |
| 54 |
|
| 55 |
void on_mouse_enter(); |
| 56 |
void on_mouse_leave(); |
| 57 |
void on_pressed(); |
| 58 |
void on_released(); |
| 59 |
void on_set_options(const CL_DomElement &options); |
| 60 |
|
| 61 |
void on_get_preferred_size(CL_Size &size); |
| 62 |
void on_timer(); |
| 63 |
|
| 64 |
private: |
| 65 |
CL_Button *button_; |
| 66 |
ButtonType button_type_; |
| 67 |
ButtonSize button_size_; |
| 68 |
|
| 69 |
// Button state |
| 70 |
bool highlighted_; |
| 71 |
bool down_; |
| 72 |
|
| 73 |
// Highlight relaited |
| 74 |
int highlight_modifier_; |
| 75 |
bool highlighting_direction_; |
| 76 |
|
| 77 |
CL_Timer timer_; |
| 78 |
CL_Color clr_font_; |
| 79 |
|
| 80 |
CL_StyleManager_ZZ *style_; |
| 81 |
CL_ResourceManager *resources_; |
| 82 |
|
| 83 |
CL_Font *font_; |
| 84 |
|
| 85 |
CL_Surface *surface_up_; |
| 86 |
CL_Surface *surface_down_; |
| 87 |
CL_Surface *surface_highlighted_; |
| 88 |
CL_Surface *surface_disabled_; |
| 89 |
|
| 90 |
CL_SlotContainer slots_; |
| 91 |
}; |
| 92 |
|
| 93 |
#endif |