Add UpdatedBlockTip signal to CMainSignals and CValidationInterface
[bitcoinplatinum.git] / src / ui_interface.h
blob32a92a4b81db02253a13d4f7b12a93825c9745a2
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_UI_INTERFACE_H
7 #define BITCOIN_UI_INTERFACE_H
9 #include <stdint.h>
10 #include <string>
12 #include <boost/signals2/last_value.hpp>
13 #include <boost/signals2/signal.hpp>
15 class CBasicKeyStore;
16 class CWallet;
17 class uint256;
19 /** General change type (added, updated, removed). */
20 enum ChangeType
22 CT_NEW,
23 CT_UPDATED,
24 CT_DELETED
27 /** Signals for UI communication. */
28 class CClientUIInterface
30 public:
31 /** Flags for CClientUIInterface::ThreadSafeMessageBox */
32 enum MessageBoxFlags
34 ICON_INFORMATION = 0,
35 ICON_WARNING = (1U << 0),
36 ICON_ERROR = (1U << 1),
37 /**
38 * Mask of all available icons in CClientUIInterface::MessageBoxFlags
39 * This needs to be updated, when icons are changed there!
41 ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
43 /** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */
44 BTN_OK = 0x00000400U, // QMessageBox::Ok
45 BTN_YES = 0x00004000U, // QMessageBox::Yes
46 BTN_NO = 0x00010000U, // QMessageBox::No
47 BTN_ABORT = 0x00040000U, // QMessageBox::Abort
48 BTN_RETRY = 0x00080000U, // QMessageBox::Retry
49 BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
50 BTN_CLOSE = 0x00200000U, // QMessageBox::Close
51 BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
52 BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
53 BTN_HELP = 0x01000000U, // QMessageBox::Help
54 BTN_APPLY = 0x02000000U, // QMessageBox::Apply
55 BTN_RESET = 0x04000000U, // QMessageBox::Reset
56 /**
57 * Mask of all available buttons in CClientUIInterface::MessageBoxFlags
58 * This needs to be updated, when buttons are changed there!
60 BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
61 BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
63 /** Force blocking, modal message box dialog (not just OS notification) */
64 MODAL = 0x10000000U,
66 /** Do not print contents of message to debug log */
67 SECURE = 0x40000000U,
69 /** Predefined combinations for certain default usage cases */
70 MSG_INFORMATION = ICON_INFORMATION,
71 MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
72 MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
75 /** Show message box. */
76 boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
78 /** Progress message during initialization. */
79 boost::signals2::signal<void (const std::string &message)> InitMessage;
81 /** Number of network connections changed. */
82 boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
84 /**
85 * New, updated or cancelled alert.
86 * @note called with lock cs_mapAlerts held.
88 boost::signals2::signal<void (const uint256 &hash, ChangeType status)> NotifyAlertChanged;
90 /** A wallet has been loaded. */
91 boost::signals2::signal<void (CWallet* wallet)> LoadWallet;
93 /** Show progress e.g. for verifychain */
94 boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
96 /** New block has been accepted */
97 boost::signals2::signal<void (const uint256& hash)> NotifyBlockTip;
100 extern CClientUIInterface uiInterface;
102 #endif // BITCOIN_UI_INTERFACE_H