summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-10-08 21:51:12 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-10-30 08:17:18 +0100
commitdf79eedf6989ab4c2913a23a7e72079bd719168b (patch)
tree429b451dd9c48be33aedf8e9a67313b9c156cef7 /include
parent3d5cafbe1727a95a54eb4a65d98d6d79ec46f0c8 (diff)
tdf#157518: vcl: Introduce vcl control LevelBar
Introduces LevelBar that shares implementation with Progress(Bar). LevelBar is to be as a level indicator, e.g. password strength level. Currently with native backends for gtk and Windows. Currently, except on gtk - the colors of the bar at different levels are hardcoded and not dependent on any kind of themeing. On Windows it follows the styling of progress bar of type "Meter" according to the uxguide: https://learn.microsoft.com/en-us/windows/win32/uxguide/progress-bars#meters Change-Id: Id772cda23615e9582463bf589e4674fd4588c864 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157826 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/salnativewidgets.hxx1
-rw-r--r--include/vcl/status.hxx2
-rw-r--r--include/vcl/toolkit/prgsbar.hxx10
-rw-r--r--include/vcl/weld.hxx9
4 files changed, 20 insertions, 2 deletions
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 907c3b618f88..aa856a16c35d 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -92,6 +92,7 @@ enum class ControlType {
// application but not for the splash
// screen (used in desktop/)
IntroProgress = 132,
+ LevelBar = 133,
// tool tips
Tooltip = 140,
// to draw the implemented theme
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index 4e59481671fd..0c287ddbc1b1 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -36,7 +36,7 @@ struct ImplStatusItem;
void DrawProgress(vcl::Window* pWindow, vcl::RenderContext& rRenderContext, const Point& rPos,
tools::Long nOffset, tools::Long nPrgsWidth, tools::Long nPrgsHeight,
sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
- const tools::Rectangle& rFramePosSize);
+ const tools::Rectangle& rFramePosSize, ControlType eControlType);
enum class StatusBarItemBits {
diff --git a/include/vcl/toolkit/prgsbar.hxx b/include/vcl/toolkit/prgsbar.hxx
index dd9423178dda..1fcba74fdaba 100644
--- a/include/vcl/toolkit/prgsbar.hxx
+++ b/include/vcl/toolkit/prgsbar.hxx
@@ -52,6 +52,13 @@
class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ProgressBar final : public vcl::Window
{
+public:
+ enum class BarStyle
+ {
+ Progress,
+ Level,
+ };
+
private:
Point maPos;
tools::Long mnPrgsWidth;
@@ -59,6 +66,7 @@ private:
sal_uInt16 mnPercent;
sal_uInt16 mnPercentCount;
bool mbCalcNew;
+ BarStyle meBarStyle;
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit();
@@ -66,7 +74,7 @@ private:
SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc);
public:
- ProgressBar( vcl::Window* pParent, WinBits nWinBits );
+ ProgressBar( vcl::Window* pParent, WinBits nWinBits, BarStyle eBarStyle );
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void Resize() override;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e37bd36f65f4..2d8c4db085d6 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1714,6 +1714,14 @@ public:
virtual void set_text(const OUString& rText) = 0;
};
+class VCL_DLLPUBLIC LevelBar : virtual public Widget
+{
+public:
+ /// Sets LevelBar fill percentage.
+ /// @param fPercentage bar's fill percentage, [0.0, 100.0]
+ virtual void set_percentage(double fPercentage) = 0;
+};
+
class VCL_DLLPUBLIC Entry : virtual public Widget
{
private:
@@ -2622,6 +2630,7 @@ public:
virtual std::unique_ptr<Entry> weld_entry(const OUString& id) = 0;
virtual std::unique_ptr<Scale> weld_scale(const OUString& id) = 0;
virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OUString& id) = 0;
+ virtual std::unique_ptr<LevelBar> weld_level_bar(const OUString& id) = 0;
virtual std::unique_ptr<Spinner> weld_spinner(const OUString& id) = 0;
virtual std::unique_ptr<Image> weld_image(const OUString& id) = 0;
virtual std::unique_ptr<Calendar> weld_calendar(const OUString& id) = 0;