]> git.lyx.org Git - features.git/blob - src/frontends/kde/FormCitation.h
99aff1c506549ff59314c6eac3b7381db1fcff5b
[features.git] / src / frontends / kde / FormCitation.h
1 /**
2  * \file FormCitation.h
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #ifndef FORMCITATION_H
10 #define FORMCITATION_H
11
12 #include <vector>
13 #include <boost/smart_ptr.hpp>
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "ViewBase.h"
20 #include "ButtonPolicies.h"
21
22 class kdeBC;
23 class QListBox;
24 class ControlCitation;
25 class CitationDialog;
26
27 class FormCitation : public ViewBC<kdeBC> {
28 public:
29         FormCitation(ControlCitation &);
30
31         /// Functions accessible to the Controller.
32
33         /// Set the Params variable for the Controller.
34         virtual void apply();
35         /// Set the Params variable for the Controller.
36         virtual void build();
37         /// Hide the dialog.
38         virtual void hide();
39         /// Update dialog before/whilst showing it.
40         virtual void update();
41         /// Create the dialog if necessary, update it and display it.
42         void show();
43
44         /// add a key
45         ButtonPolicy::SMInput add();
46         /// remove a key
47         ButtonPolicy::SMInput remove();
48         /// move a key up
49         ButtonPolicy::SMInput up();
50         /// move a key down
51         ButtonPolicy::SMInput down();
52         /// a key has been highlighted
53         void highlight_key(char const * key);
54         /// a chosen key has been highlighted
55         void highlight_chosen(char const * key);
56         /// a key has been double-clicked
57         ButtonPolicy::SMInput select_key(char const * key);
58
59 private:
60         /// The parent controller
61         ControlCitation & controller() const;
62         /// update add,remove,up,down
63         void updateButtons();
64         /// update the available keys list
65         void updateAvailableList();
66         /// update the chosen keys list
67         void updateChosenList();
68         /// select the currently chosen key
69         void selectChosen();
70         /// does the dirty work for highlight_key(), highlight_chosen()
71         void highlight(char const *, QListBox *, string &, string &);
72         /// does the dirty work for updateAvailableList(), updateChosenList()
73         void updateList(QListBox *, std::vector<string> const &);
74
75         /// Real GUI implementation.
76         boost::scoped_ptr<CitationDialog> dialog_;
77
78         /// available citation keys
79         std::vector<string> keys;
80         /// chosen citation keys
81         std::vector<string> chosenkeys;
82
83         /// currently selected key
84         string selectedKey;
85
86         /// currently selected chosen key
87         string selectedChosenKey;
88 };
89
90 #endif // FORMCITATION_H