// -*- C++ -*-
/**
* \file XMiniBuffer.h
- * Copyright 1995-2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
* \author Lars
- * \author Asger and Juergen
+ * \author Asger and Jürgen
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
*/
#ifndef XMINIBUFFER_H
#define XMINIBUFFER_H
-#include "frontends/MiniBuffer.h"
+#include "lyx_forms.h"
+
+#include "LayoutEngine.h"
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/signals/connection.hpp>
+
+struct fl_freebrowser_;
+typedef fl_freebrowser_ FL_FREEBROWSER;
-#include FORMS_H_LOCATION
+class Timeout;
-#ifdef __GNUG__
-#pragma interface
-#endif
+namespace lyx {
+namespace frontend {
-class DropDown;
+class XFormsView;
+class ControlCommandBuffer;
-///
-class XMiniBuffer : public MiniBuffer {
+/// in xforms, the minibuffer is both a status bar and a command buffer
+class XMiniBuffer {
public:
///
- XMiniBuffer(LyXView * o,
- FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
+ XMiniBuffer(XFormsView & owner, ControlCommandBuffer & control);
- /// destructor
+ ///
~XMiniBuffer();
- /// create drop down
- void dd_init();
-
- ///
+ /// repaint the minibuffer
void redraw();
- ///
+ /// command completion, history, etc. management
int peek_event(FL_OBJECT *, int, int, XEvent * xev);
-protected:
+ /// show a message
+ void message(std::string const & str);
+
+ /// focus the buffer for editing mode
+ void focus() { messageMode(false); }
+
+ /// disable event management
+ void freeze();
+
+ /// xforms callback routine
+ void freebrowserCB(int action);
+
+private:
/// Are we in editing mode?
- virtual bool isEditingMode() const;
- /// enter editing mode
- virtual void editingMode();
- /// enter message display mode
- virtual void messageMode();
-
- /**
- * Append "c" to the current input contents when the completion
- * list is displayed and has focus.
- */
- void append_char(char c);
+ bool isEditingMode() const;
+
+ /// reset buffer to stored input text
+ void info_timeout();
+
+ /// go back to "at rest" message
+ void idle_timeout();
/// set the minibuffer content in editing mode
- virtual void set_input(string const &);
+ void set_input(std::string const &);
+
+ /// go into message mode
+ void messageMode(bool on = true);
- /// This creates the input widget for the minibuffer
- FL_OBJECT * create_input_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
+ /// show a temporary message whilst in edit mode
+ void show_info(std::string const & info, std::string const & input, bool append = true);
/// the dropdown menu
- DropDown * dropdown_;
+ boost::shared_ptr<FL_FREEBROWSER> freebrowser_;
+
+ /// info timer
+ boost::scoped_ptr<Timeout> info_timer_;
+
+ /// idle timer
+ boost::scoped_ptr<Timeout> idle_timer_;
+
+ ///
+ boost::signals::connection info_con;
+ ///
+ boost::signals::connection idle_con;
+ ///
+ boost::signals::connection result_con;
+ ///
+ boost::signals::connection keypress_con;
/// This is the input widget object
- FL_OBJECT * the_buffer;
+ FL_OBJECT * input_;
+
+ /// the controller we use
+ ControlCommandBuffer & controller_;
+
+ /// stored input when showing info
+ std::string stored_input_;
+
+ /// are we showing an informational temporary message ?
+ bool info_shown_;
+ ///
+ boost::shared_ptr<Box> minibuffer_;
+ ///
+ WidgetMap widgets_;
};
-#endif
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // XMINIBUFFER_H