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 popups interacting with the kernel through
18 * signals/slots will all be derived from ControlConnectBI or ControlConnectBD.
20 * A popup is classed as "Buffer Dependent" if its contents change with the
21 * buffer (document). An example would be the Citation popup. Such a popup
22 * would be derived, therefore, from ControlConnectBD.
24 * Conversely, a popup is "Buffer Independent" if its contents do not change
25 * when the buffer changes. An example would be the Copyright popup. Such a
26 * popup, is therefore derived from ControlConnectBI.
30 #ifndef CONTROLCONNECTIONS_H
31 #define CONTROLCONNECTIONS_H
37 #include "ControlBase.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 ControlBase
50 ControlConnectBase(LyXView &, Dialogs &);
51 /// The View may need to know if the buffer is read-only.
52 bool isReadonly() const;
55 /// True if the dialog depends on the buffer, else false.
56 virtual bool isBufferDependent() const = 0;
59 virtual void connect();
60 /// Disconnect signals
61 virtual void disconnect();
63 /** Redraw the dialog (on receipt of a Signal indicating, for example,
64 its colors have been re-mapped).
68 /// Get at the kernel Dispatch methods we need to apply() parameters.
70 /// Contains the signals we have to connect to.
74 /// Redraw connection.
79 /** Base class to control connection/disconnection of signals with the LyX
80 kernel for Buffer Independent dialogs.
81 Such dialogs do not require an update Connection although they may use
82 an update() function which is also supported by the Restore button.
85 class ControlConnectBI : public ControlConnectBase
89 ControlConnectBI(LyXView &, Dialogs &);
93 virtual bool isBufferDependent() const { return false; }
95 virtual void connect();
99 /** Base class to control connection/disconnection of signals with the LyX
100 kernel for Buffer Dependent dialogs.
102 class ControlConnectBD : public ControlConnectBase
106 ControlConnectBD(LyXView &, Dialogs &);
110 virtual bool isBufferDependent() const { return true; }
111 /** Slot connected to update signal.
112 Bool indicates if a buffer switch took place.
113 Default behaviour is to ignore this and simply update().
115 virtual void updateSlot(bool) { update(); }
117 virtual void connect();
118 /// Disconnect signals
119 virtual void disconnect();
122 /// Update connection.
126 #endif // CONTROLCONNECTIONS_H