xref: /aoo42x/main/avmedia/inc/mediacontrol.hxx (revision 9ea84ac5)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _AVMEDIA_MEDIACONTROL_HXX
25 #define _AVMEDIA_MEDIACONTROL_HXX
26 
27 #include <avmedia/mediaitem.hxx>
28 
29 #include <vcl/timer.hxx>
30 #include <vcl/slider.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <vcl/edit.hxx>
33 #include <vcl/image.hxx>
34 
35 #define AVMEDIA_CONTROLOFFSET 6
36 
37 class ListBox;
38 
39 namespace avmedia
40 {
41 
42 // ---------------------
43 // - MediaControlStyle -
44 // ---------------------
45 
46 enum MediaControlStyle
47 {
48 	MEDIACONTROLSTYLE_SINGLELINE = 0,
49 	MEDIACONTROLSTYLE_MULTILINE = 1
50 };
51 
52 // ----------------
53 // - MediaControl -
54 // ---------------
55 
56 class MediaItem;
57 
58 class MediaControl : public Control
59 {
60 public:
61 
62 						MediaControl( Window* pParent, MediaControlStyle eControlStyle );
63 	virtual				~MediaControl();
64 
65 	const Size&			getMinSizePixel() const;
66 
67 	void				setState( const MediaItem& rItem );
68 	void				getState( MediaItem& rItem ) const;
69 
70 protected:
71 
72 	virtual void		update() = 0;
73 	virtual void		execute( const MediaItem& rItem ) = 0;
74 
75 	virtual void		Resize();
76 
77 private:
78 
79 	void 				implUpdateToolboxes();
80 	void 				implUpdateTimeSlider();
81 	void				implUpdateVolumeSlider();
82 	void				implUpdateTimeField( double fCurTime );
83 	Image				implGetImage( sal_Int32 nImageId ) const;
84 
85 						DECL_LINK( implTimeHdl, Slider* );
86 						DECL_LINK( implTimeEndHdl, Slider* );
87 						DECL_LINK( implVolumeHdl, Slider* );
88 						DECL_LINK( implVolumeEndHdl, Slider* );
89 						DECL_LINK( implSelectHdl, ToolBox* );
90 						DECL_LINK( implZoomSelectHdl, ListBox* );
91 						DECL_LINK( implTimeoutHdl, Timer* );
92 
93 	ImageList			maImageList;
94 	Timer				maTimer;
95 	MediaItem			maItem;
96 	ToolBox				maPlayToolBox;
97 	Slider				maTimeSlider;
98 	ToolBox				maMuteToolBox;
99 	Slider				maVolumeSlider;
100 	ToolBox				maZoomToolBox;
101 	ListBox*			mpZoomListBox;
102 	Edit				maTimeEdit;
103 	Size				maMinSize;
104 	MediaControlStyle	meControlStyle;
105 	bool                mbLocked;
106 };
107 
108 }
109 
110 #endif
111