lyx_mirror/src/DispatchResult.h
Richard Heck 4daf7b5dfc The Buffer::dispatch() patch.
This patch enhances the Buffer::dispatch() method to make it a full-fledged
member of the dispatch sequence. The most immediate payoff is that LFUNs that
are handled in Buffer::dispatch() can be used from the command line.

We make better use of the DispatchResult object and return error information 
through it, rather than using return values. (This was JMarc's suggestion.) We 
also introduce a  corresponding Buffer::getStatus() method, and modify 
BufferView::getStatus() to return a flag indicating whether a decision has been 
made, as is already done in some other cases.

Finally, some LFUNs are moved to Buffer::dispatch(), including LFUN_BUFFER_PRINT.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29125 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-06 12:12:06 +00:00

60 lines
1.2 KiB
C++

// -*- C++ -*-
/**
* \file DispatchResult.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author none
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef DISPATCH_RESULT_H
#define DISPATCH_RESULT_H
#include "update_flags.h"
#include "support/docstring.h"
namespace lyx {
/// Maybe this can go entirely
class DispatchResult {
public:
///
DispatchResult() : dispatched_(false), update_(Update::None) {}
///
DispatchResult(bool disp, Update::flags f) : dispatched_(disp), update_(f) {}
///
bool dispatched() const { return dispatched_; }
///
void dispatched(bool disp) { dispatched_ = disp; }
///
bool error() const { return error_; }
///
void setError(bool e) { error_ = e; }
///
docstring message() { return message_; }
///
void setMessage(docstring m) { message_ = m; }
///
Update::flags update() const { return update_; }
///
void update(Update::flags f) { update_ = f; }
private:
/// was the event fully dispatched?
bool dispatched_;
/// was there an error?
bool error_;
/// do we need to redraw the screen afterwards?
Update::flags update_;
///
docstring message_;
};
} // namespace lyx
#endif // DISPATCH_RESULT_H