synfig-studio  1.0.3
widget_sound.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
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 
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 */
56 {
57  etl::handle<AudioProfile> audioprof;
58 
59  //event override interface
60  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context> &cr);
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