RetroZilla/editor/txmgr/idl/nsITransaction.idl
2015-10-20 23:03:22 -04:00

96 lines
3.9 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/*
* The nsITransaction interface.
* <P>
* This interface is implemented by an object that needs to
* execute some behavior that must be tracked by the transaction manager.
*/
[scriptable, uuid(58e330c1-7b48-11d2-98b9-00805f297d89)]
interface nsITransaction : nsISupports
{
/**
* Executes the transaction.
*/
void doTransaction();
/**
* Restores the state to what it was before the transaction was executed.
*/
void undoTransaction();
/**
* Executes the transaction again. Can only be called on a transaction that
* was previously undone.
* <P>
* In most cases, the redoTransaction() method will actually call the
* doTransaction() method to execute the transaction again.
*/
void redoTransaction();
/**
* The transaction's transient state. This attribute is checked by
* the transaction manager after the transaction's Execute() method is called.
* If the transient state is false, a reference to the transaction is
* held by the transaction manager so that the transactions' undoTransaction()
* and redoTransaction() methods can be called. If the transient state is
* true, the transaction manager returns immediately after the transaction's
* doTransaction() method is called, no references to the transaction are
* maintained. Transient transactions cannot be undone or redone by the
* transaction manager.
*/
readonly attribute boolean isTransient;
/**
* Attempts to merge a transaction into "this" transaction. Both transactions
* must be in their undo state, doTransaction() methods already called. The
* transaction manager calls this method to coalesce a new transaction with
* the transaction on the top of the undo stack.
* This method returns a boolean value that indicates the merge result.
* A true value indicates that the transactions were merged successfully,
* a false value if the merge was not possible or failed. If true,
* the transaction manager will Release() the new transacton instead of
* pushing it on the undo stack.
* @param aTransaction the previously executed transaction to merge.
*/
boolean merge(in nsITransaction aTransaction);
};