1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
10 * \file ControlConnections.h
11 * \author Angus Leeming <a.leeming@ic.ac.uk>
13 * ControlConnections.h contains the definition of three controller classes,
14 * ControlConnectBase, ControlConnectBI and ControlConnectBD.
16 * Together they control the connection/disconnection of signals with the LyX
17 * kernel. Controllers of individual dialogs interacting with the kernel through
18 * signals/slots will all be derived from ControlConnectBI or ControlConnectBD.
20 * A dialog is classed as "Buffer Dependent" if its contents change with the
21 * buffer (document). An example would be the Citation dialog. Such a dialog
22 * would be derived, therefore, from ControlConnectBD.
24 * Conversely, a dialog is "Buffer Independent" if its contents do not change
25 * when the buffer changes. An example would be the Copyright dialog. Such a
26 * dialog is therefore derived from ControlConnectBI.
30 #ifndef CONTROLCONNECTIONS_H
31 #define CONTROLCONNECTIONS_H
37 #include "ControlButtons.h"
42 /** Base class to control connection/disconnection of signals with the LyX
43 kernel. It is meant to be used solely as the parent class to
44 ControlConnectBI and ControlConnectBD.
46 class ControlConnectBase : public ControlButtons
61 ControlConnectBase(LyXView &, Dialogs &);
62 /// The View may need to know if the buffer is read-only.
63 bool isReadonly() const;
65 DocTypes docType() const;
68 /// True if the dialog depends on the buffer, else false.
69 virtual bool isBufferDependent() const = 0;
72 virtual void connect();
73 /// Disconnect signals
74 virtual void disconnect();
76 /** Redraw the dialog (on receipt of a Signal indicating, for example,
77 its colors have been re-mapped).
81 /// Get at the kernel Dispatch methods we need to apply() parameters.
83 /// Contains the signals we have to connect to.
87 /// Redraw connection.
92 /** Base class to control connection/disconnection of signals with the LyX
93 kernel for Buffer Independent dialogs.
94 Such dialogs do not require an update Connection although they may use
95 an update() function which is also supported by the Restore button.
98 class ControlConnectBI : public ControlConnectBase
102 ControlConnectBI(LyXView &, Dialogs &);
106 virtual bool isBufferDependent() const { return false; }
108 virtual void connect();
112 /** Base class to control connection/disconnection of signals with the LyX
113 kernel for Buffer Dependent dialogs.
115 class ControlConnectBD : public ControlConnectBase
119 ControlConnectBD(LyXView &, Dialogs &);
123 virtual bool isBufferDependent() const { return true; }
125 virtual void connect();
126 /// Disconnect signals
127 virtual void disconnect();
130 /** Slot connected to update signal.
131 Bool indicates if a buffer switch took place.
132 Default behaviour is to ignore this and simply update().
134 virtual void updateSlot(bool) { update(); }
135 /// Update connection.
139 #endif // CONTROLCONNECTIONS_H