summaryrefslogtreecommitdiffabout
path: root/microkde/kdialogbase.h
Unidiff
Diffstat (limited to 'microkde/kdialogbase.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdialogbase.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
new file mode 100644
index 0000000..199d2fa
--- a/dev/null
+++ b/microkde/kdialogbase.h
@@ -0,0 +1,139 @@
1#ifndef MINIKDE_KDIALOGBASE_H
2#define MINIKDE_KDIALOGBASE_H
3
4#include <qframe.h>
5
6#include "kdialog.h"
7
8class QPushButton;
9class QLayout;
10class QTabWidget;
11class QBoxLayout;
12
13class KDialogBase : public KDialog
14{
15 Q_OBJECT
16 public:
17 enum ButtonCode
18 {
19 Help = 0x00000001,
20 Default = 0x00000002,
21 Ok = 0x00000004,
22 Apply = 0x00000008,
23 Try = 0x00000010,
24 Cancel = 0x00000020,
25 Close = 0x00000040,
26 User1 = 0x00000080,
27 User2 = 0x00000100,
28 User3 = 0x00000200,
29 No = 0x00000080,
30 Yes = 0x00000100,
31 Details = 0x00000400,
32 Filler = 0x40000000,
33 Stretch = 0x80000000
34 };
35
36 enum DialogType
37 {
38 TreeList,
39 Tabbed,
40 Plain,
41 Swallow,
42 IconList
43 };
44
45 KDialogBase();
46 KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
47 const QString &caption=QString::null,
48 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
49 bool separator=false,
50 const QString &user1=QString::null,
51 const QString &user2=QString::null,
52 const QString &user3=QString::null);
53 KDialogBase( int dialogFace, const QString &caption,
54 int buttonMask, ButtonCode defaultButton,
55 QWidget *parent=0, const char *name=0, bool modal=true,
56 bool separator=false,
57 const QString &user1=QString::null,
58 const QString &user2=QString::null,
59 const QString &user3=QString::null);
60 virtual ~KDialogBase();
61
62 QFrame *addPage( const QString & );
63 QFrame *addPage( const QString &, int, const QPixmap & );
64
65 void setMainWidget( QWidget *widget );
66
67 void setButtonText( ButtonCode id, const QString &text );
68
69 void enableButton( ButtonCode id, bool state );
70 void enableButtonOK( bool state );
71 void enableButtonApply( bool state );
72
73 void showButton( ButtonCode, bool show );
74
75 int pageIndex( QWidget *widget ) const;
76
77 bool showPage( int index );
78 void hideButtons();
79
80 QFrame *plainPage();
81
82 signals:
83 void user1Clicked();
84 void user2Clicked();
85 /**
86 * The Apply button was pressed. This signal is only emitted if
87 * @ref slotApply() is not replaced.
88 */
89 void applyClicked();
90
91 /**
92 * The OK button was pressed. This signal is only emitted if
93 * @ref slotOk() is not replaced.
94 */
95 void okClicked();
96
97 /**
98 * The Cancel button was pressed. This signal is only emitted if
99 * @ref slotCancel() is not replaced.
100 */
101 void cancelClicked();
102
103 /**
104 * The Close button was pressed. This signal is only emitted if
105 * @ref slotClose() is not replaced.
106 */
107 void closeClicked();
108
109 protected slots:
110 virtual void slotOk();
111 virtual void slotApply();
112 virtual void slotCancel();
113 virtual void slotClose();
114 virtual void slotUser1();
115 virtual void slotUser2();
116
117 protected:
118 QPushButton *findButton( ButtonCode );
119
120 private:
121 QTabWidget *tabWidget();
122 void init( const QString &caption, int buttonMask,
123 const QString &user1=QString::null, const QString &user2=QString::null );
124 void initLayout();
125
126 QWidget *mMainWidget;
127 QTabWidget *mTabWidget;
128 QFrame *mPlainPage;
129 QBoxLayout *mTopLayout;
130
131 QPushButton *mUser1Button;
132 QPushButton *mUser2Button;
133 QPushButton *mCloseButton;
134 QPushButton *mOkButton;
135 QPushButton *mApplyButton;
136 QPushButton *mCancelButton;
137};
138
139#endif