]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XMiniBuffer.h
I fixed the two bugs (Very shallow in fact)
[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  
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
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         XMiniBuffer(XFormsView * o, ControlCommandBuffer & control,
31                     FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
32
33         ~XMiniBuffer();
34
35         /// create drop down
36         void dd_init();
37
38         /// repaint the minibuffer
39         void redraw();
40
41         /// command completion, history, etc. management
42         int peek_event(FL_OBJECT *, int, int, XEvent * xev);
43
44         /// show a message
45         void message(string const & str);
46  
47         /// focus the buffer for editing mode
48         void focus() { messageMode(false); }
49  
50         /// disable event management
51         void freeze();
52  
53 protected:
54         /// Are we in editing mode?
55         bool isEditingMode() const;
56
57         /// reset buffer to stored input text
58         void suffix_timeout();
59
60         /// go back to "at rest" message
61         void idle_timeout();
62  
63         /**
64          * Append "c" to the current input contents when the completion
65          * list is displayed and has focus.
66          */
67         void append_char(char c);
68  
69         /// completion selection callback 
70         void set_complete_input(string const & str);
71
72         /// set the minibuffer content in editing mode
73         void set_input(string const &);
74
75         /// This creates the input widget for the minibuffer
76         FL_OBJECT * create_input_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
77
78         /// go into message mode
79         void messageMode(bool on = true);
80  
81         /// show a temporary message whilst in edit mode
82         void show_info_suffix(string const & suffix, string const & input);
83
84         /// the dropdown menu
85         boost::scoped_ptr<DropDown> dropdown_;
86
87         /// info suffix timer
88         boost::scoped_ptr<Timeout> suffix_timer_;
89
90         /// idle timer
91         boost::scoped_ptr<Timeout> idle_timer_;
92  
93         /// This is the input widget object
94         FL_OBJECT * the_buffer_;
95
96         /// the input box
97         FL_OBJECT * input_obj_;
98  
99         /// the controller we use
100         ControlCommandBuffer & controller_;
101
102         /// the lyx view
103         XFormsView * view_;
104
105         /// stored input when showing suffix info
106         string stored_input_;
107
108         /// are we showing an informational suffix of the mesage ?
109         bool info_suffix_shown_;
110 };
111  
112 #endif // XMINIBUFFER_H