2002-03-11 09:54:42 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-05 14:10:50 +00:00
|
|
|
/**
|
2002-03-11 09:54:42 +00:00
|
|
|
* \file FeedbackController.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-11 09:54:42 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-03-11 17:00:41 +00:00
|
|
|
**/
|
|
|
|
|
|
|
|
/* A common interface for posting feedback messages to a message widget in
|
2002-03-11 09:54:42 +00:00
|
|
|
* xforms.
|
|
|
|
* Derive FormBase and FormBaseDeprecated from it, so daughter classes of
|
|
|
|
* either can interface tooltips in the same way.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FEEDBACKCONTROLLER_H
|
|
|
|
#define FEEDBACKCONTROLLER_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2002-08-14 19:19:47 +00:00
|
|
|
#include "forms_fwd.h"
|
|
|
|
#include "LString.h"
|
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
class FeedbackController
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
FeedbackController();
|
|
|
|
///
|
|
|
|
virtual ~FeedbackController();
|
|
|
|
|
|
|
|
/** Input callback function, invoked only by the xforms callback
|
|
|
|
interface. Is defined by FormBase, FormBaseDeprecated. */
|
|
|
|
virtual void InputCB(FL_OBJECT *, long) = 0;
|
|
|
|
|
|
|
|
/** Message callback function, invoked only by the xforms callback
|
|
|
|
interface */
|
|
|
|
void MessageCB(FL_OBJECT *, int event);
|
|
|
|
|
|
|
|
/** Prehandler callback function, invoked only by the xforms callback
|
|
|
|
interface */
|
|
|
|
void PrehandlerCB(FL_OBJECT * ob, int event, int key);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/** Pass the class a pointer to the message_widget so that it can
|
|
|
|
post the message */
|
|
|
|
void setMessageWidget(FL_OBJECT * message_widget);
|
|
|
|
|
|
|
|
/** Send the warning message from the daughter class to the
|
|
|
|
message_widget direct. The message will persist till the mouse
|
|
|
|
movesto a new object. */
|
|
|
|
void postWarning(string const & warning);
|
2002-03-20 17:53:39 +00:00
|
|
|
/// Reset the message_widget_
|
|
|
|
void clearMessage();
|
2002-03-11 09:54:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/** Get the feedback message for ob.
|
|
|
|
Called if warning_posted_ == false. */
|
|
|
|
virtual string const getFeedback(FL_OBJECT * /* ob */)
|
|
|
|
{ return string(); }
|
|
|
|
|
|
|
|
/// Post the feedback message for ob to message_widget_
|
|
|
|
void postMessage(string const & message);
|
|
|
|
|
|
|
|
/** Variable used to decide whether to remove the existing feedback
|
|
|
|
message or not (if it is in fact a warning) */
|
|
|
|
bool warning_posted_;
|
|
|
|
|
|
|
|
/// The widget to display the feedback
|
|
|
|
FL_OBJECT * message_widget_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FEEDBACKCONTROLLER_H
|