]> git.lyx.org Git - lyx.git/blob - src/minibuffer.h
Switch from SigC signals to boost::signals
[lyx.git] / src / minibuffer.h
1 // -*- C++ -*-
2 #ifndef MINIBUFFER_H
3 #define MINIBUFFER_H
4
5 #include "LString.h"
6
7 #include <boost/signals/signal0.hpp>
8 #include <boost/signals/signal1.hpp>
9 #include <boost/signals/trackable.hpp>
10
11 #include <vector>
12
13 #include FORMS_H_LOCATION
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 class LyXView;
20 class DropDown;
21 class Timeout;
22
23 ///
24 class MiniBuffer : public boost::signals::trackable {
25 public:
26         enum State {
27                 spaces,
28                 nospaces
29         };
30
31         ///
32         MiniBuffer(LyXView * o,
33                    FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
34
35         /// destructor
36         ~MiniBuffer();
37
38         /// create drop down
39         void dd_init();
40
41         ///
42         void addSet(string const &,
43                     string const & = string());
44
45         ///
46         void message(string const & str);
47         ///
48         void messagePush(string const & str);
49         ///
50         void messagePop();
51
52         /** Makes the minibuffer wait for a string to be inserted.
53             Waits for a string to be inserted into the minibuffer, when
54             the string has been inserted the signal stringReady is
55             emitted.
56         */
57         void getString(State space,
58                        std::vector<string> const & completion,
59                        std::vector<string> & history);
60         ///
61         void redraw();
62         ///
63         int peek_event(FL_OBJECT *, int, int);
64         ///
65         boost::signal1<void, string const &> stringReady;
66         ///
67         //boost::signal0<void> escape;
68         ///
69         boost::signal0<void> timeout;
70 private:
71         ///
72         void activate();
73         ///
74         void deactivate();
75         ///
76         void prepare();
77         ///
78         void stored_slot();
79         ///
80         void stored_set(string const &);
81         /// set the minibuffer content if str non-empty
82         void set_complete_input(string const &);
83         /// append c to the current contents
84         void append_char(char c);
85         /// set the minibuffer content
86         void set_input(string const &);
87         ///
88         void init();
89         ///
90         string stored_input;
91         ///
92         bool stored_;
93         ///
94         LyXView * owner_;
95         ///
96         string text;
97         ///
98         string text_stored;
99         ///
100         FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
101         ///
102         Timeout * timer;
103         ///
104         Timeout * stored_timer;
105         /// the dropdown menu
106         DropDown * dropdown_;
107         ///
108         FL_OBJECT * the_buffer;
109         ///
110         std::vector<string> completion_;
111         ///
112         std::vector<string> * history_;
113         ///
114         std::vector<string>::iterator hist_iter;
115         ///
116         State state_;
117 };
118 #endif