]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XMiniBuffer.h
add connection objects and assign to them to
[lyx.git] / src / frontends / xforms / XMiniBuffer.h
1 // -*- C++ -*-
2 /**
3  * \file XMiniBuffer.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Lars
8  * \author Asger and Juergen
9  * \author John Levon <levon@movementarian.org>
10  */
11
12 #ifndef XMINIBUFFER_H
13 #define XMINIBUFFER_H
14
15 #include FORMS_H_LOCATION
16
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/signals/connection.hpp>
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 class DropDown;
25 class ControlCommandBuffer;
26 class Timeout;
27
28 /// in xforms, the minibuffer is both a status bar and a command buffer
29 class XMiniBuffer {
30 public:
31         ///
32         XMiniBuffer(XFormsView * o, ControlCommandBuffer & control,
33                     FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
34
35         ///
36         ~XMiniBuffer();
37
38         /// create drop down
39         void dd_init();
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(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 private:
57         /// Are we in editing mode?
58         bool isEditingMode() const;
59
60         /// reset buffer to stored input text
61         void info_timeout();
62
63         /// go back to "at rest" message
64         void idle_timeout();
65
66         /**
67          * Append "c" to the current input contents when the completion
68          * list is displayed and has focus.
69          */
70         void append_char(char c);
71
72         /// completion selection callback
73         void set_complete_input(string const & str);
74
75         /// set the minibuffer content in editing mode
76         void set_input(string const &);
77
78         /// This creates the input widget for the minibuffer
79         FL_OBJECT * create_input_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
80
81         /// go into message mode
82         void messageMode(bool on = true);
83
84         /// show a temporary message whilst in edit mode
85         void show_info(string const & info, string const & input, bool append = true);
86
87         /// the dropdown menu
88         boost::scoped_ptr<DropDown> dropdown_;
89
90         /// info timer
91         boost::scoped_ptr<Timeout> info_timer_;
92
93         /// idle timer
94         boost::scoped_ptr<Timeout> idle_timer_;
95
96         ///
97         boost::signals::connection info_con;
98         ///
99         boost::signals::connection idle_con;
100         ///
101         boost::signals::connection result_con;
102         ///
103         boost::signals::connection keypress_con;
104         /// This is the input widget object
105         FL_OBJECT * the_buffer_;
106
107         /// the input box
108         FL_OBJECT * input_obj_;
109
110         /// the controller we use
111         ControlCommandBuffer & controller_;
112
113         /// the lyx view
114         XFormsView * view_;
115
116         /// stored input when showing info
117         string stored_input_;
118
119         /// are we showing an informational temporary message ?
120         bool info_shown_;
121 };
122
123 #endif // XMINIBUFFER_H