xref: /aoo41x/main/avmedia/inc/mediacontrol.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org 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
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _AVMEDIA_MEDIACONTROL_HXX
29 #define _AVMEDIA_MEDIACONTROL_HXX
30 
31 #include <avmedia/mediaitem.hxx>
32 
33 #include <vcl/timer.hxx>
34 #include <vcl/slider.hxx>
35 #include <vcl/toolbox.hxx>
36 #include <vcl/edit.hxx>
37 #include <vcl/image.hxx>
38 
39 #define AVMEDIA_CONTROLOFFSET 6
40 
41 class ListBox;
42 
43 namespace avmedia
44 {
45 
46 // ---------------------
47 // - MediaControlStyle -
48 // ---------------------
49 
50 enum MediaControlStyle
51 {
52 	MEDIACONTROLSTYLE_SINGLELINE = 0,
53 	MEDIACONTROLSTYLE_MULTILINE = 1
54 };
55 
56 // ----------------
57 // - MediaControl -
58 // ---------------
59 
60 class MediaItem;
61 
62 class MediaControl : public Control
63 {
64 public:
65 
66 						MediaControl( Window* pParent, MediaControlStyle eControlStyle );
67 	virtual				~MediaControl();
68 
69 	const Size&			getMinSizePixel() const;
70 
71 	void				setState( const MediaItem& rItem );
72 	void				getState( MediaItem& rItem ) const;
73 
74 protected:
75 
76 	virtual void		update() = 0;
77 	virtual void		execute( const MediaItem& rItem ) = 0;
78 
79 	virtual void		Resize();
80 
81 private:
82 
83 	void 				implUpdateToolboxes();
84 	void 				implUpdateTimeSlider();
85 	void				implUpdateVolumeSlider();
86 	void				implUpdateTimeField( double fCurTime );
87 	Image				implGetImage( sal_Int32 nImageId ) const;
88 
89 						DECL_LINK( implTimeHdl, Slider* );
90 						DECL_LINK( implTimeEndHdl, Slider* );
91 						DECL_LINK( implVolumeHdl, Slider* );
92 						DECL_LINK( implVolumeEndHdl, Slider* );
93 						DECL_LINK( implSelectHdl, ToolBox* );
94 						DECL_LINK( implZoomSelectHdl, ListBox* );
95 						DECL_LINK( implTimeoutHdl, Timer* );
96 
97 	ImageList			maImageList;
98 	Timer				maTimer;
99 	MediaItem			maItem;
100 	ToolBox				maPlayToolBox;
101 	Slider				maTimeSlider;
102 	ToolBox				maMuteToolBox;
103 	Slider				maVolumeSlider;
104 	ToolBox				maZoomToolBox;
105 	ListBox*			mpZoomListBox;
106 	Edit				maTimeEdit;
107 	Size				maMinSize;
108 	MediaControlStyle	meControlStyle;
109 	bool                mbLocked;
110 };
111 
112 }
113 
114 #endif
115