]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XMiniBuffer.h
A layout engine for XForms.
[lyx.git] / src / frontends / xforms / XMiniBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file XMiniBuffer.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars
8  * \author Asger and Jürgen
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef XMINIBUFFER_H
15 #define XMINIBUFFER_H
16
17 #include "lyx_forms.h"
18
19 #include "LayoutEngine.h"
20
21 #include <boost/scoped_ptr.hpp>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/signals/connection.hpp>
24
25 struct fl_freebrowser_;
26 typedef fl_freebrowser_ FL_FREEBROWSER;
27
28 class XFormsView;
29 class ControlCommandBuffer;
30 class Timeout;
31
32 /// in xforms, the minibuffer is both a status bar and a command buffer
33 class XMiniBuffer {
34 public:
35         ///
36         XMiniBuffer(XFormsView & owner, ControlCommandBuffer & control);
37
38         ///
39         ~XMiniBuffer();
40
41         /// repaint the minibuffer
42         void redraw();
43
44         /// command completion, history, etc. management
45         int peek_event(FL_OBJECT *, int, int, XEvent * xev);
46
47         /// show a message
48         void message(std::string const & str);
49
50         /// focus the buffer for editing mode
51         void focus() { messageMode(false); }
52
53         /// disable event management
54         void freeze();
55
56         /// xforms callback routine
57         void freebrowserCB(int action);
58
59 private:
60         /// Are we in editing mode?
61         bool isEditingMode() const;
62
63         /// reset buffer to stored input text
64         void info_timeout();
65
66         /// go back to "at rest" message
67         void idle_timeout();
68
69         /// set the minibuffer content in editing mode
70         void set_input(std::string const &);
71
72         /// go into message mode
73         void messageMode(bool on = true);
74
75         /// show a temporary message whilst in edit mode
76         void show_info(std::string const & info, std::string const & input, bool append = true);
77
78         /// the dropdown menu
79         boost::shared_ptr<FL_FREEBROWSER> freebrowser_;
80
81         /// info timer
82         boost::scoped_ptr<Timeout> info_timer_;
83
84         /// idle timer
85         boost::scoped_ptr<Timeout> idle_timer_;
86
87         ///
88         boost::signals::connection info_con;
89         ///
90         boost::signals::connection idle_con;
91         ///
92         boost::signals::connection result_con;
93         ///
94         boost::signals::connection keypress_con;
95
96         /// This is the input widget object
97         FL_OBJECT * input_;
98
99         /// the controller we use
100         ControlCommandBuffer & controller_;
101
102         /// stored input when showing info
103         std::string stored_input_;
104
105         /// are we showing an informational temporary message ?
106         bool info_shown_;
107         ///
108         lyx::frontend::Box * minibuffer_;
109         ///
110         lyx::frontend::WidgetMap widgets_;
111 };
112
113 #endif // XMINIBUFFER_H