[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project

src/klfstylemanager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfstylemanager.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2007 by Philippe Faist
00005  *   philippe.faist@bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id: klfstylemanager.h 399 2010-06-28 21:10:25Z philippe $ */
00023 
00024 #ifndef KLFSTYLEMANAGER_H
00025 #define KLFSTYLEMANAGER_H
00026 
00027 #include <QWidget>
00028 #include <QMenu>
00029 #include <QListWidget>
00030 #include <QStringListModel>
00031 
00032 //#include <klfdata.h>
00033 #include <klflib.h>
00034 
00035 namespace Ui { class KLFStyleManager; }
00036 
00037 class KLFStyleListModel : public QStringListModel
00038 {
00039   Q_OBJECT
00040 public:
00041   KLFStyleListModel(QObject *parent = 0) : QStringListModel(parent) { }
00042   virtual ~KLFStyleListModel() { }
00043 
00044   virtual Qt::ItemFlags flags(const QModelIndex& index) const;
00045 
00046   virtual QString styleName(int row) const;
00047   virtual void setStyleName(int row, const QString& newname);
00048 
00049   Qt::DropActions supportedDropActions() const;
00050   QStringList mimeTypes() const;
00051   QMimeData *mimeData(const QModelIndexList& indexes) const;
00052   bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row,
00053                     int column, const QModelIndex &parent);
00054 
00055 signals:
00056   void internalMoveCompleted(int prevrow, int newrow);
00057 };
00058 
00059 
00060 class KLFStyleManager : public QWidget
00061 {
00062   Q_OBJECT
00063 public:
00064   KLFStyleManager(KLFStyleList *ptr, QWidget *parent);
00065   ~KLFStyleManager();
00066 
00067 signals:
00068   void refreshStyles();
00069 
00070 public slots:
00071 
00072   void slotRefresh();
00073 
00074   void slotDelete();
00075   void slotMoveUp();
00076   void slotMoveDown();
00077   void slotRename();
00078 
00079   void refreshActionsEnabledState();
00080   void showActionsContextMenu(const QPoint& pos);
00081 
00082   void retranslateUi(bool alsoBaseUi = true);
00083 
00084 protected slots:
00085   void slotModelMoveCompleted(int previouspos, int newpos);
00086 
00087 private:
00088   Ui::KLFStyleManager *u;
00089 
00090   KLFStyleList *_styptr;
00091 
00092   QMenu *mActionsPopup;
00093 
00094   QAction *actPopupDelete;
00095   QAction *actPopupMoveUp;
00096   QAction *actPopupMoveDown;
00097   QAction *actPopupRename;
00098 
00099   KLFStyleListModel *mStyleListModel;
00100 
00101   QPoint _drag_init_pos;
00102   QListWidgetItem *_drag_item;
00103 
00104   int currentRow();
00105 };
00106 
00107 #endif
00108 

Generated by doxygen 1.7.3