summaryrefslogtreecommitdiffstats
path: root/quanta/utility/toolbartabwidget.h
blob: 2fcc67180c2d34352fb053ae757dfe175ea3a0bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/***************************************************************************
                             toolbartabwidget.h
                             ---------------------
    copyright            : (C) 2003 by Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; version 2 of the License.               *
 *                                                                         *
 ***************************************************************************/

#ifndef TOOLBARTABWIDGET_H
#define TOOLBARTABWIDGET_H

#include <tqwidget.h>
#include <tqmap.h>

class QTabWidget;
class KPopupMenu;
class QWidgetStack;
class QTabBar;
class KToolBar;

class ToolbarTabWidget: public QTabWidget
{
  Q_OBJECT
public:
  TQWidgetStack *m_widgetStack;

  static ToolbarTabWidget* const ref(TQWidget *parent = 0L, const char *name = 0L)
  {
    static ToolbarTabWidget *m_ref;
    if (!m_ref) m_ref = new ToolbarTabWidget (parent, name);
    return m_ref;
  }
  virtual ~ToolbarTabWidget(){};

  virtual void insertTab(TQWidget *child, const TQString &label, const TQString &id);
  virtual TQWidget* page(int index);
  virtual TQWidget* page(const TQString& id);
  int tabHeight() const;
  TQString id(TQWidget *w) const;
  TQString id(int index) const;
  KToolBar::IconText iconText() const {return m_iconText;}
  void setIconText(KToolBar::IconText mode) {m_iconText = mode; emit iconTextModeChanged();}

public slots:
  virtual void removePage(TQWidget * w );
  virtual void resizeEvent(TQResizeEvent *);

private slots:
  void slotRemoveToolbar();
  void slotRenameToolbar();
  void slotEditToolbar();

signals:
  void removeToolbar(const TQString&);
  void renameToolbar(const TQString&);
  void editToolbar(const TQString&);
  void newAction();
  void addToolbar();
  void iconTextModeChanged();

public:
  TQString tabUnderMouse;
  TQString tabUnderMouseLabel;

protected:
  virtual void mousePressEvent ( TQMouseEvent * e );

  KPopupMenu *m_popupMenu;
  TQTabBar *m_tabBar;
  TQMap<TQString, TQWidget*> toolbarList;

private:
  ToolbarTabWidget(TQWidget * parent = 0, const char * name = 0, WFlags f = 0);
  KToolBar::IconText m_iconText;

};

class QuantaToolBar: public KToolBar
{
  Q_OBJECT

public:
  QuantaToolBar (TQWidget *parent, const char *name=0, bool honor_style=FALSE, bool readConfig=TRUE);
  virtual ~QuantaToolBar() {};

private slots:
  void slotEditAction();
  void slotRemoveAction();
  void slotIconTextChanged(int id);
  void slotIconTextMenuAboutToShow();

signals:
  void removeAction(const TQString&, const TQString&);
  void editAction(const TQString&);

protected:
  virtual void mousePressEvent ( TQMouseEvent * e );

  KPopupMenu *m_popupMenu;
  KPopupMenu *m_iconTextMenu;
  ToolbarTabWidget *m_toolbarTab;
  TQString currentActionName;
};

#endif