1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef USER_INTERFACE_H 6#define USER_INTERFACE_H 7 8 9#include <OS.h> 10 11#include <Referenceable.h> 12 13#include "TeamMemoryBlock.h" 14#include "Types.h" 15 16 17class entry_ref; 18 19class CpuState; 20class FunctionInstance; 21class Image; 22class StackFrame; 23class Team; 24class TeamUiSettings; 25class Thread; 26class TypeComponentPath; 27class UserBreakpoint; 28class UserInterfaceListener; 29class ValueNode; 30class ValueNodeContainer; 31class Variable; 32class Watchpoint; 33 34 35enum user_notification_type { 36 USER_NOTIFICATION_INFO, 37 USER_NOTIFICATION_WARNING, 38 USER_NOTIFICATION_ERROR 39}; 40 41 42class UserInterface : public BReferenceable { 43public: 44 virtual ~UserInterface(); 45 46 virtual const char* ID() const = 0; 47 48 virtual status_t Init(Team* team, 49 UserInterfaceListener* listener) = 0; 50 virtual void Show() = 0; 51 virtual void Terminate() = 0; 52 // shut down the UI *now* -- no more user 53 // feedback 54 55 virtual status_t LoadSettings(const TeamUiSettings* settings) 56 = 0; 57 virtual status_t SaveSettings(TeamUiSettings*& settings) 58 const = 0; 59 60 virtual void NotifyUser(const char* title, 61 const char* message, 62 user_notification_type type) = 0; 63 virtual int32 SynchronouslyAskUser(const char* title, 64 const char* message, const char* choice1, 65 const char* choice2, const char* choice3) 66 = 0; 67 // returns -1, if not implemented or user 68 // cannot be asked 69}; 70 71 72class UserInterfaceListener { 73public: 74 enum QuitOption { 75 QUIT_OPTION_ASK_USER, 76 QUIT_OPTION_ASK_KILL_TEAM, 77 QUIT_OPTION_ASK_RESUME_TEAM 78 }; 79 80public: 81 virtual ~UserInterfaceListener(); 82 83 virtual void FunctionSourceCodeRequested( 84 FunctionInstance* function) = 0; 85 virtual void SourceEntryLocateRequested( 86 const char* sourcePath, 87 const char* locatedPath) = 0; 88 virtual void ImageDebugInfoRequested(Image* image) = 0; 89 virtual void ValueNodeValueRequested(CpuState* cpuState, 90 ValueNodeContainer* container, 91 ValueNode* valueNode) = 0; 92 virtual void ThreadActionRequested(thread_id threadID, 93 uint32 action) = 0; 94 95 virtual void SetBreakpointRequested(target_addr_t address, 96 bool enabled) = 0; 97 virtual void SetBreakpointEnabledRequested( 98 UserBreakpoint* breakpoint, 99 bool enabled) = 0; 100 virtual void ClearBreakpointRequested( 101 target_addr_t address) = 0; 102 virtual void ClearBreakpointRequested( 103 UserBreakpoint* breakpoint) = 0; 104 // TODO: Consolidate those! 105 106 virtual void SetWatchpointRequested(target_addr_t address, 107 uint32 type, int32 length, 108 bool enabled) = 0; 109 virtual void SetWatchpointEnabledRequested( 110 Watchpoint* watchpoint, 111 bool enabled) = 0; 112 virtual void ClearWatchpointRequested( 113 target_addr_t address) = 0; 114 virtual void ClearWatchpointRequested( 115 Watchpoint* watchpoint) = 0; 116 117 virtual void InspectRequested( 118 target_addr_t address, 119 TeamMemoryBlock::Listener* listener) = 0; 120 121 virtual void DebugReportRequested(entry_ref* path) = 0; 122 123 virtual bool UserInterfaceQuitRequested( 124 QuitOption quitOption 125 = QUIT_OPTION_ASK_USER) = 0; 126}; 127 128 129#endif // USER_INTERFACE_H 130