4
Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
4
Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
6
6
This program is free software; you can redistribute it and/or modify it
7
7
under the terms of the GNU General Public License as published by the
30
30
#define __PTB_FRAME_AUDIO_HPP__
32
32
#include "ptb/frame/frame.hpp"
33
#include "ptb/frame/button.hpp"
34
#include "gui/checkbox.hpp"
35
#include "gui/picture.hpp"
36
33
#include "gui/slider.hpp"
37
#include "gui/static_text.hpp"
49
/** \brief The control next to the cursor. */
56
}; // enum cursor_position
58
typedef button< bear::gui::static_text,
59
std::mem_fun_t<bool, frame_audio> > button_with_text;
61
/** \brief Callback called when the value of a volume slider changed. */
62
class volume_changed_callback:
63
public bear::gui::callback
66
volume_changed_callback( frame_audio& owner );
68
void execute( bear::gui::visual_component& control );
71
/** \brief The frame owning the control. */
74
}; // class volume_changed_callback
77
45
frame_audio( windows_layer* in_layer );
82
bool on_key_press( const bear::input::key_info& key );
83
bool on_button_press( bear::input::joystick::joy_code button,
84
unsigned int joy_index );
85
bool on_mouse_press( bear::input::mouse::mouse_code key,
86
const claw::math::coordinate_2d<unsigned int>& pos );
87
bool on_mouse_move( const claw::math::coordinate_2d<unsigned int>& pos );
91
50
void create_controls();
92
void create_checkboxes( bear::gui::static_text::font_type f );
93
void create_sliders();
94
void create_ok_cancel( bear::gui::static_text::font_type f );
51
bear::gui::visual_component* create_music_checkbox( bear::visual::font f );
52
bear::gui::visual_component* create_sound_checkbox( bear::visual::font f );
53
bear::gui::visual_component* create_music_slider();
54
bear::gui::visual_component* create_sound_slider();
55
bear::gui::visual_component* create_ok_button( bear::visual::font f );
56
bear::gui::visual_component* create_cancel_button( bear::visual::font f );
105
void position_cursor();
108
64
/* \brief The sound 'mute' status when the frame was shown. */
117
73
/* \brief The music volume when the frame was shown. */
118
74
const double m_saved_music_volume;
120
/** \brief The cursor. */
121
bear::gui::picture* m_cursor;
123
/** \brief The sound "Mute" checkbox. */
124
bear::gui::checkbox* m_sound_muted;
126
/** \brief The music "Mute" checkbox. */
127
bear::gui::checkbox* m_music_muted;
129
/** \brief The "Ok" button. */
130
button_with_text* m_ok;
132
/** \brief 'Cancel' button. */
133
button_with_text* m_cancel;
135
76
/** \brief Slider to control the volume of the sounds. */
136
77
bear::gui::slider<double>* m_sound_volume;
138
79
/** \brief Slider to control the volume of the music. */
139
80
bear::gui::slider<double>* m_music_volume;
141
/** \brief The position of the cursor. */
142
cursor_position m_cursor_position;
144
/** \brief The size of the margins between controls. */
145
static const unsigned int s_margin;
147
82
}; // class frame_audio
148
83
} // namespace ptb