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