blob: 521320ee1c72ef64299527785048dc0b188f370c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# Managed window class definition for GDBtk.
# Copyright 1998, 1999 Cygnus Solutions
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
class ManagedWin {
inherit itk::Widget
public {
method reconfig {}
method destroy_toplevel {}
method quit_if_last {} {return 1}
method enable {on}
method pickle {}
method reveal {}
method window_name {wname {iname ""}}
variable nosize 0
proc find {win}
proc open {args}
proc open_dlg {class args}
proc init {}
proc restart {}
proc startup {}
proc shutdown {}
}
protected {
proc dont_remember_size {} {
return 0
}
method freeze_me {}
method thaw_me {}
variable Top
}
private {
proc _create {class args}
proc _open {class args}
proc make_icon_window {name {file "gdbtk_icon"}}
}
protected {
# manage_active - list of active window objects
common manage_active ""
# this is the counter of TopLevelWins open
# when it hits 0, exit.
common numTopWins 0
common screenwidth
common screenheight
common mainwindow
}
constructor {args} {
debug "$this args=$args"
lappend manage_active $this
set Top [winfo toplevel $itk_interior]
}
destructor {
set infoList [after info]
# remove object from list
set i [lsearch -exact $manage_active $this]
if {$i != -1} {
set manage_active [lreplace $manage_active $i $i]
}
# save geometry
set g [wm geometry [winfo toplevel [namespace tail $this]]]
pref setd gdb/geometry/[namespace tail $this] $g
# If no toplevels remain, quit. However, check the quit_if_last
# flag since we might be doing something like displaying a
# splash screen at startup...
if {!$numTopWins && [quit_if_last]} {
# save window positions of remaining windows
foreach obj $manage_active {
set g [wm geometry [winfo toplevel [namespace tail $obj]]]
pref setd gdb/geometry/[namespace tail $obj] $g
}
pref_save
gdb_force_quit
} else {
destroy_toplevel
}
}
}
|