2002-06-24 22:24:57 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file XMiniBuffer.h
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Lars
|
|
|
|
* \author Asger and Juergen
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-06-24 22:24:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XMINIBUFFER_H
|
|
|
|
#define XMINIBUFFER_H
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2002-07-22 20:57:58 +00:00
|
|
|
#include <boost/signals/connection.hpp>
|
|
|
|
|
2002-06-24 22:24:57 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class DropDown;
|
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
|
|
|
///
|
2002-07-19 20:56:31 +00:00
|
|
|
XMiniBuffer(XFormsView * o, 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-07-28 18:13:51 +00:00
|
|
|
|
2002-06-24 22:24:57 +00:00
|
|
|
/// create drop down
|
|
|
|
void dd_init();
|
|
|
|
|
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
|
|
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Append "c" to the current input contents when the completion
|
|
|
|
* list is displayed and has focus.
|
|
|
|
*/
|
|
|
|
void append_char(char c);
|
2002-07-22 20:57:58 +00:00
|
|
|
|
|
|
|
/// completion selection callback
|
2002-07-19 20:56:31 +00:00
|
|
|
void set_complete_input(string const & str);
|
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
|
|
|
|
|
|
|
/// This creates the input widget for the minibuffer
|
|
|
|
FL_OBJECT * create_input_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
|
|
|
|
|
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
|
2002-07-19 20:56:31 +00:00
|
|
|
boost::scoped_ptr<DropDown> dropdown_;
|
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-06-24 22:24:57 +00:00
|
|
|
/// This is the input widget object
|
2002-07-19 20:56:31 +00:00
|
|
|
FL_OBJECT * the_buffer_;
|
|
|
|
|
|
|
|
/// the input box
|
|
|
|
FL_OBJECT * input_obj_;
|
2002-07-22 20:57:58 +00:00
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
/// the controller we use
|
|
|
|
ControlCommandBuffer & controller_;
|
|
|
|
|
|
|
|
/// the lyx view
|
|
|
|
XFormsView * view_;
|
|
|
|
|
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
|