]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSelectionManager.h
Correctly enable/disable citation dialog widgets on initialization.
[lyx.git] / src / frontends / qt4 / GuiSelectionManager.h
index ddb7d2c665dcd85de5e28b4a5d694dc1b7f61733..dae3f90d8d05ec373ffd35c1373f82d23f46226e 100644 (file)
 
 #include <QObject>
 
+class QAbstractItemModel;
 class QAbstractListModel;
 class QModelIndex;
 class QListView;
 class QPushButton;
 class QVariant;
 class QAbstractItemView;
+class QItemSelection;
 template <class T, class U> class QMap;
 
 namespace lyx {
@@ -41,13 +43,14 @@ public:
        ///
        GuiSelectionManager(
                QAbstractItemView * availableLV,
-               QListView * selectedLV,
+               QAbstractItemView * selectedLV,
                QPushButton * addPB, 
                QPushButton * delPB, 
                QPushButton * upPB, 
                QPushButton * downPB,
                QAbstractListModel * availableModel,
-               QAbstractListModel * selectedModel);
+               QAbstractItemModel * selectedModel,
+               int const main_sel_col = 0);
        /// Sets the state of the various push buttons, depending upon the
        /// state of the widgets. (E.g., "delete" is enabled only if the
        /// selection is non-empty.)
@@ -60,7 +63,10 @@ public:
        /// to be used, for example, in displaying information about a
        /// highlighted item: should it be the highlighted available item
        /// or the highlighted selected item that is displayed?
-       bool selectedFocused() { return selectedHasFocus_; };
+       bool selectedFocused() const { return selectedHasFocus_; }
+       /// Returns the selected index. Note that this will depend upon
+       /// selectedFocused().
+       QModelIndex getSelectedIndex(int const c = 0) const;
 
 Q_SIGNALS:
        /// Emitted when the list of selected items has changed. 
@@ -83,11 +89,13 @@ protected:
        /// been selected (i.e., is also in selectedLV).
        bool isSelected(const QModelIndex & idx);
        ///
-       bool insertRowToSelected(int i, QMap<int, QVariant> const & itemData);
+       bool insertRowToSelected(int i, QMap<int, QVariant> const & itemData);
+       ///
+       bool insertRowToSelected(int i, QMap<int, QMap<int, QVariant>> &);
        ///
        QAbstractItemView * availableLV;
        ///
-       QListView * selectedLV;
+       QAbstractItemView * selectedLV;
        ///
        QPushButton * addPB;
        ///
@@ -99,13 +107,19 @@ protected:
        ///
        QAbstractListModel * availableModel;
        ///
-       QAbstractListModel * selectedModel;
+       QAbstractItemModel * selectedModel;
 
 protected Q_SLOTS:
        ///
-       void availableChanged(const QModelIndex & idx, const QModelIndex &);
+       void availableChanged(QModelIndex const & idx, QModelIndex const &);
+       ///
+       void selectedChanged(QModelIndex const & idx, QModelIndex const &);
+       ///
+       void availableChanged(QItemSelection const & qis, QItemSelection const &);
+       ///
+       void selectedChanged(QItemSelection const & qis, QItemSelection const &);
        ///
-       void selectedChanged(const QModelIndex & idx, const QModelIndex &);
+       void selectedEdited();
        ///
        virtual void addPB_clicked();
        ///
@@ -115,12 +129,8 @@ protected Q_SLOTS:
        ///
        virtual void downPB_clicked();
        ///
-       void availableLV_clicked(const QModelIndex &);
-       ///
        void availableLV_doubleClicked(const QModelIndex &);
        ///
-       void selectedLV_clicked(const QModelIndex &);
-       ///
        bool eventFilter(QObject *, QEvent *);
 
 private:
@@ -134,6 +144,8 @@ private:
        virtual void updateUpPB();
        ///
        bool selectedHasFocus_;
+       ///
+       int main_sel_col_;
 };
 
 } // namespace frontend