]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FeedbackController.h
iThe cursor now behaves properly in the dialogs...
[lyx.git] / src / frontends / xforms / FeedbackController.h
1 // -*- C++ -*-
2 /*
3  * \file FeedbackController.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Angus Leeming, a.leeming@ic.ac.uk
8  **/
9
10 /* A common interface for posting feedback messages to a message widget in
11  * xforms.
12  * Derive FormBase and FormBaseDeprecated from it, so daughter classes of
13  * either can interface tooltips in the same way.
14  */
15
16 #ifndef FEEDBACKCONTROLLER_H
17 #define FEEDBACKCONTROLLER_H
18
19 #include FORMS_H_LOCATION
20 #include "LString.h"
21
22 #ifdef __GNUG__
23 #pragma interface
24 #endif
25
26 class FeedbackController
27 {
28 public:
29         ///
30         FeedbackController();
31         ///
32         virtual ~FeedbackController();
33
34         /** Input callback function, invoked only by the xforms callback
35             interface. Is defined by FormBase, FormBaseDeprecated. */
36         virtual void InputCB(FL_OBJECT *, long) = 0;
37
38         /** Message callback function, invoked only by the xforms callback
39             interface */
40         void MessageCB(FL_OBJECT *, int event);
41
42         /** Prehandler callback function, invoked only by the xforms callback
43             interface */
44         void PrehandlerCB(FL_OBJECT * ob, int event, int key);
45
46 protected:
47         /** Pass the class a pointer to the message_widget so that it can
48             post the message */
49         void setMessageWidget(FL_OBJECT * message_widget);
50
51         /** Send the warning message from the daughter class to the
52             message_widget direct. The message will persist till the mouse
53             movesto a new object. */
54         void postWarning(string const & warning);
55
56 private:
57         /** Get the feedback message for ob.
58             Called if warning_posted_ == false. */
59         virtual string const getFeedback(FL_OBJECT * /* ob */)
60                 { return string(); }
61
62         /// Post the feedback message for ob to message_widget_
63         void postMessage(string const & message);
64
65         /** Variable used to decide whether to remove the existing feedback
66             message or not (if it is in fact a warning) */
67         bool warning_posted_;
68
69         /// The widget to display the feedback
70         FL_OBJECT * message_widget_;
71 };
72
73 #endif // FEEDBACKCONTROLLER_H