]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XMiniBuffer.h
Change glob() API to accept a dir parameter.
[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 Timeout;
29
30 namespace lyx {
31 namespace frontend {
32
33 class XFormsView;
34 class ControlCommandBuffer;
35
36 /// in xforms, the minibuffer is both a status bar and a command buffer
37 class XMiniBuffer {
38 public:
39         ///
40         XMiniBuffer(XFormsView & owner, ControlCommandBuffer & control);
41
42         ///
43         ~XMiniBuffer();
44
45         /// repaint the minibuffer
46         void redraw();
47
48         /// command completion, history, etc. management
49         int peek_event(FL_OBJECT *, int, int, XEvent * xev);
50
51         /// show a message
52         void message(std::string const & str);
53
54         /// focus the buffer for editing mode
55         void focus() { messageMode(false); }
56
57         /// disable event management
58         void freeze();
59
60         /// xforms callback routine
61         void freebrowserCB(int action);
62
63 private:
64         /// Are we in editing mode?
65         bool isEditingMode() const;
66
67         /// reset buffer to stored input text
68         void info_timeout();
69
70         /// go back to "at rest" message
71         void idle_timeout();
72
73         /// set the minibuffer content in editing mode
74         void set_input(std::string const &);
75
76         /// go into message mode
77         void messageMode(bool on = true);
78
79         /// show a temporary message whilst in edit mode
80         void show_info(std::string const & info, std::string const & input, bool append = true);
81
82         /// the dropdown menu
83         boost::shared_ptr<FL_FREEBROWSER> freebrowser_;
84
85         /// info timer
86         boost::scoped_ptr<Timeout> info_timer_;
87
88         /// idle timer
89         boost::scoped_ptr<Timeout> idle_timer_;
90
91         ///
92         boost::signals::connection info_con;
93         ///
94         boost::signals::connection idle_con;
95         ///
96         boost::signals::connection result_con;
97         ///
98         boost::signals::connection keypress_con;
99
100         /// This is the input widget object
101         FL_OBJECT * input_;
102
103         /// the controller we use
104         ControlCommandBuffer & controller_;
105
106         /// stored input when showing info
107         std::string stored_input_;
108
109         /// are we showing an informational temporary message ?
110         bool info_shown_;
111         ///
112         boost::shared_ptr<Box> minibuffer_;
113         ///
114         WidgetMap widgets_;
115 };
116
117 } // namespace frontend
118 } // namespace lyx
119
120 #endif // XMINIBUFFER_H