2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ======================================================
15 #include "DialogBase.h"
17 #include "support/utility.hpp"
18 #include "insets/insetcommand.h"
27 /** This class is an XForms GUI base class to insets derived from
30 class FormCommand : public DialogBase, public noncopyable {
33 FormCommand(LyXView *, Dialogs *, string const & );
36 static int WMHideCB(FL_FORM *, void *);
38 static void OKCB(FL_OBJECT *, long);
40 static void ApplyCB(FL_OBJECT *, long);
42 static void CancelCB(FL_OBJECT *, long);
44 static void InputCB(FL_OBJECT *, long);
46 /// Slot launching dialog to (possibly) create a new inset
47 void createInset( string const & );
48 /// Slot launching dialog to an existing inset
49 void showInset( InsetCommand * const );
52 virtual void build() = 0;
53 /// Filter the inputs on callback from xforms
54 virtual void input( long ) = 0;
55 /// Update dialog before showing it
56 virtual void update() = 0;
57 /// Apply from dialog (modify or create inset)
58 virtual void apply() = 0;
59 /// Explicitly free the dialog.
61 /// delete derived class variables from hide()
62 virtual void clearStore() {}
63 /// Pointer to the actual instantiation of the xform's form
64 virtual FL_FORM * const form() const = 0;
66 /** Which LyXFunc do we use?
67 We could modify Dialogs to have a visible LyXFunc* instead and
68 save a couple of bytes per dialog.
71 /** Which Dialogs do we belong to?
72 Used so we can get at the signals we have to connect to.
75 /// pointer to the inset passed through showInset (if any)
76 InsetCommand * inset_;
77 /// the nitty-griity. What is modified and passed back
78 InsetCommandParams params;
80 /// Create the dialog if necessary, update it and display it.
85 /// Update connection.
89 /// inset::hide connection.
91 /// block opening of form from more than one inset
93 /// dialog title, displayed by WM.