Line |
Branch |
Exec |
Source |
1 |
|
|
/************************************************************************ |
2 |
|
|
* |
3 |
|
|
* Copyright (C) 2009-2024 IRCAD France |
4 |
|
|
* Copyright (C) 2012-2019 IHU Strasbourg |
5 |
|
|
* |
6 |
|
|
* This file is part of Sight. |
7 |
|
|
* |
8 |
|
|
* Sight is free software: you can redistribute it and/or modify it under |
9 |
|
|
* the terms of the GNU Lesser General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* Sight is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU Lesser General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU Lesser General Public |
19 |
|
|
* License along with Sight. If not, see <https://www.gnu.org/licenses/>. |
20 |
|
|
* |
21 |
|
|
***********************************************************************/ |
22 |
|
|
|
23 |
|
|
#pragma once |
24 |
|
|
|
25 |
|
|
#include <sight/ui/qt/config.hpp> |
26 |
|
|
|
27 |
|
|
#include "ui/qt/container/toolbar.hpp" |
28 |
|
|
|
29 |
|
|
#include <core/base.hpp> |
30 |
|
|
|
31 |
|
|
#include <ui/__/container/toolbar.hpp> |
32 |
|
|
#include <ui/__/layout/toolbar_manager.hpp> |
33 |
|
|
|
34 |
|
|
#include <QAction> |
35 |
|
|
|
36 |
|
|
namespace sight::ui::qt::layout |
37 |
|
|
{ |
38 |
|
|
|
39 |
|
|
/** |
40 |
|
|
* @brief Defines the tool bar layout manager for the GUI. |
41 |
|
|
*/ |
42 |
|
111 |
class SIGHT_UI_QT_CLASS_API toolbar : public ui::layout::toolbar_manager |
43 |
|
|
{ |
44 |
|
|
public: |
45 |
|
|
|
46 |
|
✗ |
SIGHT_DECLARE_CLASS( |
47 |
|
|
toolbar, |
48 |
|
|
ui::layout::toolbar_manager, |
49 |
|
|
ui::factory::make<toolbar> |
50 |
|
|
) |
51 |
|
|
|
52 |
1/2
✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
444 |
SIGHT_UI_QT_API ~toolbar() override = default; |
53 |
|
|
|
54 |
|
|
/** |
55 |
|
|
* @brief Instantiate actions with parent toolbar. |
56 |
|
|
* @pre layout must be initialized before. |
57 |
|
|
* @pre parent toolbar must be instanced. |
58 |
|
|
*/ |
59 |
|
|
SIGHT_UI_QT_API void create_layout(ui::container::toolbar::sptr _parent, const std::string& _id) override; |
60 |
|
|
|
61 |
|
|
/** |
62 |
|
|
* @brief Destroy local toolBars. |
63 |
|
|
* @pre services using this actions must be stopped before. |
64 |
|
|
*/ |
65 |
|
|
SIGHT_UI_QT_API void destroy_layout() override; |
66 |
|
|
|
67 |
|
|
/** |
68 |
|
|
* @brief Set the action visibility. |
69 |
|
|
*/ |
70 |
|
|
SIGHT_UI_QT_API void menu_item_set_visible(ui::container::menu_item::sptr _menu_item, bool _is_visible) override; |
71 |
|
|
|
72 |
|
|
/** |
73 |
|
|
* @brief Set the action enable or not. |
74 |
|
|
*/ |
75 |
|
|
SIGHT_UI_QT_API void menu_item_set_enabled(ui::container::menu_item::sptr _menu_item, bool _is_enabled) override; |
76 |
|
|
|
77 |
|
|
/** |
78 |
|
|
* @brief Set the action checked or not. |
79 |
|
|
*/ |
80 |
|
|
SIGHT_UI_QT_API void menu_item_set_checked(ui::container::menu_item::sptr /*menu_item*/, bool _is_checked) override; |
81 |
|
|
|
82 |
|
|
SIGHT_UI_QT_API void set_visible(bool _is_visible) override; |
83 |
|
|
SIGHT_UI_QT_API bool visible() const override; |
84 |
|
|
|
85 |
|
|
protected: |
86 |
|
|
|
87 |
|
|
ui::qt::container::toolbar::sptr m_parent; |
88 |
|
|
|
89 |
|
|
// Hidden QAction which allows to change the toolbar visibility. |
90 |
|
|
QAction* m_toggle_toolbar_visibility_action {nullptr}; |
91 |
|
|
}; |
92 |
|
|
|
93 |
|
|
} // namespace sight::ui::qt::layout |
94 |
|
|
|