2001-03-15 13:37:04 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-21 13:27:03 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file ControlCommand.h
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*
|
2001-03-22 11:24:36 +00:00
|
|
|
* ControlCommand is a controller class for dialogs that create or modify
|
2001-03-15 13:37:04 +00:00
|
|
|
* an inset derived from InsetCommand.
|
2001-03-22 11:24:36 +00:00
|
|
|
*
|
|
|
|
* The class is likely to be changed as other Inset controllers are created
|
|
|
|
* and it becomes clear just what functionality can be moved back into
|
|
|
|
* ControlInset.
|
|
|
|
*
|
2001-03-15 13:37:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CONTROLCOMMAND_H
|
|
|
|
#define CONTROLCOMMAND_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-03-22 11:24:36 +00:00
|
|
|
#include "ControlDialogs.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "insets/insetcommand.h"
|
|
|
|
#include "commandtags.h" // kb_action
|
|
|
|
|
|
|
|
/** The Inset dialog controller. Connects/disconnects signals, launches
|
|
|
|
GUI-dependent View and returns the output from this View to the kernel.
|
|
|
|
*/
|
2001-03-22 11:24:36 +00:00
|
|
|
class ControlCommand : public ControlInset<InsetCommand>
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
|
|
|
|
|
|
|
|
/// Allow the View access to the local copy.
|
|
|
|
InsetCommandParams & params() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Slots connected in the daughter classes c-tor.
|
|
|
|
/// Slot launching dialog to (possibly) create a new inset.
|
|
|
|
void createInset(string const &);
|
|
|
|
/// Slot launching dialog to an existing inset.
|
|
|
|
void showInset(InsetCommand *);
|
|
|
|
|
|
|
|
/// Connect signals and launch View.
|
|
|
|
void show(InsetCommandParams const &);
|
|
|
|
|
|
|
|
/// Instantiation of private ControlBase virtual methods.
|
|
|
|
/// Get changed parameters and Dispatch them to the kernel.
|
|
|
|
virtual void apply();
|
|
|
|
/// Disconnect signals and hide View.
|
|
|
|
virtual void hide();
|
|
|
|
/// Update dialog before showing it.
|
|
|
|
virtual void update();
|
|
|
|
|
2001-03-22 11:24:36 +00:00
|
|
|
/// clean-up on hide.
|
|
|
|
virtual void clearParams() {}
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
private:
|
|
|
|
/** A local copy of the inset's params.
|
|
|
|
Memory is allocated only whilst the dialog is visible.
|
|
|
|
*/
|
|
|
|
InsetCommandParams * params_;
|
|
|
|
/// Controls what is done in LyXFunc::Dispatch()
|
|
|
|
kb_action const action_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CONTROLCOMMAND_H
|