2000-08-01 17:33:32 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FORMCOMMAND_H
|
|
|
|
#define FORMCOMMAND_H
|
|
|
|
|
|
|
|
#include "DialogBase.h"
|
|
|
|
#include "LString.h"
|
|
|
|
#include "support/utility.hpp"
|
|
|
|
#include "insets/insetcommand.h"
|
|
|
|
|
|
|
|
class Dialogs;
|
|
|
|
class LyXView;
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** This class is an XForms GUI base class to insets derived from
|
|
|
|
InsetCommand
|
|
|
|
*/
|
|
|
|
class FormCommand : public DialogBase, public noncopyable {
|
|
|
|
public:
|
|
|
|
/// Constructor
|
|
|
|
FormCommand(LyXView *, Dialogs *, string const & );
|
2000-08-03 12:56:25 +00:00
|
|
|
/// Destructor
|
|
|
|
virtual ~FormCommand();
|
2000-08-01 17:33:32 +00:00
|
|
|
|
|
|
|
/**@name Real per-instance Callback Methods */
|
|
|
|
//@{
|
|
|
|
static int WMHideCB(FL_FORM *, void *);
|
|
|
|
static void OKCB(FL_OBJECT *, long);
|
|
|
|
static void ApplyCB(FL_OBJECT *, long);
|
|
|
|
static void CancelCB(FL_OBJECT *, long);
|
|
|
|
static void InputCB(FL_OBJECT *, long);
|
|
|
|
//@}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**@name Slot Methods */
|
|
|
|
//@{
|
2000-08-03 12:56:25 +00:00
|
|
|
/// Slot launching dialog to (possibly) create a new inset
|
2000-08-01 17:33:32 +00:00
|
|
|
void createInset( string const & );
|
2000-08-03 12:56:25 +00:00
|
|
|
/// Slot launching dialog to an existing inset
|
2000-08-01 17:33:32 +00:00
|
|
|
void showInset( InsetCommand * const );
|
2000-08-03 12:56:25 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// Build the dialog
|
|
|
|
virtual void build() = 0;
|
|
|
|
/// Filter the inputs on callback from xforms
|
2000-08-01 17:33:32 +00:00
|
|
|
virtual void input( long ) = 0;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// Update dialog before showing it
|
2000-08-01 17:33:32 +00:00
|
|
|
virtual void update() = 0;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// Apply from dialog (modify or create inset)
|
2000-08-01 17:33:32 +00:00
|
|
|
virtual void apply() = 0;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// delete derived class variables from hide()
|
|
|
|
virtual void clearStore() {}
|
|
|
|
/// Pointer to the actual instantiation of the xform's form
|
2000-08-01 17:33:32 +00:00
|
|
|
virtual FL_FORM * const form() const = 0;
|
|
|
|
|
2000-08-03 12:56:25 +00:00
|
|
|
/**@name Protected Data */
|
2000-08-01 17:33:32 +00:00
|
|
|
//@{
|
|
|
|
/** Which LyXFunc do we use?
|
|
|
|
We could modify Dialogs to have a visible LyXFunc* instead and
|
|
|
|
save a couple of bytes per dialog.
|
|
|
|
*/
|
|
|
|
LyXView * lv_;
|
|
|
|
/** Which Dialogs do we belong to?
|
|
|
|
Used so we can get at the signals we have to connect to.
|
|
|
|
*/
|
|
|
|
Dialogs * d_;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// pointer to the inset passed through showInset (if any)
|
|
|
|
InsetCommand * inset_;
|
|
|
|
/// the nitty-griity. What is modified and passed back
|
|
|
|
InsetCommandParams params;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Create the dialog if necessary, update it and display it.
|
|
|
|
void show();
|
|
|
|
/// Hide the dialog.
|
|
|
|
void hide();
|
|
|
|
/// Explicitly free the dialog.
|
|
|
|
void free();
|
|
|
|
|
|
|
|
|
|
|
|
/**@name Private Data */
|
|
|
|
//@{
|
2000-08-01 17:33:32 +00:00
|
|
|
/// Update connection.
|
|
|
|
Connection u_;
|
|
|
|
/// Hide connection.
|
|
|
|
Connection h_;
|
|
|
|
/// inset::hide connection.
|
|
|
|
Connection ih_;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// block opening of form from more than one inset
|
2000-08-01 17:33:32 +00:00
|
|
|
bool dialogIsOpen;
|
2000-08-03 12:56:25 +00:00
|
|
|
/// dialog title, displayed by WM.
|
2000-08-01 17:33:32 +00:00
|
|
|
string title;
|
|
|
|
//@}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|