Dooble
dooble_tab_widget.h
1 /*
2 ** Copyright (c) 2008 - present, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Dooble without specific prior written permission.
15 **
16 ** DOOBLE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** DOOBLE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef dooble_tab_widget_h
29 #define dooble_tab_widget_h
30 
31 #include <QTabWidget>
32 
33 class QFrame;
34 class QToolButton;
35 class dooble_page;
36 class dooble_tab_bar;
37 
38 class dooble_tab_widget: public QTabWidget
39 {
40  Q_OBJECT
41 
42  public:
43  dooble_tab_widget(QWidget *parent);
44  QIcon tabIcon(int index) const;
45  QToolButton *tabs_menu_button(void) const;
46  bool is_private(void) const;
47  dooble_page *page(int index) const;
48  dooble_tab_bar *tab_bar(void) const;
49  void setTabIcon(int index, const QIcon &icon);
50  void setTabTextColor(int index, const QColor &color);
51  void setTabToolTip(int index, const QString &text);
52  void set_tab_position(void);
53 
54  protected:
55  void tabRemoved(int index);
56 
57  private:
58  QFrame *m_left_corner_widget;
59  QFrame *m_right_corner_widget;
60  QToolButton *m_add_tab_tool_button;
61  QToolButton *m_private_tool_button;
62  QToolButton *m_tabs_menu_button;
63  dooble_tab_bar *m_tab_bar;
64  void prepare_icons(void);
65  void prepare_tab_label(int index, const QIcon &icon);
66 
67  private slots:
68  void slot_about_to_show_history_menu(void);
69  void slot_history_action_triggered(void);
70  void slot_load_finished(void);
71  void slot_load_started(void);
72  void slot_set_visible_corner_button(bool state);
73  void slot_settings_applied(void);
74  void slot_show_right_corner_widget(bool state);
75 
76  signals:
77  void anonymous_tab_headers(bool state);
78  void decouple_tab(int index);
79  void empty_tab(void);
80  void new_tab(const QUrl &url);
81  void new_tab(void);
82  void open_tab_as_new_private_window(int index);
83  void open_tab_as_new_window(int index);
84  void reload_tab(int index);
85  void reload_tab_periodically(int index, int seconds);
86  void tabs_menu_button_clicked(void);
87 };
88 
89 #endif
Definition: dooble_page.h:50
Definition: dooble_tab_bar.h:37
Definition: dooble_tab_widget.h:39