GXDE Bernese
Loading...
Searching...
No Matches
tab_bar_utils.h
1/*
2 * Copyright (C) 2026 CharOfString <root@charofstring.cc>
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation, either version 3 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef TAB_BAR_UTILS_TAB_BAR_UTILS_H_
19#define TAB_BAR_UTILS_TAB_BAR_UTILS_H_
20
21#include "QStyleOptionTabBarBase"
22#include "QTabBar"
23#include "QToolButton"
24
25#include "bernese/export.h"
26
27namespace bernese {
28namespace tab_bar_utils {
29
30// Direction in which the built-in scroll buttons of a tab bar move.
31enum class ScrollDirection {
32 kTowardFirst, // Shows tabs with lower indexes, like the left arrow.
33 kTowardLast // Shows tabs with higher indexes, like the right arrow.
34};
35
45BERNESE_EXPORT void InitTabBarBaseOption(
46 QStyleOptionTabBarBase* option, const QTabBar* tab_bar);
47
58BERNESE_EXPORT QToolButton* ScrollButton(
59 const QTabBar* tab_bar, ScrollDirection direction);
60
71BERNESE_EXPORT bool ScrollTabs(QTabBar* tab_bar, ScrollDirection direction);
72
82BERNESE_EXPORT void ScrollToTab(QTabBar* tab_bar, int index);
83
84} // namespace tab_bar_utils
85} // namespace bernese
86
87#endif // TAB_BAR_UTILS_TAB_BAR_UTILS_H_