OXYGENHUB
◆ main openmsx / share / scripts / _osd.tcl
894 B · Tcl · last changed chore(): initial commit 1 month ago source blame history raw
1
namespace eval osd {
2
3
set_help_text show_osd \
4
{Give an overview of all currently defined OSD elements and their properties.
5
This is mainly useful to debug a OSD related script.}
6
7
proc show_osd {{widgets ""}} {
8
	set result ""
9
	if {$widgets eq ""} {
10
		# all widgets
11
		set widgets [osd info]
12
	}
13
	foreach widget $widgets {
14
		append result "$widget\n"
15
		foreach property [osd info $widget] {
16
			if {[catch {set value [osd info $widget $property]}]} {
17
				set value "--error--"
18
			}
19
			append result "  $property $value\n"
20
		}
21
	}
22
	return $result
23
}
24
25
proc is_cursor_in {widget} {
26
	set x 2; set y 2
27
	catch {lassign [osd info $widget -mousecoord] x y}
28
	expr {0 <= $x && $x <= 1 && 0 <= $y && $y <= 1}
29
}
30
31
namespace export show_osd
32
namespace export is_cursor_in
33
34
};# namespace osd
35
36
# only import stuff to global that is useful outside of scripts (i.e. for the console user)
37
namespace import osd::show_osd