summaryrefslogtreecommitdiffstats
path: root/src/common/gui/dialog.h
blob: d6753141cbe21432f57563bd03fc75a91e41a77c (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
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@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; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef DIALOG_H
#define DIALOG_H

#include <tqlayout.h>
#include <kdialogbase.h>
#include <tdelistview.h>

//-----------------------------------------------------------------------------
class Dialog : public KDialogBase
{
Q_OBJECT
  
public:
  Dialog(TQWidget *parent, const char *name, bool modal,
         const TQString &caption, int buttonMask, ButtonCode defaultButton, bool separator,
         const TQSize &defaultSize = TQSize());
  Dialog(DialogType type, const TQString &caption,
         int buttonMask, ButtonCode defaultButton, TQWidget *parent, const char *name,
         bool modal, bool separator, const TQSize &defaultSize = TQSize());
  virtual ~Dialog();

private slots:
  void updateSize();

private:
  TQSize _defaultSize;
};

//-----------------------------------------------------------------------------
class TreeListDialog : public Dialog
{
Q_OBJECT
  
public:
  TreeListDialog(TQWidget *parent, const char *name, bool modal,
                 const TQString &caption, int buttonMask, ButtonCode defaultButton, bool separator);
  TQWidget *addPage(const TQStringList &labels);
  void showPage(TQWidget *page);
  int activePageIndex() const;
  int pageIndex(TQWidget *page) const;

protected slots:
  virtual void currentChanged(TQListViewItem *item);
  void pageDestroyed(TQObject *page);

protected:
  TQFrame       *_frame;
  TDEListView    *_listView;
  TQHBoxLayout  *_titleBox;
  TQLabel       *_label;
  TQWidgetStack *_stack;

 class Item : public TDEListViewItem {
  public:
    Item(const TQString &label, TQWidget *page, const TQString &title, TQListView *listview);
    Item(const TQString &label, TQWidget *page, const TQString &title, TQListViewItem *item);
    TQWidget *_page;
    TQString  _title;
  };
};

//-----------------------------------------------------------------------------
class TextEditorDialog : public Dialog
{
Q_OBJECT
  
public:
  TextEditorDialog(const TQString &text, const TQString &caption,
                   bool wrapAtWidgetWidth, TQWidget *parent);
};

#endif