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