xref: /trunk/main/svtools/inc/svtools/prgsbar.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 _PRGSBAR_HXX
29 #define _PRGSBAR_HXX
30 
31 #include "svtools/svtdllapi.h"
32 #include <vcl/window.hxx>
33 
34 /*************************************************************************
35 
36 Beschreibung
37 ============
38 
39 class ProgressBar
40 
41 Diese Klasse dient zur Anzeige einer Progress-Anzeige.
42 
43 --------------------------------------------------------------------------
44 
45 WinBits
46 
47 WB_BORDER			Border um das Fenster
48 WB_3DLOOK			3D-Darstellung
49 
50 --------------------------------------------------------------------------
51 
52 Methoden
53 
54 Mit SetValue() setzt man einen Prozent-Wert zwischen 0 und 100. Wenn Werte
55 groesser 100 gesetzt werden, faengt das letzte Rechteck an zu blinken.
56 
57 *************************************************************************/
58 
59 // -----------
60 // - WinBits -
61 // -----------
62 
63 #define WB_STDPROGRESSBAR		WB_BORDER
64 
65 // ---------------
66 // - ProgressBar -
67 // ---------------
68 
69 class SVT_DLLPUBLIC ProgressBar : public Window
70 {
71 private:
72 	Point				maPos;
73 	long				mnPrgsWidth;
74 	long				mnPrgsHeight;
75 	sal_uInt16				mnPercent;
76 	sal_uInt16				mnPercentCount;
77 	sal_Bool				mbCalcNew;
78 
79 #ifdef _SV_PRGSBAR_CXX
80     using Window::ImplInit;
81 	SVT_DLLPRIVATE void				ImplInit();
82 	SVT_DLLPRIVATE void				ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
83 	SVT_DLLPRIVATE void				ImplDrawProgress( sal_uInt16 nOldPerc, sal_uInt16 nNewPerc );
84 #endif
85 
86 public:
87 						ProgressBar( Window* pParent, WinBits nWinBits = WB_STDPROGRESSBAR );
88 						ProgressBar( Window* pParent, const ResId& rResId );
89 						~ProgressBar();
90 
91 	virtual void		Paint( const Rectangle& rRect );
92 	virtual void		Resize();
93 	virtual void		StateChanged( StateChangedType nStateChange );
94 	virtual void		DataChanged( const DataChangedEvent& rDCEvt );
95 
96 	void				SetValue( sal_uInt16 nNewPercent );
97 	sal_uInt16				GetValue() const { return mnPercent; }
98 };
99 
100 #endif	// _PRGSBAR_HXX
101