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 INCLUDED_VCL_STATUS_HXX
21 #define INCLUDED_VCL_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
;
32 // - Progress-Ausgabe -
34 void VCL_DLLPUBLIC
DrawProgress(vcl::Window
* pWindow
, vcl::RenderContext
& rRenderContext
, const Point
& rPos
,
35 long nOffset
, long nPrgsWidth
, long nPrgsHeight
,
36 sal_uInt16 nPercent1
, sal_uInt16 nPercent2
, sal_uInt16 nPercentCount
,
37 const Rectangle
& rFramePosSize
);
40 // - StatusBarItemBits -
43 typedef sal_uInt16 StatusBarItemBits
;
46 // - Bits fuer StatusBarItems -
49 #define SIB_LEFT ((StatusBarItemBits)0x0001)
50 #define SIB_CENTER ((StatusBarItemBits)0x0002)
51 #define SIB_RIGHT ((StatusBarItemBits)0x0004)
52 #define SIB_IN ((StatusBarItemBits)0x0008)
53 #define SIB_OUT ((StatusBarItemBits)0x0010)
54 #define SIB_FLAT ((StatusBarItemBits)0x0020)
55 #define SIB_AUTOSIZE ((StatusBarItemBits)0x0040)
56 #define SIB_USERDRAW ((StatusBarItemBits)0x0080)
59 // - StatusBar-Types -
62 #define STATUSBAR_APPEND ((sal_uInt16)0xFFFF)
63 #define STATUSBAR_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
64 #define STATUSBAR_OFFSET ((long)5)
70 class VCL_DLLPUBLIC StatusBar
: public vcl::Window
74 ImplStatusItemList
* mpItemList
;
78 Rectangle maPrgsFrameRect
;
86 sal_uInt16 mnCurItemId
;
88 sal_uInt16 mnPercentCount
;
95 Link
<> maDoubleClickHdl
;
97 using Window::ImplInit
;
98 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
99 SAL_DLLPRIVATE
void ImplInitSettings();
100 SAL_DLLPRIVATE
void ImplFormat();
101 SAL_DLLPRIVATE
bool ImplIsItemUpdate();
103 SAL_DLLPRIVATE
void ImplDrawText(vcl::RenderContext
& rRenderContext
, bool bOffScreen
,
105 SAL_DLLPRIVATE
void ImplDrawItem(vcl::RenderContext
& rRenderContext
, bool bOffScreen
,
106 sal_uInt16 nPos
, bool bDrawText
, bool bDrawFrame
);
107 SAL_DLLPRIVATE
void ImplDrawProgress(vcl::RenderContext
& rRenderContext
, bool bPaint
,
108 sal_uInt16 nOldPerc
, sal_uInt16 nNewPerc
);
109 SAL_DLLPRIVATE
void ImplCalcProgressRect();
110 SAL_DLLPRIVATE Rectangle
ImplGetItemRectPos( sal_uInt16 nPos
) const;
111 SAL_DLLPRIVATE sal_uInt16
ImplGetFirstVisiblePos() const;
114 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) SAL_OVERRIDE
;
117 StatusBar( vcl::Window
* pParent
,
118 WinBits nWinStyle
= WB_BORDER
| WB_RIGHT
);
119 virtual ~StatusBar();
120 virtual void dispose() SAL_OVERRIDE
;
122 void AdjustItemWidthsForHiDPI(bool bAdjustHiDPI
);
124 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
125 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
126 virtual void Move() SAL_OVERRIDE
;
127 virtual void Resize() SAL_OVERRIDE
;
128 virtual void RequestHelp( const HelpEvent
& rHEvt
) SAL_OVERRIDE
;
129 virtual void StateChanged( StateChangedType nType
) SAL_OVERRIDE
;
130 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
134 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
136 void InsertItem( sal_uInt16 nItemId
, sal_uLong nWidth
,
137 StatusBarItemBits nBits
= SIB_CENTER
| SIB_IN
,
138 long nOffset
= STATUSBAR_OFFSET
,
139 sal_uInt16 nPos
= STATUSBAR_APPEND
);
140 void RemoveItem( sal_uInt16 nItemId
);
142 void ShowItem( sal_uInt16 nItemId
);
143 void HideItem( sal_uInt16 nItemId
);
144 bool IsItemVisible( sal_uInt16 nItemId
) const;
146 bool AreItemsVisible() const { return mbVisibleItems
; }
148 void RedrawItem( sal_uInt16 nItemId
);
152 sal_uInt16
GetItemCount() const;
153 sal_uInt16
GetItemId( sal_uInt16 nPos
) const;
154 sal_uInt16
GetItemId( const Point
& rPos
) const;
155 sal_uInt16
GetItemPos( sal_uInt16 nItemId
) const;
156 Rectangle
GetItemRect( sal_uInt16 nItemId
) const;
157 Point
GetItemTextPos( sal_uInt16 nItemId
) const;
158 sal_uInt16
GetCurItemId() const { return mnCurItemId
; }
160 sal_uLong
GetItemWidth( sal_uInt16 nItemId
) const;
161 StatusBarItemBits
GetItemBits( sal_uInt16 nItemId
) const;
163 long GetItemOffset( sal_uInt16 nItemId
) const;
165 void SetItemText( sal_uInt16 nItemId
, const OUString
& rText
);
166 const OUString
& GetItemText( sal_uInt16 nItemId
) const;
168 void SetItemData( sal_uInt16 nItemId
, void* pNewData
);
169 void* GetItemData( sal_uInt16 nItemId
) const;
171 void SetItemCommand( sal_uInt16 nItemId
, const OUString
& rCommand
);
172 const OUString
GetItemCommand( sal_uInt16 nItemId
);
174 void SetHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
175 const OUString
& GetHelpText( sal_uInt16 nItemId
) const;
177 using Window::SetQuickHelpText
;
178 void SetQuickHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
179 using Window::GetQuickHelpText
;
180 const OUString
& GetQuickHelpText( sal_uInt16 nItemId
) const;
182 void SetHelpId( sal_uInt16 nItemId
, const OString
& rHelpId
);
183 OString
GetHelpId( sal_uInt16 nItemId
) const;
185 void StartProgressMode( const OUString
& rText
);
186 void SetProgressValue( sal_uInt16 nPercent
);
187 void EndProgressMode();
188 bool IsProgressMode() const { return mbProgressMode
; }
190 void SetText( const OUString
& rText
) SAL_OVERRIDE
;
192 void SetHelpText( const OUString
& rText
)
193 { Window::SetHelpText( rText
); }
194 const OUString
& GetHelpText() const
195 { return Window::GetHelpText(); }
197 void SetHelpId( const OString
& rId
)
198 { Window::SetHelpId( rId
); }
199 const OString
& GetHelpId() const
200 { return Window::GetHelpId(); }
202 Size
CalcWindowSizePixel() const;
204 void SetClickHdl( const Link
<>& rLink
) { maClickHdl
= rLink
; }
205 const Link
<>& GetClickHdl() const { return maClickHdl
; }
206 void SetDoubleClickHdl( const Link
<>& rLink
) { maDoubleClickHdl
= rLink
; }
207 const Link
<>& GetDoubleClickHdl() const { return maDoubleClickHdl
; }
209 using Window::SetAccessibleName
;
210 void SetAccessibleName( sal_uInt16 nItemId
, const OUString
& rName
);
211 using Window::GetAccessibleName
;
212 const OUString
& GetAccessibleName( sal_uInt16 nItemId
) const;
215 #endif // INCLUDED_VCL_STATUS_HXX
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */