]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBase.h
Angus's FormBase patch with tiny cleanup
[lyx.git] / src / frontends / xforms / FormBase.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 FORMBASE_H
13 #define FORMBASE_H
14
15 #include "DialogBase.h"
16 #include "LString.h"
17 #include "support/utility.hpp"
18 #include FORMS_H_LOCATION
19
20 class Dialogs;
21 class LyXView;
22
23 #ifdef __GNUG__
24 #pragma interface
25 #endif
26
27 #ifdef SIGC_CXX_NAMESPACES
28 using SigC::Signal0;
29 #endif
30
31 /** This class is an XForms GUI base class
32  */
33 class FormBase : public DialogBase, public noncopyable {
34 public:
35         ///
36         enum BufferDependency {
37                 ///
38                 BUFFER_DEPENDENT,
39                 ///
40                 BUFFER_INDEPENDENT
41         };
42
43         /// Constructor
44         FormBase(LyXView *, Dialogs *, BufferDependency, string const &);
45
46         /// Callback functions
47         static  int WMHideCB(FL_FORM *, void *);
48         ///
49         static void ApplyCB(FL_OBJECT *, long);
50         ///
51         static void ApplyHideCB(FL_OBJECT *, long);
52         ///
53         static void HideCB(FL_OBJECT *, long);
54         ///
55         static void InputCB(FL_OBJECT *, long);
56
57 protected:
58         /// Create the dialog if necessary, update it and display it.
59         void show();
60         /// Hide the dialog.
61         void hide();
62         /// Build the dialog
63         virtual void build() = 0;
64         /// Filter the inputs on callback from xforms
65         virtual void input( long ) {}
66         /// Update dialog before showing it
67         virtual void update() {}
68         /// Apply from dialog (modify or create inset)
69         virtual void apply() {}
70         /// delete derived class variables when hide()ing
71         virtual void clearStore() {}
72         /// Pointer to the actual instantiation of xform's form
73         virtual FL_FORM * const form() const = 0;
74
75         /// block opening of form twice at the same time
76         bool dialogIsOpen;
77         /** Which LyXFunc do we use?
78             We could modify Dialogs to have a visible LyXFunc* instead and
79             save a couple of bytes per dialog.
80         */
81         LyXView * lv_;
82
83 private:
84         /// Hide signal
85         Signal0<void> * hSignal_;
86         /// Update signal
87         Signal0<void> * uSignal_;
88         /// Update connection.
89         Connection u_;
90         /// Hide connection.
91         Connection h_;
92         /// dialog title, displayed by WM.
93         string title;
94 };
95
96 #endif