~ubuntu-branches/ubuntu/natty/plee-the-bear/natty

« back to all changes in this revision

Viewing changes to plee-the-bear/src/ptb/frame/frame_audio.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
  Plee the Bear
3
3
 
4
 
  Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
  Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
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__
31
31
 
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"
38
34
 
39
35
namespace ptb
40
36
{
45
41
  class frame_audio:
46
42
    public frame
47
43
  {
48
 
  private:
49
 
    /** \brief The control next to the cursor. */
50
 
    enum cursor_position
51
 
      {
52
 
        cursor_sound,
53
 
        cursor_music,
54
 
        cursor_ok,
55
 
        cursor_cancel
56
 
      }; // enum cursor_position
57
 
 
58
 
    typedef button< bear::gui::static_text,
59
 
                    std::mem_fun_t<bool, frame_audio> > button_with_text;
60
 
 
61
 
    /** \brief Callback called when the value of a volume slider changed. */
62
 
    class volume_changed_callback:
63
 
      public bear::gui::callback
64
 
    {
65
 
    public:
66
 
      volume_changed_callback( frame_audio& owner );
67
 
 
68
 
      void execute( bear::gui::visual_component& control );
69
 
 
70
 
    private:
71
 
      /** \brief The frame owning the control. */
72
 
      frame_audio& m_owner;
73
 
 
74
 
    }; // class volume_changed_callback
75
 
 
76
44
  public:
77
45
    frame_audio( windows_layer* in_layer );
78
46
 
79
47
    void set_volume();
80
48
 
81
49
  private:
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 );
88
 
 
89
 
    void validate();
90
 
 
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 );
95
57
 
96
58
    void save();
97
59
 
98
60
    bool on_ok();
99
61
    bool on_cancel();
100
 
    bool on_up();
101
 
    bool on_down();
102
 
    bool on_left();
103
 
    bool on_right();
104
 
 
105
 
    void position_cursor();
106
62
 
107
63
  private:
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;
119
75
 
120
 
    /** \brief The cursor. */
121
 
    bear::gui::picture* m_cursor;
122
 
 
123
 
    /** \brief The sound "Mute" checkbox. */
124
 
    bear::gui::checkbox* m_sound_muted;
125
 
 
126
 
    /** \brief The music "Mute" checkbox. */
127
 
    bear::gui::checkbox* m_music_muted;
128
 
 
129
 
    /** \brief The "Ok" button. */
130
 
    button_with_text* m_ok;
131
 
 
132
 
    /** \brief 'Cancel' button. */
133
 
    button_with_text* m_cancel;
134
 
 
135
76
    /** \brief Slider to control the volume of the sounds. */
136
77
    bear::gui::slider<double>* m_sound_volume;
137
78
 
138
79
    /** \brief Slider to control the volume of the music. */
139
80
    bear::gui::slider<double>* m_music_volume;
140
81
 
141
 
    /** \brief The position of the cursor. */
142
 
    cursor_position m_cursor_position;
143
 
 
144
 
    /** \brief The size of the margins between controls. */
145
 
    static const unsigned int s_margin;
146
 
 
147
82
  }; // class frame_audio
148
83
} // namespace ptb
149
84