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