1 /* This file is part of the KDE project
3 * Copyright (C) 2008 Bernhard Beschow <bbeschow cs tu berlin de>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
20 #ifndef _khtml_viewbar_h_
21 #define _khtml_viewbar_h_
23 #include <QtGui/QWidget>
26 class KHTMLViewBarWidget
;
28 class KHTMLViewBar
: public QWidget
37 KHTMLViewBar(Position position
, KHTMLView
*view
, QWidget
*parent
);
40 * Adds a widget to this viewbar.
41 * Widget is initially invisible, you should call showBarWidget, to show it.
42 * Several widgets can be added to the bar, but only one can be visible
44 void addBarWidget(KHTMLViewBarWidget
*newBarWidget
);
47 * Shows barWidget that was previously added with addBarWidget.
48 * @see hideCurrentBarWidget
50 void showBarWidget(KHTMLViewBarWidget
*barWidget
);
53 * Adds widget that will be always shown in the viewbar.
54 * After adding permanent widget viewbar is immediately shown.
55 * ViewBar with permanent widget won't hide itself
56 * until permanent widget is removed.
57 * OTOH showing/hiding regular barWidgets will work as usual
58 * (they will be shown above permanent widget)
60 * If permanent widget already exists, new one replaces old one
61 * Old widget is not deleted, caller can do it if it wishes
63 void addPermanentBarWidget(KHTMLViewBarWidget
*barWidget
);
66 * Removes permanent bar widget from viewbar.
67 * If no other viewbar widgets are shown, viewbar gets hidden.
69 * barWidget is not deleted, caller must do it if it wishes
71 void removePermanentBarWidget(KHTMLViewBarWidget
*barWidget
);
74 * @return if viewbar has permanent widget @p barWidget
76 bool hasPermanentWidget(KHTMLViewBarWidget
*barWidget
) const;
80 * Hides currently shown bar widget
82 void hideCurrentBarWidget();
85 virtual void keyPressEvent(QKeyEvent
* event
);
86 virtual void hideEvent(QHideEvent
* event
);
89 bool hasWidget(KHTMLViewBarWidget
*) const;
92 * Shows or hides whole viewbar
94 void setViewBarVisible(bool visible
);
98 KHTMLViewBarWidget
*m_permanentBarWidget
;