File indexing completed on 2024-04-28 05:43:23

0001 /***************************************************************************
0002  *   Copyright (C) 2003-2006 David Saxton <david@bluehaze.org>             *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef ORIENTATIONWIDGET_H
0011 #define ORIENTATIONWIDGET_H
0012 
0013 #include <QPointer>
0014 #include <QWidget>
0015 
0016 class CNItem;
0017 class CNItemGroup;
0018 class Component;
0019 class FlowPart;
0020 
0021 class QPushButton;
0022 
0023 /**
0024 @author David Saxton
0025 */
0026 class OrientationWidget : public QWidget
0027 {
0028     Q_OBJECT
0029 public:
0030     OrientationWidget(QWidget *parent = nullptr);
0031     ~OrientationWidget() override;
0032 
0033 public slots:
0034     void slotUpdate(CNItemGroup *itemGroup);
0035     void slotClear();
0036 
0037 signals:
0038     void orientationSelected(uint orientation);
0039 
0040 protected slots:
0041     void slotButtonClicked();
0042     /**
0043      * Updates which button is indented depending on the current orientation
0044      * of the item(s) being edited.
0045      */
0046     void updateShownOrientation();
0047 
0048 protected:
0049     void initFromComponent(Component *component);
0050     void initFromFlowPart(FlowPart *flowPart);
0051 
0052     QPushButton *m_toolBtn[2][4];
0053     QPointer<FlowPart> m_pFlowPart;
0054     QPointer<Component> m_pComponent;
0055     QPointer<CNItem> m_pCNItem;  // Either the flowpart or component
0056     bool m_bHaveSameOrientation; // Whether the items had the same orientation when last updated
0057 };
0058 
0059 #endif