2002-06-24 22:24:57 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file XMiniBuffer.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-24 22:24:57 +00:00
|
|
|
*
|
|
|
|
* \author Lars
|
|
|
|
* \author Asger and Juergen
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-24 22:24:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XMINIBUFFER_H
|
|
|
|
#define XMINIBUFFER_H
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
#include "lyx_forms.h"
|
2002-06-24 22:24:57 +00:00
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
#include "support/std_string.h"
|
2002-07-19 20:56:31 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-04-02 14:20:30 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2002-07-22 20:57:58 +00:00
|
|
|
#include <boost/signals/connection.hpp>
|
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
struct fl_freebrowser_;
|
|
|
|
typedef fl_freebrowser_ FL_FREEBROWSER;
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
class ControlCommandBuffer;
|
|
|
|
class Timeout;
|
2002-06-24 22:24:57 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// in xforms, the minibuffer is both a status bar and a command buffer
|
|
|
|
class XMiniBuffer {
|
2002-06-24 22:24:57 +00:00
|
|
|
public:
|
2002-07-22 20:57:58 +00:00
|
|
|
///
|
2003-04-02 09:23:24 +00:00
|
|
|
XMiniBuffer(ControlCommandBuffer & control,
|
2002-06-24 22:24:57 +00:00
|
|
|
FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
|
|
|
|
|
2002-07-22 20:57:58 +00:00
|
|
|
///
|
2002-06-24 22:24:57 +00:00
|
|
|
~XMiniBuffer();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// repaint the minibuffer
|
2002-06-24 22:24:57 +00:00
|
|
|
void redraw();
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// command completion, history, etc. management
|
2002-06-24 22:24:57 +00:00
|
|
|
int peek_event(FL_OBJECT *, int, int, XEvent * xev);
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// show a message
|
|
|
|
void message(string const & str);
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// focus the buffer for editing mode
|
|
|
|
void focus() { messageMode(false); }
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// disable event management
|
|
|
|
void freeze();
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2003-04-02 14:20:30 +00:00
|
|
|
/// xforms callback routine
|
|
|
|
void freebrowserCB(int action);
|
|
|
|
|
2002-07-22 20:57:58 +00:00
|
|
|
private:
|
2002-06-24 22:24:57 +00:00
|
|
|
/// Are we in editing mode?
|
2002-07-19 20:56:31 +00:00
|
|
|
bool isEditingMode() const;
|
|
|
|
|
|
|
|
/// reset buffer to stored input text
|
2002-07-20 17:27:03 +00:00
|
|
|
void info_timeout();
|
2002-06-24 22:24:57 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// go back to "at rest" message
|
|
|
|
void idle_timeout();
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-06-24 22:24:57 +00:00
|
|
|
/// set the minibuffer content in editing mode
|
2002-07-19 20:56:31 +00:00
|
|
|
void set_input(string const &);
|
2002-06-24 22:24:57 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// go into message mode
|
|
|
|
void messageMode(bool on = true);
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// show a temporary message whilst in edit mode
|
2002-07-20 17:27:03 +00:00
|
|
|
void show_info(string const & info, string const & input, bool append = true);
|
2002-07-19 20:56:31 +00:00
|
|
|
|
2002-06-24 22:24:57 +00:00
|
|
|
/// the dropdown menu
|
2003-04-02 14:20:30 +00:00
|
|
|
boost::shared_ptr<FL_FREEBROWSER> freebrowser_;
|
2002-06-24 22:24:57 +00:00
|
|
|
|
2002-07-20 17:27:03 +00:00
|
|
|
/// info timer
|
|
|
|
boost::scoped_ptr<Timeout> info_timer_;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
|
|
|
/// idle timer
|
|
|
|
boost::scoped_ptr<Timeout> idle_timer_;
|
2002-07-22 20:57:58 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
boost::signals::connection info_con;
|
|
|
|
///
|
|
|
|
boost::signals::connection idle_con;
|
|
|
|
///
|
|
|
|
boost::signals::connection result_con;
|
|
|
|
///
|
|
|
|
boost::signals::connection keypress_con;
|
2002-07-19 20:56:31 +00:00
|
|
|
|
2003-04-02 09:23:24 +00:00
|
|
|
/// This is the input widget object
|
|
|
|
FL_OBJECT * input_;
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// the controller we use
|
|
|
|
ControlCommandBuffer & controller_;
|
|
|
|
|
2002-07-20 17:27:03 +00:00
|
|
|
/// stored input when showing info
|
2002-07-19 20:56:31 +00:00
|
|
|
string stored_input_;
|
|
|
|
|
2002-07-20 17:27:03 +00:00
|
|
|
/// are we showing an informational temporary message ?
|
|
|
|
bool info_shown_;
|
2002-06-24 22:24:57 +00:00
|
|
|
};
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
#endif // XMINIBUFFER_H
|