]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/FormCitation.h
Angus's FormInset work; Dekel's languages patch; my reworking of Angus's stuff +...
[lyx.git] / src / frontends / kde / FormCitation.h
1 /* FormCitation.h
2  * (C) 2000 LyX Team
3  * John Levon, moz@compsoc.man.ac.uk
4  */
5
6 /***************************************************************************
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) any later version.                                   *
12  *                                                                         *
13  ***************************************************************************/
14
15 #ifndef FORMCITATION_H
16 #define FORMCITATION_H
17
18 #include "DialogBase.h"
19 #include "support/lstrings.h"
20 #include "boost/utility.hpp"
21 #include "insets/insetcommand.h" 
22
23 #include <vector> 
24  
25 class Dialogs;
26 class LyXView;
27 class FormCitationDialog;
28
29 class FormCitation : public DialogBase, public noncopyable {
30 public: 
31         /**@name Constructors and Destructors */
32         //@{
33         ///
34         FormCitation(LyXView *, Dialogs *);
35         /// 
36         ~FormCitation();
37         //@}
38
39         /// Apply changes
40         void apply();
41         /// close the connections
42         void close();
43         /// add a key
44         void add();
45         /// remove a key
46         void remove();
47         /// move a key up
48         void up();
49         /// move a key down
50         void down(); 
51         /// a key has been highlighted
52         void highlight_key(const char *key);
53         /// a chosen key has been highlighted
54         void highlight_chosen(const char *key); 
55         /// a key has been double-clicked
56         void select_key(const char *key);
57  
58 private: 
59         /// Create the dialog if necessary, update it and display it.
60         void show();
61         /// Hide the dialog.
62         void hide();
63         /// Update the dialog.
64         void update(bool switched = false);
65
66         /// create a Citation inset
67         void createCitation(string const &);
68         /// edit a Citation inset
69         void showCitation(InsetCommand * const);
70  
71         /// update add,remove,up,down
72         void updateButtons();
73         /// update the available keys list
74         void updateAvailableList();
75         /// update the chosen keys list
76         void updateChosenList();
77         /// select the currently chosen key 
78         void selectChosen();
79  
80         /// Real GUI implementation.
81         FormCitationDialog * dialog_;
82
83         /// the LyXView we belong to
84         LyXView * lv_;
85  
86         /** Which Dialogs do we belong to?
87             Used so we can get at the signals we have to connect to.
88         */
89         Dialogs * d_;
90         /// pointer to the inset if any
91         InsetCommand * inset_;
92         /// insets params
93         InsetCommandParams params;
94         /// is the inset we are reading from a readonly buffer ?
95         bool readonly;
96         
97         /// Hide connection.
98         Connection h_;
99         /// Update connection.
100         Connection u_;
101         /// Inset hide connection.
102         Connection ih_;
103
104         /// available citation keys
105         std::vector<std::pair<string, string> > keys;
106         /// chosen citation keys
107         std::vector<string> chosenkeys;
108  
109         /// currently selected key
110         string selectedKey;
111
112         /// currently selected chosen key
113         string selectedChosenKey;
114 };
115
116 #endif