]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FormRef.h
Fixed connections. There is still a bug somewhere.
[lyx.git] / src / frontends / qt2 / FormRef.h
1 /* FormRef.h
2  * (C) 2000 LyX Team
3  * John Levon, moz@compsoc.man.ac.uk
4  * Adapted for Qt2 frontend by Kalle Dalheimer, 
5  *   kalle@klaralvdalens-datakonsult.se
6  */
7
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16
17 #ifndef FORMREF_H
18 #define FORMREF_H
19
20 #include "DialogBase.h"
21 #include "LString.h"
22 #include "boost/utility.hpp"
23 #include "insets/insetcommand.h"
24
25 class Dialogs;
26 class LyXView;
27 class FormRefDialog;
28
29 class FormRef : public DialogBase {
30 public: 
31         /**@name Constructors and Destructors */
32         //@{
33         ///
34         FormRef(LyXView *, Dialogs *);
35         /// 
36         ~FormRef();
37         //@}
38
39         /// double-click a ref
40         void select(const char *);
41         /// highlight a ref
42         void highlight(const char *);
43         /// set sort
44         void set_sort(bool);
45         /// goto a ref (or back)
46         void goto_ref(); 
47         /// update dialog
48         void update(); 
49         /// update just the refs
50         void do_ref_update();
51         /// Apply changes
52         void apply();
53         /// close the connections
54         void close();
55  
56 private: 
57         enum Type {
58                 REF, PAGEREF, VREF, VPAGEREF, PRETTYREF
59         }; 
60
61         enum GotoType {
62                 GOTOREF, GOTOBACK
63         };
64  
65         /// Create the dialog if necessary, update it and display it.
66         void show();
67         /// Hide the dialog.
68         void hide();
69  
70         /// create a Reference inset
71         void createRef(string const &);
72         /// edit a Reference inset
73         void showRef(InsetCommand * const);
74  
75         /// update the keys list
76         void updateRefs(void);
77  
78         /// Real GUI implementation.
79         FormRefDialog * dialog_;
80
81         /// the LyXView we belong to
82         LyXView * lv_;
83  
84         /** Which Dialogs do we belong to?
85             Used so we can get at the signals we have to connect to.
86         */
87         Dialogs * d_;
88         /// pointer to the inset if any
89         InsetCommand * inset_;
90         /// insets params
91         InsetCommandParams params;
92         /// is the inset we are reading from a readonly buffer ?
93         bool readonly;
94         
95         /// Hide connection.
96         Connection h_;
97         /// Update connection.
98         Connection u_;
99         /// Inset hide connection.
100         Connection ih_;
101
102         /// to sort or not to sort
103         bool sort;
104  
105         /// where to go
106         GotoType gotowhere;
107  
108         /// current type
109         Type type;
110  
111         /// available references
112         std::vector< string > refs;
113 };
114
115 #endif