1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SV_STATUS_HXX
21 #define _SV_STATUS_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/window.hxx>
28 struct ImplStatusItem
;
29 typedef ::std::vector
< ImplStatusItem
* > ImplStatusItemList
;
31 // --------------------
32 // - Progress-Ausgabe -
33 // --------------------
35 void VCL_DLLPUBLIC
DrawProgress( Window
* pWindow
, const Point
& rPos
,
36 long nOffset
, long nPrgsWidth
, long nPrgsHeight
,
37 sal_uInt16 nPercent1
, sal_uInt16 nPercent2
, sal_uInt16 nPercentCount
,
38 const Rectangle
& rFramePosSize
41 // ---------------------
42 // - StatusBarItemBits -
43 // ---------------------
45 typedef sal_uInt16 StatusBarItemBits
;
47 // ----------------------------
48 // - Bits fuer StatusBarItems -
49 // ----------------------------
51 #define SIB_LEFT ((StatusBarItemBits)0x0001)
52 #define SIB_CENTER ((StatusBarItemBits)0x0002)
53 #define SIB_RIGHT ((StatusBarItemBits)0x0004)
54 #define SIB_IN ((StatusBarItemBits)0x0008)
55 #define SIB_OUT ((StatusBarItemBits)0x0010)
56 #define SIB_FLAT ((StatusBarItemBits)0x0020)
57 #define SIB_AUTOSIZE ((StatusBarItemBits)0x0040)
58 #define SIB_USERDRAW ((StatusBarItemBits)0x0080)
60 // -------------------
61 // - StatusBar-Types -
62 // -------------------
64 #define STATUSBAR_APPEND ((sal_uInt16)0xFFFF)
65 #define STATUSBAR_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
66 #define STATUSBAR_OFFSET ((long)5)
72 class VCL_DLLPUBLIC StatusBar
: public Window
76 ImplStatusItemList
* mpItemList
;
80 Rectangle maPrgsFrameRect
;
88 sal_uInt16 mnCurItemId
;
90 sal_uInt16 mnPercentCount
;
91 sal_Bool mbVisibleItems
;
93 sal_Bool mbProgressMode
;
94 sal_Bool mbInUserDraw
;
96 Link maDoubleClickHdl
;
98 using Window::ImplInit
;
99 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nStyle
);
100 SAL_DLLPRIVATE
void ImplInitSettings( sal_Bool bFont
, sal_Bool bForeground
, sal_Bool bBackground
);
101 SAL_DLLPRIVATE
void ImplFormat();
102 SAL_DLLPRIVATE sal_Bool
ImplIsItemUpdate();
103 using OutputDevice::ImplDrawText
;
104 SAL_DLLPRIVATE
void ImplDrawText( sal_Bool bOffScreen
, long nOldTextWidth
);
105 SAL_DLLPRIVATE
void ImplDrawItem( sal_Bool bOffScreen
, sal_uInt16 nPos
, sal_Bool bDrawText
, sal_Bool bDrawFrame
);
106 SAL_DLLPRIVATE
void ImplDrawProgress( sal_Bool bPaint
,
107 sal_uInt16 nOldPerc
, sal_uInt16 nNewPerc
);
108 SAL_DLLPRIVATE
void ImplCalcProgressRect();
109 SAL_DLLPRIVATE Rectangle
ImplGetItemRectPos( sal_uInt16 nPos
) const;
110 SAL_DLLPRIVATE sal_uInt16
ImplGetFirstVisiblePos() const;
113 StatusBar( Window
* pParent
,
114 WinBits nWinStyle
= WB_BORDER
| WB_RIGHT
);
117 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
118 virtual void Paint( const Rectangle
& rRect
);
120 virtual void Resize();
121 virtual void RequestHelp( const HelpEvent
& rHEvt
);
122 virtual void StateChanged( StateChangedType nType
);
123 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
125 virtual void Click();
126 virtual void DoubleClick();
127 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
129 void InsertItem( sal_uInt16 nItemId
, sal_uLong nWidth
,
130 StatusBarItemBits nBits
= SIB_CENTER
| SIB_IN
,
131 long nOffset
= STATUSBAR_OFFSET
,
132 sal_uInt16 nPos
= STATUSBAR_APPEND
);
133 void RemoveItem( sal_uInt16 nItemId
);
135 void ShowItem( sal_uInt16 nItemId
);
136 void HideItem( sal_uInt16 nItemId
);
137 sal_Bool
IsItemVisible( sal_uInt16 nItemId
) const;
141 sal_Bool
AreItemsVisible() const { return mbVisibleItems
; }
143 void RedrawItem( sal_uInt16 nItemId
);
145 void CopyItems( const StatusBar
& rStatusBar
);
148 sal_uInt16
GetItemCount() const;
149 sal_uInt16
GetItemId( sal_uInt16 nPos
) const;
150 sal_uInt16
GetItemId( const Point
& rPos
) const;
151 sal_uInt16
GetItemPos( sal_uInt16 nItemId
) const;
152 Rectangle
GetItemRect( sal_uInt16 nItemId
) const;
153 Point
GetItemTextPos( sal_uInt16 nItemId
) const;
154 sal_uInt16
GetCurItemId() const { return mnCurItemId
; }
156 sal_uLong
GetItemWidth( sal_uInt16 nItemId
) const;
157 StatusBarItemBits
GetItemBits( sal_uInt16 nItemId
) const;
159 long GetItemOffset( sal_uInt16 nItemId
) const;
161 void SetItemText( sal_uInt16 nItemId
, const XubString
& rText
);
162 const XubString
& GetItemText( sal_uInt16 nItemId
) const;
164 void SetItemData( sal_uInt16 nItemId
, void* pNewData
);
165 void* GetItemData( sal_uInt16 nItemId
) const;
167 void SetItemCommand( sal_uInt16 nItemId
, const XubString
& rCommand
);
168 const XubString
& GetItemCommand( sal_uInt16 nItemId
);
170 void SetHelpText( sal_uInt16 nItemId
, const XubString
& rText
);
171 const XubString
& GetHelpText( sal_uInt16 nItemId
) const;
173 using Window::SetQuickHelpText
;
174 void SetQuickHelpText( sal_uInt16 nItemId
, const XubString
& rText
);
175 using Window::GetQuickHelpText
;
176 const XubString
& GetQuickHelpText( sal_uInt16 nItemId
) const;
178 void SetHelpId( sal_uInt16 nItemId
, const OString
& rHelpId
);
179 OString
GetHelpId( sal_uInt16 nItemId
) const;
181 void StartProgressMode( const XubString
& rText
);
182 void SetProgressValue( sal_uInt16 nPercent
);
183 void EndProgressMode();
184 sal_Bool
IsProgressMode() const { return mbProgressMode
; }
186 void SetText( const OUString
& rText
);
188 void SetHelpText( const XubString
& rText
)
189 { Window::SetHelpText( rText
); }
190 const XubString
& GetHelpText() const
191 { return Window::GetHelpText(); }
193 void SetHelpId( const OString
& rId
)
194 { Window::SetHelpId( rId
); }
195 const OString
& GetHelpId() const
196 { return Window::GetHelpId(); }
198 Size
CalcWindowSizePixel() const;
200 void SetClickHdl( const Link
& rLink
) { maClickHdl
= rLink
; }
201 const Link
& GetClickHdl() const { return maClickHdl
; }
202 void SetDoubleClickHdl( const Link
& rLink
) { maDoubleClickHdl
= rLink
; }
203 const Link
& GetDoubleClickHdl() const { return maDoubleClickHdl
; }
205 using Window::SetAccessibleName
;
206 void SetAccessibleName( sal_uInt16 nItemId
, const XubString
& rName
);
207 using Window::GetAccessibleName
;
208 const XubString
& GetAccessibleName( sal_uInt16 nItemId
) const;
211 #endif // _SV_STATUS_HXX
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */