2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013-2016, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
6 #ifndef USER_INTERFACE_H
7 #define USER_INTERFACE_H
12 #include <Referenceable.h>
14 #include "TeamMemoryBlock.h"
22 class FunctionInstance
;
30 class TypeComponentPath
;
32 class UserInterfaceListener
;
35 class ValueNodeContainer
;
39 enum user_notification_type
{
40 USER_NOTIFICATION_INFO
,
41 USER_NOTIFICATION_WARNING
,
42 USER_NOTIFICATION_ERROR
46 class UserInterface
: public BReferenceable
{
48 virtual ~UserInterface();
50 virtual const char* ID() const = 0;
52 virtual status_t
Init(Team
* team
,
53 UserInterfaceListener
* listener
) = 0;
54 virtual void Show() = 0;
55 virtual void Terminate() = 0;
56 // shut down the UI *now* -- no more user
59 virtual UserInterface
* Clone() const = 0;
60 // returns a new instance of the
61 // appropriate user interface subclass.
62 // primarily needed in order to
63 // reconstruct the necessary information
64 // for initiating a team restart.
66 virtual bool IsInteractive() const = 0;
68 virtual status_t
LoadSettings(const TeamUiSettings
* settings
)
70 virtual status_t
SaveSettings(TeamUiSettings
*& settings
)
73 virtual void NotifyUser(const char* title
,
75 user_notification_type type
) = 0;
76 virtual void NotifyBackgroundWorkStatus(const char* message
)
78 // this is used to inform the user about
79 // background processing work, but doesn't
80 // otherwise require any form of
81 // user interaction, i.e. for a status bar
82 // to indicate that debug information is
85 virtual int32
SynchronouslyAskUser(const char* title
,
86 const char* message
, const char* choice1
,
87 const char* choice2
, const char* choice3
)
89 // returns -1, if not implemented or user
92 virtual status_t
SynchronouslyAskUserForFile(entry_ref
* _ref
)
97 class UserInterfaceListener
{
100 QUIT_OPTION_ASK_USER
,
101 QUIT_OPTION_ASK_KILL_TEAM
,
102 QUIT_OPTION_ASK_RESUME_TEAM
106 virtual ~UserInterfaceListener();
108 virtual void FunctionSourceCodeRequested(
109 FunctionInstance
* function
,
110 bool forceDisassembly
= false) = 0;
111 virtual void SourceEntryLocateRequested(
112 const char* sourcePath
,
113 const char* locatedPath
) = 0;
114 virtual void SourceEntryInvalidateRequested(
115 LocatableFile
* sourceFile
) = 0;
116 virtual void ImageDebugInfoRequested(Image
* image
) = 0;
117 virtual void ValueNodeValueRequested(CpuState
* cpuState
,
118 ValueNodeContainer
* container
,
119 ValueNode
* valueNode
) = 0;
120 virtual void ValueNodeWriteRequested(ValueNode
* node
,
121 CpuState
* state
, Value
* newValue
) = 0;
122 virtual void ThreadActionRequested(thread_id threadID
,
124 target_addr_t address
= 0) = 0;
126 virtual void SetBreakpointRequested(target_addr_t address
,
127 bool enabled
, bool hidden
= false) = 0;
128 virtual void SetBreakpointEnabledRequested(
129 UserBreakpoint
* breakpoint
,
131 virtual void SetBreakpointConditionRequested(
132 UserBreakpoint
* breakpoint
,
133 const char* condition
) = 0;
134 virtual void ClearBreakpointConditionRequested(
135 UserBreakpoint
* breakpoint
) = 0;
136 virtual void ClearBreakpointRequested(
137 target_addr_t address
) = 0;
138 virtual void ClearBreakpointRequested(
139 UserBreakpoint
* breakpoint
) = 0;
140 // TODO: Consolidate those!
142 virtual void SetStopOnImageLoadRequested(bool enabled
,
143 bool useImageNames
) = 0;
144 virtual void AddStopImageNameRequested(
145 const char* name
) = 0;
146 virtual void RemoveStopImageNameRequested(
147 const char* name
) = 0;
149 virtual void SetDefaultSignalDispositionRequested(
150 int32 disposition
) = 0;
151 virtual void SetCustomSignalDispositionRequested(
152 int32 signal
, int32 disposition
) = 0;
153 virtual void RemoveCustomSignalDispositionRequested(
156 virtual void SetWatchpointRequested(target_addr_t address
,
157 uint32 type
, int32 length
,
159 virtual void SetWatchpointEnabledRequested(
160 Watchpoint
* watchpoint
,
162 virtual void ClearWatchpointRequested(
163 target_addr_t address
) = 0;
164 virtual void ClearWatchpointRequested(
165 Watchpoint
* watchpoint
) = 0;
167 virtual void InspectRequested(
168 target_addr_t address
,
169 TeamMemoryBlock::Listener
* listener
) = 0;
170 virtual void MemoryWriteRequested(
171 target_addr_t address
,
173 target_size_t length
) = 0;
175 virtual void ExpressionEvaluationRequested(
176 SourceLanguage
* language
,
177 ExpressionInfo
* info
,
178 StackFrame
* frame
= NULL
,
179 ::Thread
* thread
= NULL
) = 0;
181 virtual void DebugReportRequested(entry_ref
* path
) = 0;
183 virtual void WriteCoreFileRequested(entry_ref
* path
) = 0;
185 virtual void TeamRestartRequested() = 0;
187 virtual bool UserInterfaceQuitRequested(
188 QuitOption quitOption
189 = QUIT_OPTION_ASK_USER
) = 0;
193 #endif // USER_INTERFACE_H