GCC Code Coverage Report


Directory: ./
File: lib/geogram_gfx/gui/status_bar.h
Date: 2026-09-07 02:28:19
Exec Total Coverage
Lines: 0 2 0.0%
Functions: 0 0 -%
Branches: 0 4 0.0%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2000-2022 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the ALICE Project-Team nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contact: Bruno Levy
30 *
31 * https://www.inria.fr/fr/bruno-levy
32 *
33 * Inria,
34 * Domaine de Voluceau,
35 * 78150 Le Chesnay - Rocquencourt
36 * FRANCE
37 *
38 */
39
40 #ifndef H_GEOGRAM_GFX_GUI_STATUS_BAR_H
41 #define H_GEOGRAM_GFX_GUI_STATUS_BAR_H
42
43 #include <geogram_gfx/basic/common.h>
44 #include <geogram/basic/progress.h>
45
46 /**
47 * \file geogram_gfx/gui/status_bar.h
48 * \brief Implementation of the status bar.
49 */
50
51 namespace GEO {
52
53 /**
54 * \brief StatusBar displays the progress bar.
55 */
56 class GEOGRAM_GFX_API StatusBar : public GEO::ProgressClient {
57 public:
58
59 /**
60 * \brief StatusBar constructor.
61 */
62 StatusBar();
63
64 /**
65 * \copydoc GEO::ProgressClient::begin()
66 */
67 void begin() override;
68
69 /**
70 * \copydoc GEO::ProgressClient::progress()
71 */
72 void progress(GEO::index_t step, GEO::index_t percent) override;
73
74 /**
75 * \copydoc GEO::ProgressClient::end()
76 */
77 void end(bool canceled) override;
78
79 /**
80 * \brief Draws the status bar and handles the GUI.
81 */
82 void draw();
83
84 /**
85 * \brief Tests whether this status bar should be displayed.
86 * \details The status bar is displayed whenever there is an
87 * active progress bar.
88 */
89 bool active() const {
90 return (nb_active_ > 0);
91 }
92
93 /**
94 * \brief Redraws the GUI.
95 */
96 virtual void update();
97
98 /**
99 * \brief Gets the height of the status bar window.
100 * \return the height of the window.
101 * \details Needs to have drawn the window at least once,
102 * else it returns 0.
103 */
104 float get_window_height() const {
105 return height_;
106 }
107
108 private:
109 bool progress_;
110 index_t step_;
111 index_t percent_;
112 bool canceled_;
113 index_t nb_active_;
114 float height_;
115 };
116
117 typedef SmartPointer<StatusBar> StatusBar_var;
118 }
119
120 #endif
121