]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormCommand.h
patch from Angus
[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         /**@name Real per-instance Callback Methods */
36         //@{
37         static  int WMHideCB(FL_FORM *, void *);
38         static void OKCB(FL_OBJECT *, long);
39         static void ApplyCB(FL_OBJECT *, long);
40         static void CancelCB(FL_OBJECT *, long);
41         static void InputCB(FL_OBJECT *, long);
42         //@}
43
44 protected:
45         /**@name Slot Methods */
46         //@{
47         /// Create the dialog if necessary, update it and display it.
48         void createInset( string const & );
49         /// 
50         void showInset( InsetCommand * const );
51         /// 
52         void show();
53         /// Hide the dialog.
54         void hide();
55         /// Explicitly free the dialog.
56         void free();
57         ///
58         virtual void input( long ) = 0;
59         ///
60         virtual void update() = 0;
61         /// Apply from dialog
62         virtual void apply() = 0;
63         /// Build the dialog
64         virtual void build() = 0;
65         ///
66         virtual FL_FORM * const form() const = 0;
67         //@}
68
69         /**@name Private Data */
70         //@{
71         /** Which LyXFunc do we use?
72             We could modify Dialogs to have a visible LyXFunc* instead and
73             save a couple of bytes per dialog.
74         */
75         LyXView * lv_;
76         /** Which Dialogs do we belong to?
77             Used so we can get at the signals we have to connect to.
78         */
79         Dialogs * d_;
80         /// Update connection.
81         Connection u_;
82         /// Hide connection.
83         Connection h_;
84         /// inset::hide connection.
85         Connection ih_;
86         ///
87         InsetCommand * inset_;
88         ///
89         bool dialogIsOpen;
90         ///
91         InsetCommandParams params;
92         ///
93         string title;
94         //@}
95 };
96
97 #endif