ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
DockTitleBar.h
Go to the documentation of this file.
1/*$!{
2* Aurora Clang AST Viewer (ACAV)
3*
4* Copyright (c) 2026 Min Liu
5* Copyright (c) 2026 Michael David Adams
6*
7* SPDX-License-Identifier: GPL-2.0-or-later
8*
9* This program is free software; you can redistribute it and/or modify
10* it under the terms of the GNU General Public License as published by
11* the Free Software Foundation; either version 2 of the License, or
12* (at your option) any later version.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License along
20* with this program; if not, see <https://www.gnu.org/licenses/>.
21}$!*/
22
25#pragma once
26
27#include <QFrame>
28#include <QLabel>
29#include <QResizeEvent>
30
31namespace acav {
32
37class DockTitleBar : public QFrame {
38public:
39 explicit DockTitleBar(const QString &title, QWidget *parent = nullptr);
40
42 void setFocused(bool focused);
43
45 bool isFocused() const { return focused_; }
46
49 void setSubtitle(const QString &subtitle);
50
52 QString subtitle() const { return fullSubtitle_; }
53
54protected:
55 void resizeEvent(QResizeEvent *event) override;
56
57private:
58 void updateAppearance();
59 void updateElidedSubtitle();
60
61 QLabel *titleLabel_ = nullptr;
62 QLabel *subtitleLabel_ = nullptr;
63 QString fullSubtitle_;
64 bool focused_ = false;
65};
66
67} // namespace acav
void setFocused(bool focused)
Set the focused state. Uses QPalette for fast updates.
void setSubtitle(const QString &subtitle)
Set subtitle text (e.g., file path) displayed below the title.
bool isFocused() const
Get the current focused state.
QString subtitle() const
Get the current subtitle text (full, non-elided).