⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 command.h

📁 Linux下的基于X11的图形开发环境。
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************ Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.**** This file is part of Qt Designer.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#ifndef COMMAND_H#define COMMAND_H#include "metadatabase.h"#include "layout.h"#include <qstring.h>#include <qrect.h>#include <qvaluelist.h>#include <qvariant.h>#include <qobject.h>#include <qlistview.h>#include <qptrlist.h>#include <qmap.h>class QWizard;class QTabWidget;class Command;class QWidget;class FormWindow;class PropertyEditor;class QListBox;class QIconView;class QTable;class QAction;class QDesignerToolBar;class QMainWindow;class QDesignerPopupMenu;class QDesignerMenuBar;class QTextEdit;struct LanguageInterface;class Command : public Qt{public:    Command( const QString &n, FormWindow *fw );    virtual ~Command();    enum Type {	Resize,	Insert,	Move,	Delete,	SetProperty,	LayoutHorizontal,	LayoutVertical,	LayoutHorizontalSplitter,	LayoutVerticalSplitter,	LayoutGrid,	BreakLayout,	Macro,	AddTabPage,	DeleteTabPage,	MoveTabPage,	AddWidgetStackPage,	DeleteWidgetStackPage,	AddWizardPage,	DeleteWizardPage,	SwapWizardPages,	MoveWizardPage,	RenameWizardPage,	AddConnection,	RemoveConnection,	Lower,	Raise,	Paste,	TabOrder,	PopulateListBox,	PopulateIconView,	PopulateListView,	PopulateMultiLineEdit,	PopulateTable,	AddActionToToolBar,	RemoveActionFromToolBar,	AddActionToPopup,	RemoveActionFromPopup,	AddMenu,	RemoveMenu,	RenameMenu,	MoveMenu,	AddToolBar,	RemoveToolBar,	AddFunction,	ChangeFunctionAttrib,	RemoveFunction,	AddVariable,	SetVariables,	RemoveVariable,	EditDefinitions,	AddContainerPage,	DeleteContainerPage,	RenameContainerPage    };    QString name() const;    virtual void execute() = 0;    virtual void unexecute() = 0;    virtual Type type() const = 0;    virtual void merge( Command *c );    virtual bool canMerge( Command *c );    FormWindow *formWindow() const;private:    QString cmdName;    FormWindow *formWin;};class CommandHistory : public QObject{    Q_OBJECTpublic:    CommandHistory( int s );    void addCommand( Command *cmd, bool tryCompress = FALSE );    void undo();    void redo();    void emitUndoRedo();    void setModified( bool m );    bool isModified() const;public slots:    void checkCompressedCommand();signals:    void undoRedoChanged( bool undoAvailable, bool redoAvailable,			  const QString &undoCmd, const QString &redoCmd );    void modificationChanged( bool m );private:    QPtrList<Command> history;    int current, steps;    bool modified;    int savedAt;    Command *compressedCommand;};class ResizeCommand : public Command{public:    ResizeCommand( const QString &n, FormWindow *fw,		   QWidget *w, const QRect &oldr, const QRect &nr );    void execute();    void unexecute();    Type type() const { return Resize; }private:    QWidget *widget;    QRect oldRect, newRect;};class InsertCommand : public Command{public:    InsertCommand( const QString &n, FormWindow *fw, QWidget *w, const QRect &g );    void execute();    void unexecute();    Type type() const { return Insert; }private:    QWidget *widget;    QRect geometry;};class MoveCommand : public Command{public:    MoveCommand( const QString &n, FormWindow *fw,		 const QWidgetList &w,		 const QValueList<QPoint> op,		 const QValueList<QPoint> np,		 QWidget *opr, QWidget *npr );    void execute();    void unexecute();    Type type() const { return Move; }    void merge( Command *c );    bool canMerge( Command *c );private:    QWidgetList widgets;    QValueList<QPoint> oldPos, newPos;    QWidget *oldParent, *newParent;};class DeleteCommand : public Command{public:    DeleteCommand( const QString &n, FormWindow *fw,		   const QWidgetList &w );    void execute();    void unexecute();    Type type() const { return Delete; }private:    QWidgetList widgets;    QMap< QWidget*, QValueList<MetaDataBase::Connection> > connections;};class SetPropertyCommand : public Command{public:    SetPropertyCommand( const QString &n, FormWindow *fw,			QObject *w, PropertyEditor *e,			const QString &pn, const QVariant &ov,			const QVariant &nv, const QString &ncut,			const QString &ocut,			bool reset = FALSE );    void execute();    void unexecute();    Type type() const { return SetProperty; }    void merge( Command *c );    bool canMerge( Command *c );    bool checkProperty();private:    void setProperty( const QVariant &v, const QString &currentItemText, bool select = TRUE );    QObject *widget;    PropertyEditor *editor;    QString propName;    QVariant oldValue, newValue;    QString oldCurrentItemText, newCurrentItemText;    bool wasChanged;    bool isResetCommand;};class LayoutHorizontalCommand : public Command{public:    LayoutHorizontalCommand( const QString &n, FormWindow *fw,			     QWidget *parent, QWidget *layoutBase,			     const QWidgetList &wl );    void execute();    void unexecute();    Type type() const { return LayoutHorizontal; }private:    HorizontalLayout layout;};class LayoutHorizontalSplitCommand : public Command{public:    LayoutHorizontalSplitCommand( const QString &n, FormWindow *fw,				  QWidget *parent, QWidget *layoutBase,				  const QWidgetList &wl );    void execute();    void unexecute();    Type type() const { return LayoutHorizontalSplitter; }private:    HorizontalLayout layout;};class LayoutVerticalCommand : public Command{public:    LayoutVerticalCommand( const QString &n, FormWindow *fw,			   QWidget *parent, QWidget *layoutBase,			   const QWidgetList &wl );    void execute();    void unexecute();    Type type() const { return LayoutVertical; }private:    VerticalLayout layout;};class LayoutVerticalSplitCommand : public Command{public:    LayoutVerticalSplitCommand( const QString &n, FormWindow *fw,				QWidget *parent, QWidget *layoutBase,				const QWidgetList &wl );    void execute();    void unexecute();    Type type() const { return LayoutVerticalSplitter; }private:    VerticalLayout layout;};class LayoutGridCommand : public Command{public:    LayoutGridCommand( const QString &n, FormWindow *fw,		       QWidget *parent, QWidget *layoutBase,		       const QWidgetList &wl, int xres, int yres );    void execute();    void unexecute();    Type type() const { return LayoutGrid; }private:    GridLayout layout;};class BreakLayoutCommand : public Command{public:    BreakLayoutCommand( const QString &n, FormWindow *fw,			QWidget *layoutBase, const QWidgetList &wl );    void execute();    void unexecute();    Type type() const { return BreakLayout; }private:    Layout *layout;    int spacing;    int margin;    QWidget *lb;    QWidgetList widgets;};class MacroCommand : public Command{public:    MacroCommand( const QString &n, FormWindow *fw,		  const QPtrList<Command> &cmds );    void execute();    void unexecute();    Type type() const { return Macro; }private:    QPtrList<Command> commands;};class AddTabPageCommand : public Command{public:    AddTabPageCommand( const QString &n, FormWindow *fw,		       QTabWidget *tw, const QString &label );    void execute();    void unexecute();    Type type() const { return AddTabPage; }private:    QTabWidget *tabWidget;    int index;    QWidget *tabPage;    QString tabLabel;};class DeleteTabPageCommand : public Command{public:    DeleteTabPageCommand( const QString &n, FormWindow *fw,			  QTabWidget *tw, QWidget *page );    void execute();    void unexecute();    Type type() const { return DeleteTabPage; }private:    QTabWidget *tabWidget;    int index;    QWidget *tabPage;    QString tabLabel;};class MoveTabPageCommand : public Command{public:    MoveTabPageCommand(const QString &n, FormWindow *fw,		       QTabWidget *tw, QWidget *page,  const QString& label, int nIndex, int oIndex );    void execute();    void unexecute();    Type type() const { return MoveTabPage; }private:    QTabWidget *tabWidget;    int newIndex, oldIndex;    QWidget *tabPage;    QString tabLabel;};class QDesignerWidgetStack;class AddWidgetStackPageCommand : public Command{public:    AddWidgetStackPageCommand( const QString &n, FormWindow *fw,			       QDesignerWidgetStack *ws );    void execute();    void unexecute();    Type type() const { return AddWidgetStackPage; }private:    QDesignerWidgetStack *widgetStack;    int index;    QWidget *stackPage;};class DeleteWidgetStackPageCommand : public Command{public:    DeleteWidgetStackPageCommand( const QString &n, FormWindow *fw,				  QDesignerWidgetStack *ws, QWidget *page );    void execute();    void unexecute();    Type type() const { return DeleteWidgetStackPage; }private:    QDesignerWidgetStack *widgetStack;    int index;    QWidget *stackPage;};class AddWizardPageCommand : public Command{public:    AddWizardPageCommand( const QString &n, FormWindow *fw,			  QWizard *w, const QString &label, int index = -1, bool show = TRUE );    void execute();    void unexecute();    Type type() const { return AddWizardPage; }private:    QWizard *wizard;    int index;    bool show;    QWidget *page;    QString pageLabel;};class DeleteWizardPageCommand : public Command{public:    DeleteWizardPageCommand( const QString &n, FormWindow *fw,			     QWizard *w, int index, bool show = TRUE );    void execute();    void unexecute();    Type type() const { return DeleteWizardPage; }private:    QWizard *wizard;    int index;    bool show;    QWidget *page;    QString pageLabel;};class RenameWizardPageCommand : public Command{public:    RenameWizardPageCommand( const QString &n, FormWindow *fw,			     QWizard *w, int index, const QString& name );    void execute();    void unexecute();    Type type() const { return RenameWizardPage; }private:    QWizard *wizard;    int index;    QWidget *page;    QString label;};class SwapWizardPagesCommand : public Command{public:    SwapWizardPagesCommand( const QString &n, FormWindow *fw,			      QWizard *w, int index1, int index2 );    void execute();    void unexecute();    Type type() const { return SwapWizardPages; }private:    QWizard *wizard;    int index1, index2;};class MoveWizardPageCommand : public Command{public:    MoveWizardPageCommand( const QString &n, FormWindow *fw,			      QWizard *w, int index1, int index2 );    void execute();    void unexecute();    Type type() const { return MoveWizardPage; }private:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -