]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormCommand.h
make doc++ able to generate the source documentation for lyx
[features.git] / src / frontends / xforms / FormCommand.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000 The LyX Team.
8  *
9  * ======================================================
10  */
11
12 #ifndef FORMCOMMAND_H
13 #define FORMCOMMAND_H
14
15 #include "DialogBase.h"
16 #include "LString.h"
17 #include "support/utility.hpp"
18 #include "insets/insetcommand.h"
19
20 class Dialogs;
21 class LyXView;
22
23 #ifdef __GNUG__
24 #pragma interface
25 #endif
26
27 /** This class is an XForms GUI base class to insets derived from
28     InsetCommand
29  */
30 class FormCommand : public DialogBase, public noncopyable {
31 public:
32         /// Constructor
33         FormCommand(LyXView *, Dialogs *, string const & );
34
35         ///
36         static  int WMHideCB(FL_FORM *, void *);
37         ///
38         static void OKCB(FL_OBJECT *, long);
39         ///
40         static void ApplyCB(FL_OBJECT *, long);
41         ///
42         static void CancelCB(FL_OBJECT *, long);
43         ///
44         static void InputCB(FL_OBJECT *, long);
45 protected:
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 );
50
51         /// Build the dialog
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.
60         void free();
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;
65
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.
69         */
70         LyXView * lv_;
71         /** Which Dialogs do we belong to?
72             Used so we can get at the signals we have to connect to.
73         */
74         Dialogs * d_;
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;
79 private:
80         /// Create the dialog if necessary, update it and display it.
81         void show();
82         /// Hide the dialog.
83         void hide();
84
85         /// Update connection.
86         Connection u_;
87         /// Hide connection.
88         Connection h_;
89         /// inset::hide connection.
90         Connection ih_;
91         /// block opening of form from more than one inset
92         bool dialogIsOpen;
93         /// dialog title, displayed by WM.
94         string title;
95 };
96
97 #endif