]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormCitation.h
Anguses patch + some modifications for smart? inset-update.
[features.git] / src / frontends / xforms / FormCitation.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 FORMCITATION_H
13 #define FORMCITATION_H
14
15 #include "DialogBase.h"
16 #include "LString.h"
17 #include <vector>
18 #include "form_citation.h"
19
20 class Dialogs;
21 // same arguement as in Dialogs.h s/LyX/UI/
22 class LyXView;
23 class InsetCitation;
24
25 /** This class provides an XForms implementation of the FormCitation Dialog.
26  */
27 class FormCitation : public DialogBase {
28 public:
29         ///
30         enum State {
31                 DOWN,
32                 UP,
33                 DELETE,
34                 ADD,
35                 BIBBRSR,
36                 CITEBRSR,
37                 ON,
38                 OFF
39         };
40         /**@name Constructors and Destructors */
41         //@{
42         /// #FormCitation x(LyXFunc ..., Dialogs ...);#
43         FormCitation(LyXView *, Dialogs *);
44         ///
45         ~FormCitation();
46         //@}
47
48         /**@name Real per-instance Callback Methods */
49         //@{
50         static  int WMHideCB(FL_FORM *, void *);
51         static void OKCB(FL_OBJECT *, long);
52         static void CancelCB(FL_OBJECT *, long);
53         static void InputCB(FL_OBJECT *, long);
54         //@}
55
56 private:
57         FormCitation() {}
58         FormCitation(FormCitation &) : DialogBase() {}
59         
60         /**@name Slot Methods */
61         //@{
62         /// Create the dialog if necessary, update it and display it.
63         void createInset( string const & );
64         /// 
65         void showInset( InsetCitation * );
66         /// 
67         void show();
68         /// Hide the dialog.
69         void hide();
70         /// Not used but we've got to implement it.
71         void update();
72         //@}
73
74         /**@name Dialog internal methods */
75         //@{
76         /// Apply from dialog
77         void apply();
78         /// Filter the inputs
79         void input( State );
80         /// Build the dialog
81         void build();
82         ///
83         void updateCitekeys( string const & );
84         ///
85         void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
86         ///
87         void setBibButtons( State ) const;
88         ///
89         void setCiteButtons( State ) const;
90         ///
91         void setSize( int, bool ) const;
92         ///
93         FD_form_citation * build_citation();
94         /// Explicitly free the dialog.
95         void free();
96         //@}
97
98         /**@name Private Data */
99         //@{
100         /// Real GUI implementation.
101         FD_form_citation * dialog_;
102         /** Which LyXFunc do we use?
103             We could modify Dialogs to have a visible LyXFunc* instead and
104             save a couple of bytes per dialog.
105         */
106         LyXView * lv_;
107         /** Which Dialogs do we belong to?
108             Used so we can get at the signals we have to connect to.
109         */
110         Dialogs * d_;
111         /// Update connection.
112         Connection u_;
113         /// Hide connection.
114         Connection h_;
115         ///
116         InsetCitation * inset_;
117         ///
118         bool dialogIsOpen;
119         ///
120         string textAfter;
121         ///
122         std::vector<string> citekeys;
123         ///
124         std::vector<string> bibkeys;
125         ///
126         std::vector<string> bibkeysInfo;
127         //@}
128 };
129
130 #endif