dlgTextEntry_Keyboard: rename to TouchTextEntry
[xcsoar.git] / src / Interface.hpp
blob5f6e0c75d91bf8e744dc2276909678d6ffbc44b4
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef XCSOAR_INTERFACE_HPP
25 #define XCSOAR_INTERFACE_HPP
27 #include "Blackboard/InterfaceBlackboard.hpp"
28 #include "Thread/Debug.hpp"
29 #include "Compiler.h"
31 struct UIState;
32 class MainWindow;
33 class StatusMessageList;
35 /**
36 * Class to hold data/methods accessible by all interface subsystems
38 namespace CommonInterface {
39 namespace Private {
40 extern UIState ui_state;
41 extern InterfaceBlackboard blackboard;
43 /**
44 * True if movement was detected on a real GPS.
46 extern bool movement_detected;
49 // window.. make this protected TODO so have to subclass to get access
50 extern StatusMessageList status_messages;
51 extern MainWindow *main_window;
53 static inline bool MovementDetected() {
54 return Private::movement_detected;
57 // TODO: make this protected
58 /**
59 * Returns InterfaceBlackboard.Basic (NMEA_INFO) (read-only)
60 * @return InterfaceBlackboard.Basic
62 gcc_const
63 static inline const MoreData &Basic() {
64 assert(InMainThread());
66 return Private::blackboard.Basic();
69 /**
70 * Returns InterfaceBlackboard.Calculated (DERIVED_INFO) (read-only)
71 * @return InterfaceBlackboard.Calculated
73 gcc_const
74 static inline const DerivedInfo &Calculated() {
75 assert(InMainThread());
77 return Private::blackboard.Calculated();
80 gcc_const
81 static inline const SystemSettings &GetSystemSettings() {
82 assert(InMainThread());
84 return Private::blackboard.GetSystemSettings();
87 gcc_const
88 static inline SystemSettings &SetSystemSettings() {
89 assert(InMainThread());
91 return Private::blackboard.SetSystemSettings();
94 /**
95 * Returns the InterfaceBlackboard.ComputerSettings (read-only)
96 * @return The InterfaceBlackboard.ComputerSettings
98 gcc_const
99 static inline const ComputerSettings& GetComputerSettings() {
100 assert(InMainThread());
102 return Private::blackboard.GetComputerSettings();
106 * Returns the InterfaceBlackboard.ComputerSettings (read-write)
107 * @return The InterfaceBlackboard.ComputerSettings
109 gcc_const
110 static inline ComputerSettings &SetComputerSettings() {
111 assert(InMainThread());
113 return Private::blackboard.SetComputerSettings();
116 gcc_const
117 static inline const UISettings &GetUISettings() {
118 assert(InMainThread());
120 return Private::blackboard.GetUISettings();
124 * Returns the InterfaceBlackboard.MapSettings (read-only)
125 * @return The InterfaceBlackboard.MapSettings
127 gcc_const
128 static inline const MapSettings& GetMapSettings() {
129 assert(InMainThread());
131 return GetUISettings().map;
134 gcc_const
135 static inline const FullBlackboard &Full() {
136 assert(InMainThread());
138 return Private::blackboard;
141 gcc_const
142 static inline LiveBlackboard &GetLiveBlackboard() {
143 assert(InMainThread());
145 return Private::blackboard;
148 gcc_const
149 static inline UISettings &SetUISettings() {
150 assert(InMainThread());
152 return Private::blackboard.SetUISettings();
156 * Returns the InterfaceBlackboard.MapSettings (read-write)
157 * @return The InterfaceBlackboard.MapSettings
159 gcc_const
160 static inline MapSettings &SetMapSettings() {
161 assert(InMainThread());
163 return SetUISettings().map;
166 static inline const UIState &GetUIState() {
167 assert(InMainThread());
169 return Private::ui_state;
172 static inline UIState &SetUIState() {
173 assert(InMainThread());
175 return Private::ui_state;
178 static inline void ReadBlackboardBasic(const MoreData &nmea_info) {
179 assert(InMainThread());
181 Private::blackboard.ReadBlackboardBasic(nmea_info);
184 static inline void ReadBlackboardCalculated(const DerivedInfo &derived_info) {
185 assert(InMainThread());
187 Private::blackboard.ReadBlackboardCalculated(derived_info);
190 static inline void ReadCommonStats(const CommonStats &common_stats) {
191 assert(InMainThread());
193 Private::blackboard.ReadCommonStats(common_stats);
196 static inline void AddListener(BlackboardListener &listener) {
197 assert(InMainThread());
199 Private::blackboard.AddListener(listener);
202 static inline void RemoveListener(BlackboardListener &listener) {
203 assert(InMainThread());
205 Private::blackboard.RemoveListener(listener);
208 static inline void BroadcastGPSUpdate() {
209 assert(InMainThread());
211 Private::blackboard.BroadcastGPSUpdate();
214 static inline void BroadcastCalculatedUpdate() {
215 assert(InMainThread());
217 Private::blackboard.BroadcastCalculatedUpdate();
220 static inline void BroadcastComputerSettingsUpdate() {
221 assert(InMainThread());
223 Private::blackboard.BroadcastComputerSettingsUpdate();
226 static inline void BroadcastUISettingsUpdate() {
227 assert(InMainThread());
229 Private::blackboard.BroadcastUISettingsUpdate();
233 #endif