Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

UndoState Class Reference

UndoState describes an undoable state (action). More...

#include <undostate.h>

Inheritance diagram for UndoState:

Inheritance graph
[legend]
Collaboration diagram for UndoState:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 UndoState (const QString &name, const QString &description=0, QPixmap *pixmap=0)
 Creates a new UndoState instance.
virtual ~UndoState ()
virtual QString getName ()
 Returns name of the state (action).
virtual void setName (const QString &newName)
 Set the name for this UndoState.
virtual QString getDescription ()
 Returns description of the state.
virtual void setDescription (const QString &newDescription)
 Set the description for this UndoState.
virtual QPixmap * getPixmap ()
 Returns a pointer to the icon attached to the state.
virtual void setPixmap (QPixmap *newPixmap)
 Set the icon for this UndoState.
virtual void undo ()
 undo the state described by this UndoState,
virtual void redo ()
 redo the state described by this UndoState,
virtual void setUndoObject (UndoObject *object)
 Set the UndoObject this state belongs to.
virtual UndoObjectundoObject ()
 return the UndoObject this state belongs to

Private Attributes

QString actionName_
 Name of the state (operation) (f.e. Move object).
QString actionDescription_
 Detailed description of the state (operation).
QPixmap * actionPixmap_
 Icon related to the state (operation).
UndoObjectPtr undoObject_
 UndoObject this state belongs to.


Detailed Description

UndoState describes an undoable state (action).

Undoable objects implement undo/redo by sending and receiving UndoState subclasses. This means that they will need to produce some sort of information for the UndoState subclass (if no suitable subclass exists it must be also created) and later they will need to be able to restore the state described by the subclass to apply undo/redo.

UndoManager will handle the deletion of UndoState objects.

See also:
SimpleState
Author:
Riku Leino riku@scribus.info
Date:
December 2004

Definition at line 54 of file undostate.h.


Constructor & Destructor Documentation

UndoState::UndoState ( const QString &  name,
const QString &  description = 0,
QPixmap *  pixmap = 0 
)

Creates a new UndoState instance.

Parameters:
name Name of the state (action). Will be used when describing the state in UndoGui subclasses.
description Description of the state (action)
pixmap Pointer to an icon describing the action visually.

Definition at line 30 of file undostate.cpp.

UndoState::~UndoState (  )  [virtual]

Definition at line 91 of file undostate.cpp.


Member Function Documentation

QString UndoState::getName (  )  [virtual]

void UndoState::setName ( const QString &  newName  )  [virtual]

Set the name for this UndoState.

Parameters:
newName name for this UndoState

Definition at line 44 of file undostate.cpp.

References actionName_.

Referenced by UndoManager::beginTransaction(), UndoTransaction::commit(), and TransactionState::useActionName().

QString UndoState::getDescription (  )  [virtual]

Returns description of the state.

Returns:
description of the state

Definition at line 49 of file undostate.cpp.

References actionDescription_.

Referenced by UndoPalette::insertRedoItem(), and UndoPalette::insertUndoItem().

void UndoState::setDescription ( const QString &  newDescription  )  [virtual]

Set the description for this UndoState.

Parameters:
newDescription description for this UndoState

Definition at line 54 of file undostate.cpp.

References actionDescription_.

Referenced by UndoManager::beginTransaction(), and UndoTransaction::commit().

QPixmap * UndoState::getPixmap (  )  [virtual]

Returns a pointer to the icon attached to the state.

Returns:
A pointer to the icon attached to the state

Definition at line 59 of file undostate.cpp.

References actionPixmap_.

Referenced by UndoPalette::insertRedoItem(), and UndoPalette::insertUndoItem().

void UndoState::setPixmap ( QPixmap *  newPixmap  )  [virtual]

Set the icon for this UndoState.

Parameters:
newPixmap icon for this UndoState

Definition at line 64 of file undostate.cpp.

References actionPixmap_.

Referenced by UndoManager::beginTransaction(), and UndoTransaction::commit().

void UndoState::undo (  )  [virtual]

undo the state described by this UndoState,

requires related UndoObject

Reimplemented in TransactionState.

Definition at line 69 of file undostate.cpp.

References undoObject_.

Referenced by UndoStack::undo(), and TransactionState::undo().

void UndoState::redo (  )  [virtual]

redo the state described by this UndoState,

requires the related UndoObject

Reimplemented in TransactionState.

Definition at line 75 of file undostate.cpp.

References undoObject_.

Referenced by UndoStack::redo(), and TransactionState::redo().

void UndoState::setUndoObject ( UndoObject object  )  [virtual]

Set the UndoObject this state belongs to.

Definition at line 81 of file undostate.cpp.

References undoObject_.

Referenced by UndoManager::action(), TransactionState::pushBack(), and UndoManager::replaceObject().

UndoObject * UndoState::undoObject (  )  [virtual]


Member Data Documentation

QString UndoState::actionName_ [private]

Name of the state (operation) (f.e. Move object).

Definition at line 118 of file undostate.h.

Referenced by getName(), and setName().

QString UndoState::actionDescription_ [private]

Detailed description of the state (operation).

Definition at line 120 of file undostate.h.

Referenced by getDescription(), and setDescription().

QPixmap* UndoState::actionPixmap_ [private]

Icon related to the state (operation).

Definition at line 122 of file undostate.h.

Referenced by getPixmap(), and setPixmap().

UndoObject this state belongs to.

Definition at line 124 of file undostate.h.

Referenced by redo(), setUndoObject(), undo(), and undoObject().


The documentation for this class was generated from the following files:
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.