4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
15 #include "DialogView.h"
16 #include "ButtonController.h"
18 #include "insets/InsetCommandParams.h"
23 /** \c Dialog collects the different parts of a Model-Controller-View
24 * split of a generic dialog together.
26 class GuiDialog : public DialogView
31 /// \param lv is the access point for the dialog to the LyX kernel.
32 /// \param name is the identifier given to the dialog by its parent
34 explicit GuiDialog(GuiView & lv, std::string const & name);
38 * These methods are publicly accessible because they are invoked
39 * by the View when the user presses... guess what ;-)
41 // Restore button clicked
45 // Apply button clicked
47 // Close button clicked or closed from WindowManager
51 /** Check whether we may apply our data.
53 * The buttons are disabled if not and (re-)enabled if yes.
55 void setButtonsValid(bool valid);
57 /** \name Dialog Components
58 * Methods to access the various components making up a dialog.
61 ButtonController const & bc() const { return bc_; }
62 ButtonController & bc() { return bc_; }
65 /// the dialog has changed contents
66 virtual void changed();
68 virtual void enableView(bool enable);
70 /// default: do nothing
71 virtual void applyView() {}
72 /// default: do nothing
73 virtual void updateContents() {}
76 /// is the dialog currently valid ?
77 virtual bool isValid() { return true; }
81 /** When applying, it's useful to know whether the dialog is about
82 * to close or not (no point refreshing the display for example).
84 bool isClosing() const { return is_closing_; }
86 /// Update the display of the dialog whilst it is still visible.
87 virtual void updateView();
98 class GuiCommand : public GuiDialog
101 /// We need to know with what sort of inset we're associated.
102 // FIXME This should probably be an InsetCode
103 GuiCommand(GuiView &, std::string const & name);
105 bool initialiseParams(std::string const & data);
106 /// clean-up on hide.
107 void clearParams() { params_.clear(); }
108 /// clean-up on hide.
109 void dispatchParams();
111 bool isBufferDependent() const { return true; }
115 InsetCommandParams params_;
116 //FIXME It should be possible to eliminate lfun_name_
117 //now and recover that information from params().insetType().
118 //But let's not do that quite yet.
119 /// Flags what action is taken by Kernel::dispatch()
120 std::string const lfun_name_;
123 } // namespace frontend
126 #endif // GUIDIALOG_H