]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XMiniBuffer.h
dont use pragma impementation and interface anymore
[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 Juergen
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 FORMS_H_LOCATION
18
19 #include <boost/scoped_ptr.hpp>
20 #include <boost/signals/connection.hpp>
21
22
23 class DropDown;
24 class ControlCommandBuffer;
25 class Timeout;
26
27 /// in xforms, the minibuffer is both a status bar and a command buffer
28 class XMiniBuffer {
29 public:
30         ///
31         XMiniBuffer(XFormsView * o, ControlCommandBuffer & control,
32                     FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
33
34         ///
35         ~XMiniBuffer();
36
37         /// create drop down
38         void dd_init();
39
40         /// repaint the minibuffer
41         void redraw();
42
43         /// command completion, history, etc. management
44         int peek_event(FL_OBJECT *, int, int, XEvent * xev);
45
46         /// show a message
47         void message(string const & str);
48
49         /// focus the buffer for editing mode
50         void focus() { messageMode(false); }
51
52         /// disable event management
53         void freeze();
54
55 private:
56         /// Are we in editing mode?
57         bool isEditingMode() const;
58
59         /// reset buffer to stored input text
60         void info_timeout();
61
62         /// go back to "at rest" message
63         void idle_timeout();
64
65         /**
66          * Append "c" to the current input contents when the completion
67          * list is displayed and has focus.
68          */
69         void append_char(char c);
70
71         /// completion selection callback
72         void set_complete_input(string const & str);
73
74         /// set the minibuffer content in editing mode
75         void set_input(string const &);
76
77         /// This creates the input widget for the minibuffer
78         FL_OBJECT * create_input_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
79
80         /// go into message mode
81         void messageMode(bool on = true);
82
83         /// show a temporary message whilst in edit mode
84         void show_info(string const & info, string const & input, bool append = true);
85
86         /// the dropdown menu
87         boost::scoped_ptr<DropDown> dropdown_;
88
89         /// info timer
90         boost::scoped_ptr<Timeout> info_timer_;
91
92         /// idle timer
93         boost::scoped_ptr<Timeout> idle_timer_;
94
95         ///
96         boost::signals::connection info_con;
97         ///
98         boost::signals::connection idle_con;
99         ///
100         boost::signals::connection result_con;
101         ///
102         boost::signals::connection keypress_con;
103         /// This is the input widget object
104         FL_OBJECT * the_buffer_;
105
106         /// the input box
107         FL_OBJECT * input_obj_;
108
109         /// the controller we use
110         ControlCommandBuffer & controller_;
111
112         /// the lyx view
113         XFormsView * view_;
114
115         /// stored input when showing info
116         string stored_input_;
117
118         /// are we showing an informational temporary message ?
119         bool info_shown_;
120 };
121
122 #endif // XMINIBUFFER_H