]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.h
802c422c3eaa7cc2920efa4665c5c646300273e6
[lyx.git] / src / frontends / controllers / ControlCommand.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  * \file ControlCommand.h
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  *
14  * Defines a Controller class for dialogs that create or modify
15  * an inset derived from InsetCommand.
16  * Also defines the abstract base class from which the GUI-dependent Views
17  * of this dialog should be derived.
18  */
19
20 #ifndef CONTROLCOMMAND_H
21 #define CONTROLCOMMAND_H
22
23 #ifdef __GNUG__
24 #pragma interface
25 #endif
26
27 #include "ControlConnections.h"
28 #include "insets/insetcommand.h"
29 #include "commandtags.h" // kb_action
30
31 class Dialogs;
32 class LyXView;
33
34 /** The Inset dialog controller. Connects/disconnects signals, launches 
35     GUI-dependent View and returns the output from this View to the kernel.
36  */
37 class ControlCommand : public ControlConnectInset<InsetCommand>
38 {
39 public:
40         ///
41         ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
42
43         /// Allow the View access to the local copy.
44         InsetCommandParams & params() const;
45
46 protected:
47         /// Slots connected in the daughter classes c-tor.
48         /// Slot launching dialog to (possibly) create a new inset.
49         void createInset(string const &);
50         /// Slot launching dialog to an existing inset.
51         void showInset(InsetCommand *);
52
53         /// Connect signals and launch View.
54         void show(InsetCommandParams const &);
55
56         /// Instantiation of private ControlBase virtual methods.
57         /// Get changed parameters and Dispatch them to the kernel.
58         virtual void apply();
59         /// Disconnect signals and hide View.
60         virtual void hide();
61         /// Update dialog before showing it.
62         virtual void update();
63
64 private:
65         /** A local copy of the inset's params.
66             Memory is allocated only whilst the dialog is visible.
67         */
68         InsetCommandParams * params_;
69         /// Controls what is done in LyXFunc::Dispatch()
70         kb_action const action_;
71 };
72
73
74 #endif // CONTROLCOMMAND_H