summaryrefslogtreecommitdiffstats
path: root/libk3b/tools/k3btoolbox.h
blob: bab55a84385725a691e27ac66fa33c2a06d532fa (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
/* 
 *
 * $Id$
 * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.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; either version 2 of the License, or
 * (at your option) any later version.
 * See the file "COPYING" for the exact licensing terms.
 */

#ifndef K3B_TOOLBOX_H
#define K3B_TOOLBOX_H

#include <tqframe.h>
#include <tqstring.h>
#include <tqtoolbutton.h>
#include <tqptrlist.h>
#include "k3b_export.h"

class TDEAction;
class TDEToggleAction;
class KWidgetAction;
class TQGridLayout;
class TQPopupMenu;
class TQResizeEvent;


/**
 * internal class. Do not use!
 */
class LIBK3B_EXPORT K3bToolBoxButton : public TQToolButton
{
  TQ_OBJECT
  

 public:
  K3bToolBoxButton( TDEAction*, TQWidget* parent );
  K3bToolBoxButton( const TQString& text, const TQString& icon, 
		    const TQString& tooltip, const TQString& whatsthis,
		    TQObject* receiver, const char* slot,
		    TQWidget* parent );

 private slots:
  void slotPopupActivated();

 protected:
  void resizeEvent( TQResizeEvent* );

 private:
  TQPopupMenu* m_popupMenu;
};


class LIBK3B_EXPORT K3bToolBox : public TQFrame
{
  TQ_OBJECT
  

 public:
  K3bToolBox( TQWidget* parent = 0, const char* name = 0 );
  ~K3bToolBox();

  K3bToolBoxButton* addButton( const TQString& text, const TQString& icon, 
			       const TQString& tooltip = TQString(), const TQString& whatsthis = TQString(),
			       TQObject* receiver = 0, const char* slot = 0,
			       bool forceTextLabel = false );
  K3bToolBoxButton* addButton( TDEAction*, bool forceTextLabel = false );
  K3bToolBoxButton* addToggleButton( TDEToggleAction* );
  void addWidgetAction( KWidgetAction* );

  /**
   * Be aware that the toolbox will take ownership of the widget
   * and destroy it on destruction. Becasue of this it is not fitted
   * for WidgetActions.
   */
  void addWidget( TQWidget* );
  void addLabel( const TQString& );
  void addSpacing();
  void addSeparator();
  void addStretch();

  void clear();

 protected:
  TQGridLayout* m_mainLayout;
  TQPtrList<TQWidget> m_doNotDeleteWidgets;
};


#endif