tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / UnoControls / source / inc / progressbar.hxx
blob78104ca3b92422434a58ab0db1815754a97817af
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <com/sun/star/awt/XProgressBar.hpp>
24 #include <climits>
26 #include <tools/color.hxx>
28 #include <basecontrol.hxx>
30 namespace unocontrols {
32 #define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
33 constexpr Color PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR = COL_BLUE;
34 constexpr Color PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR = COL_LIGHTGRAY;
35 constexpr bool PROGRESSBAR_DEFAULT_HORIZONTAL = true;
36 constexpr auto PROGRESSBAR_FREESPACE = 4;
37 constexpr auto PROGRESSBAR_DEFAULT_MINRANGE = INT_MIN;
38 constexpr auto PROGRESSBAR_DEFAULT_MAXRANGE = INT_MAX;
39 constexpr auto PROGRESSBAR_DEFAULT_VALUE = INT_MIN;
40 constexpr auto PROGRESSBAR_DEFAULT_BLOCKVALUE = 1;
41 constexpr sal_Int32 PROGRESSBAR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
42 constexpr sal_Int32 PROGRESSBAR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
44 using ProgressBar_BASE = cppu::ImplInheritanceHelper<BaseControl,
45 css::awt::XControlModel,
46 css::awt::XProgressBar>;
48 class ProgressBar final : public ProgressBar_BASE
50 public:
52 ProgressBar( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
54 virtual ~ProgressBar() override;
56 // XProgressBar
58 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) override;
60 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override;
62 virtual void SAL_CALL setValue( sal_Int32 nValue ) override;
64 virtual void SAL_CALL setRange(
65 sal_Int32 nMin ,
66 sal_Int32 nMax
67 ) override;
69 virtual sal_Int32 SAL_CALL getValue() override;
71 // XWindow
73 virtual void SAL_CALL setPosSize(
74 sal_Int32 nX ,
75 sal_Int32 nY ,
76 sal_Int32 nWidth ,
77 sal_Int32 nHeight ,
78 sal_Int16 nFlags
79 ) override;
81 // XControl
83 virtual sal_Bool SAL_CALL setModel(
84 const css::uno::Reference< css::awt::XControlModel >& xModel
85 ) override;
87 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
89 private:
90 virtual void impl_paint(
91 sal_Int32 nX ,
92 sal_Int32 nY ,
93 const css::uno::Reference< css::awt::XGraphics >& xGraphics
94 ) override;
96 void impl_recalcRange();
98 bool m_bHorizontal; // orientation for steps [true=horizontal/false=vertical]
99 css::awt::Size m_aBlockSize; // width and height of a block [>=0,0]
100 Color m_nForegroundColor; // (alpha,r,g,b)
101 Color m_nBackgroundColor; // (alpha,r,g,b)
102 sal_Int32 m_nMinRange; // lowest value = 0% [long, <_nMaxRange]
103 sal_Int32 m_nMaxRange; // highest value = 100% [long, >_nMinRange]
104 double m_nBlockValue; // value for one block [long, >0]
105 sal_Int32 m_nValue; // value for progress [long]
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */