KTextEditor

katestatusbar.h
1/*
2 SPDX-FileCopyrightText: 2013 Dominik Haumann <dhaumann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATE_STATUS_BAR_H
8#define KATE_STATUS_BAR_H
9
10#include "kateviewhelpers.h"
11
12#include <KLocalizedString>
13#include <KSqueezedTextLabel>
14
15#include <QLabel>
16#include <QMenu>
17#include <QPushButton>
18#include <QToolButton>
19
20namespace KTextEditor
21{
22class ViewPrivate;
23}
24
25class WordCounter;
26class KateStatusBar;
28
29class KateStatusBarOpenUpMenu : public QMenu
30{
31public:
32 explicit KateStatusBarOpenUpMenu(QWidget *parent);
33 void setVisible(bool) override;
34};
35
36/**
37 * For convenience an own button class to ensure a unified look&feel.
38 * Should someone dislike the QPushButton at all could he change it
39 * to a e.g. QLabel subclass
40 */
42{
43public:
44 explicit StatusBarButton(KateStatusBar *parent, const QString &text = QString());
45 QSize sizeHint() const override;
46 QSize minimumSizeHint() const override;
47
48protected:
49 void paintEvent(QPaintEvent *) override;
50};
51
52class KateStatusBar : public KateViewBarWidget
53{
55 friend class StatusBarButton;
56
57public:
58 explicit KateStatusBar(KTextEditor::ViewPrivate *view);
59
60 KateModeMenuList *modeMenu() const;
61
62public Q_SLOTS:
63 void updateStatus();
64
65 void viewModeChanged();
66
67 void cursorPositionChanged();
68
69 void updateDictionary();
70
71 void selectionChanged();
72
73 void documentConfigChanged();
74
75 void modeChanged();
76
77 void wordCountChanged(int, int, int, int);
78
79 void toggleWordCount(bool on);
80
81 void configChanged();
82
83 void changeDictionary(QAction *action);
84
85 void updateEOL();
86
87protected:
88 bool eventFilter(QObject *obj, QEvent *event) override;
89 void contextMenuEvent(QContextMenuEvent *event) override;
90
91private:
92 KTextEditor::ViewPrivate *const m_view;
93 StatusBarButton *m_cursorPosition = nullptr;
94 QString m_wordCount;
95 StatusBarButton *m_zoomLevel = nullptr;
96 StatusBarButton *m_inputMode = nullptr;
97 StatusBarButton *m_mode = nullptr;
98 StatusBarButton *m_encoding = nullptr;
99 StatusBarButton *m_tabsIndent = nullptr;
100 StatusBarButton *m_dictionary = nullptr;
101 StatusBarButton *m_eol = nullptr;
102 QActionGroup *m_dictionaryGroup = nullptr;
103 KateStatusBarOpenUpMenu *m_dictionaryMenu = nullptr;
104 QMenu *m_indentSettingsMenu;
105 KateModeMenuList *m_modeMenuList = nullptr;
106 unsigned int m_selectionMode;
107 QActionGroup *m_tabGroup;
108 QActionGroup *m_indentGroup;
109 QAction *m_mixedAction;
110 QAction *m_hardAction;
111 QAction *m_softAction;
112 WordCounter *m_wordCounter;
113
114private:
115 void addNumberAction(QActionGroup *group, QMenu *menu, int data);
116 void updateGroup(QActionGroup *group, int w);
117
118public Q_SLOTS:
119 void slotTabGroup(QAction *);
120 void slotIndentGroup(QAction *);
121 void slotIndentTabMode(QAction *);
122 void toggleShowLines(bool checked);
123 void toggleShowWords(bool checked);
124};
125
126#endif
Class of menu to select the syntax highlighting language (mode menu).
For convenience an own button class to ensure a unified look&feel.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.