1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles, Vas Crabb
3 //============================================================
4 //
5 //  debugviewinfo.h - Win32 debug window handling
6 //
7 //============================================================
8 #ifndef MAME_DEBUGGER_WIN_DEBUGVIEWINFO_H
9 #define MAME_DEBUGGER_WIN_DEBUGVIEWINFO_H
10 
11 #pragma once
12 
13 #include "debugwin.h"
14 
15 #include "debugbaseinfo.h"
16 
17 #include "debug/debugvw.h"
18 
19 
20 class debugview_info : protected debugbase_info
21 {
22 public:
23 	debugview_info(debugger_windows_interface &debugger, debugwin_info &owner, HWND parent, debug_view_type type);
24 	virtual ~debugview_info();
25 
26 	bool is_valid() const;
27 
owns_window(HWND wnd)28 	bool owns_window(HWND wnd) const { return m_wnd == wnd; }
29 
30 	uint32_t prefwidth() const;
31 	uint32_t maxwidth();
32 	void get_bounds(RECT &bounds) const;
33 	void set_bounds(RECT const &newbounds);
34 
35 	void send_vscroll(int delta);
36 	void send_pageup();
37 	void send_pagedown();
set_focus()38 	void set_focus() const { SetFocus(m_wnd); }
39 
type()40 	debug_view_type type() const { return m_view->type(); }
total_size()41 	debug_view_xy total_size() const { return m_view->total_size(); }
cursor_supported()42 	bool cursor_supported() const { return m_view->cursor_supported(); }
cursor_visible()43 	bool cursor_visible() const { return m_view->cursor_visible(); }
44 
45 	char const *source_name() const;
46 	device_t *source_device() const;
47 	bool source_is_visible_cpu() const;
48 	bool set_source_index(int index);
49 	bool set_source_for_device(device_t &device);
50 	bool set_source_for_visible_cpu();
51 
52 	HWND create_source_combobox(HWND parent, LONG_PTR userdata);
53 
54 protected:
view()55 	template <typename T> T *view() const { return downcast<T *>(m_view); }
56 
57 private:
58 	void draw_contents(HDC windc);
59 	void update();
60 	uint32_t process_scroll(WORD type, HWND wnd);
61 	LRESULT view_proc(UINT message, WPARAM wparam, LPARAM lparam);
62 
63 	static void static_update(debug_view &view, void *osdprivate);
64 	static LRESULT CALLBACK static_view_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
65 
66 	static void register_window_class();
67 
68 	debugwin_info   &m_owner;
69 	debug_view      *m_view;
70 	HWND            m_wnd;
71 	HWND            m_hscroll;
72 	HWND            m_vscroll;
73 
74 	static bool     s_window_class_registered;
75 };
76 
77 #endif
78