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