Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / synfigstudio_0_61_07 / src / gtkmm / widget_sound.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file widget_sound.h
3 **      \brief Widget Sound Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_WIDGET_SOUND_H
26 #define __SYNFIG_WIDGET_SOUND_H
27
28 /* === H E A D E R S ======================================================= */
29 #include <ETL/handle>
30
31 #include <gtkmm/drawingarea.h>
32
33 #include "widget_timeslider.h"
34
35 /* === M A C R O S ========================================================= */
36
37 /* === T Y P E D E F S ===================================================== */
38
39 /* === C L A S S E S & S T R U C T S ======================================= */
40
41 namespace studio {
42
43 class AudioProfile;
44 class AudioContainer;
45
46 /*      What can widget sound do?
47         Options:
48         1. Just draw the sound
49         2. Scroll time and draw the sound
50         3. Play, stop, and scrub the sound... (full interaction...)
51         4. Provide hooks for scrubbing to work... (and possibly play and stop in the future)
52
53         Going with 4 for now...
54 */
55 class Widget_Sound : public Widget_Timeslider
56 {
57         etl::handle<AudioProfile>       audioprof;
58
59         //event override interface
60         virtual bool on_expose_event(GdkEventExpose *heh = 0);
61
62         //for scrubbing... (click is start, drag is scrub, and release is stop...)
63         virtual bool on_motion_notify_event(GdkEventMotion* event);
64         virtual bool on_button_press_event(GdkEventButton *event);
65         virtual bool on_button_release_event(GdkEventButton *event);
66
67         //Might want a signal setup for scrubbing... and here it is
68         sigc::signal1<void,double>      signal_start_scrubbing_;
69         sigc::signal1<void,double>      signal_scrub_;
70         sigc::signal0<void>                     signal_stop_scrubbing_;
71
72 public: //structors
73         Widget_Sound();
74         ~Widget_Sound();
75
76 public: //accessors
77         bool set_profile(etl::handle<AudioProfile>      p);
78         etl::handle<AudioProfile>       get_profile() const;
79
80         //for signal interface
81         sigc::signal1<void,double>      &       signal_start_scrubbing()        {return signal_start_scrubbing_;}
82         sigc::signal1<void,double>      &       signal_scrub()                          {return signal_scrub_;}
83         sigc::signal0<void>                     &       signal_stop_scrubbing()         {return signal_stop_scrubbing_;}
84
85 public: //get set interface
86         void set_position(double t);
87         double get_position() const;
88
89 public: //interface
90         void draw();
91
92         void clear();
93 };
94
95 }; // END of namespace studio
96
97 /* === E N D =============================================================== */
98
99 #endif