File indexing completed on 2024-05-12 16:41:07

0001 /***************************************************************************
0002     begin                : Sunday Jun 27 2008
0003     copyright            : (C) 2008 by Mathias Soeken
0004     email                : msoeken@informatik.uni-bremen.de
0005  ***************************************************************************/
0006 
0007 /***************************************************************************
0008  *                                                                         *
0009  *   This program is free software; you can redistribute it and/or modify  *
0010  *   it under the terms of the GNU General Public License as published by  *
0011  *   the Free Software Foundation; either version 2 of the License, or     *
0012  *   (at your option) any later version.                                   *
0013  *                                                                         *
0014  ***************************************************************************/
0015 
0016 #ifndef TABULARHEADERITEM_H
0017 #define TABULARHEADERITEM_H
0018 
0019 #include <QTableWidgetItem>
0020 
0021 class QAction;
0022 class QIcon;
0023 class QMenu;
0024 
0025 namespace KileDialog {
0026 
0027 class TabularHeaderItem : public QObject, public QTableWidgetItem {
0028     Q_OBJECT
0029 
0030 public:
0031     enum { AlignP = 0x0200, AlignB = 0x0400, AlignM = 0x0800, AlignX = 0x1000 };
0032 
0033     explicit TabularHeaderItem(QWidget *parent);
0034 
0035     void setAlignment(int alignment);
0036     int alignment() const;
0037 
0038     bool insertBefore() const;
0039     bool insertAfter() const;
0040     bool suppressSpace() const;
0041     bool dontSuppressSpace() const;
0042 
0043     void setHasXAlignment(bool hasXAlignment);
0044     bool hasXAlignment() const;
0045 
0046     QMenu* popupMenu() const;
0047 
0048 private:
0049     void format();
0050     QIcon iconForAlignment(int alignment) const;
0051 
0052 private Q_SLOTS:
0053     void slotAlignLeft();
0054     void slotAlignCenter();
0055     void slotAlignRight();
0056     void slotAlignP();
0057     void slotAlignB();
0058     void slotAlignM();
0059     void slotAlignX();
0060     void slotDeclPre();
0061     void slotDeclPost();
0062     void slotDeclAt();
0063     void slotDeclBang();
0064 
0065 Q_SIGNALS:
0066     void alignColumn(int alignment);
0067 
0068 private:
0069     int m_Alignment;
0070     bool m_InsertBefore, m_InsertAfter, m_SuppressSpace, m_DontSuppressSpace;
0071     QMenu *m_Popup;
0072     QAction *m_acXAlignment,
0073             *m_acDeclPre, *m_acDeclPost, *m_acDeclAt, *m_acDeclBang;
0074     bool m_hasXAlignment;
0075 };
0076 
0077 }
0078 
0079 #endif