summaryrefslogtreecommitdiffstats
path: root/src/common/gui/container.h
blob: e64d1437c2cbdc1beb0a3df8a75033c14524d85b (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
/***************************************************************************
 *   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 CONTAINER_H
#define CONTAINER_H

#include <tqframe.h>
#include <tqwidgetstack.h>
#include <tqtabwidget.h>
#include <tqlayout.h>

class PopupButton;

//----------------------------------------------------------------------------
class Container : public TQFrame
{
Q_OBJECT
  TQ_OBJECT
public:
  enum Type { Flat, Sunken };
  Container(TQWidget *tqparent = 0, Type type = Flat);
  Container(TQWidgetStack *stack, uint index, Type type = Flat);
  Container(TQTabWidget *tabw, const TQString &title, Type type = Flat);
  void addWidget(TQWidget *widget, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment = 0);
  void addLayout(TQLayout *tqlayout, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment = 0);
  uint numRows() const { return _gridLayout->numRows(); }
  uint numCols() const { return _gridLayout->numCols(); }
  void setFrame(Type type);
  void setMargin(uint margin) { _topLayout->setMargin(margin); }
  void setRowSpacing(uint row, uint spacing) { _gridLayout->setRowSpacing(row, spacing); }
  void setColSpacing(uint col, uint spacing) { _gridLayout->setColSpacing(col, spacing); }
  void setRowStretch(uint row, uint stretch) { _gridLayout->setRowStretch(row, stretch); }
  void setColStretch(uint col, uint stretch) { _gridLayout->setColStretch(col, stretch); }

private:
  Type         _type;
  TQGridLayout *_topLayout, *_gridLayout;

  void initLayout();
};

//----------------------------------------------------------------------------
class ButtonContainer : public Container
{
Q_OBJECT
  TQ_OBJECT
public:
  ButtonContainer(const TQString &title, TQWidget *tqparent);
  PopupButton &button() { return *_button; }

private:
  PopupButton *_button;
};

#endif