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
;
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;
139 sal_Bool
AreItemsVisible() const { return mbVisibleItems
; }
141 void RedrawItem( sal_uInt16 nItemId
);
145 sal_uInt16
GetItemCount() const;
146 sal_uInt16
GetItemId( sal_uInt16 nPos
) const;
147 sal_uInt16
GetItemId( const Point
& rPos
) const;
148 sal_uInt16
GetItemPos( sal_uInt16 nItemId
) const;
149 Rectangle
GetItemRect( sal_uInt16 nItemId
) const;
150 Point
GetItemTextPos( sal_uInt16 nItemId
) const;
151 sal_uInt16
GetCurItemId() const { return mnCurItemId
; }
153 sal_uLong
GetItemWidth( sal_uInt16 nItemId
) const;
154 StatusBarItemBits
GetItemBits( sal_uInt16 nItemId
) const;
156 long GetItemOffset( sal_uInt16 nItemId
) const;
158 void SetItemText( sal_uInt16 nItemId
, const OUString
& rText
);
159 const OUString
& GetItemText( sal_uInt16 nItemId
) const;
161 void SetItemData( sal_uInt16 nItemId
, void* pNewData
);
162 void* GetItemData( sal_uInt16 nItemId
) const;
164 void SetItemCommand( sal_uInt16 nItemId
, const OUString
& rCommand
);
165 const OUString
GetItemCommand( sal_uInt16 nItemId
);
167 void SetHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
168 const OUString
& GetHelpText( sal_uInt16 nItemId
) const;
170 using Window::SetQuickHelpText
;
171 void SetQuickHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
172 using Window::GetQuickHelpText
;
173 const OUString
& GetQuickHelpText( sal_uInt16 nItemId
) const;
175 void SetHelpId( sal_uInt16 nItemId
, const OString
& rHelpId
);
176 OString
GetHelpId( sal_uInt16 nItemId
) const;
178 void StartProgressMode( const OUString
& rText
);
179 void SetProgressValue( sal_uInt16 nPercent
);
180 void EndProgressMode();
181 sal_Bool
IsProgressMode() const { return mbProgressMode
; }
183 void SetText( const OUString
& rText
);
185 void SetHelpText( const OUString
& rText
)
186 { Window::SetHelpText( rText
); }
187 const OUString
& GetHelpText() const
188 { return Window::GetHelpText(); }
190 void SetHelpId( const OString
& rId
)
191 { Window::SetHelpId( rId
); }
192 const OString
& GetHelpId() const
193 { return Window::GetHelpId(); }
195 Size
CalcWindowSizePixel() const;
197 void SetClickHdl( const Link
& rLink
) { maClickHdl
= rLink
; }
198 const Link
& GetClickHdl() const { return maClickHdl
; }
199 void SetDoubleClickHdl( const Link
& rLink
) { maDoubleClickHdl
= rLink
; }
200 const Link
& GetDoubleClickHdl() const { return maDoubleClickHdl
; }
202 using Window::SetAccessibleName
;
203 void SetAccessibleName( sal_uInt16 nItemId
, const OUString
& rName
);
204 using Window::GetAccessibleName
;
205 const OUString
& GetAccessibleName( sal_uInt16 nItemId
) const;
208 #endif // INCLUDED_VCL_STATUS_HXX
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */