]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBase.h
Angus inseterror patch + Dekel mathed fix + added language_country code and
[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 /** This class is an XForms GUI base class
28  */
29 class FormBase : public DialogBase, public noncopyable {
30 public:
31         /// Constructor
32         FormBase(LyXView *, Dialogs *, string const &);
33
34         /// Callback functions
35         static  int WMHideCB(FL_FORM *, void *);
36         ///
37         static void ApplyCB(FL_OBJECT *, long);
38         ///
39         static void CancelCB(FL_OBJECT *, long);
40         ///
41         static void InputCB(FL_OBJECT *, long);
42         ///
43         static void OKCB(FL_OBJECT *, long);
44
45 protected:
46         /// Create the dialog if necessary, update it and display it.
47         void show();
48         /// Hide the dialog.
49         void hide();
50
51         /// Build the dialog
52         virtual void build() = 0;
53         /// Filter the inputs on callback from xforms
54         virtual void input( long ) {}
55         /// Update dialog before showing it
56         virtual void update() {}
57         /// Apply from dialog (modify or create inset)
58         virtual void apply() {}
59         /// delete derived class variables when hide()ing
60         virtual void clearStore() {}
61         /// Pointer to the actual instantiation of xform's form
62         virtual FL_FORM * const form() const = 0;
63
64         /** Which LyXFunc do we use?
65             We could modify Dialogs to have a visible LyXFunc* instead and
66             save a couple of bytes per dialog.
67         */
68         LyXView * lv_;
69         /** Which Dialogs do we belong to?
70             Used so we can get at the signals we have to connect to.
71         */
72         Dialogs * d_;
73 private:
74         /// Update connection.
75         Connection u_;
76         /// Hide connection.
77         Connection h_;
78         /// dialog title, displayed by WM.
79         string title;
80
81 protected:
82         /// block opening of form twice at the same time
83         bool dialogIsOpen;
84 };
85
86 #endif