2 # Copyright (C) 2001, 2008 Red Hat, Inc.
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License (GPL) as published by
6 # the Free Software Foundation; either version 2 of the License, or (at
7 # your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # ----------------------------------------------------------------------
15 # Implements a menu and a toolbar that are attached to a source window.
22 # configure ....... used to change public attributes
26 # X11 OPTION DATABASE ATTRIBUTES
29 # ----------------------------------------------------------------------
31 itcl::class PluginWindow {
32 inherit ManagedWin GDBEventHandler
34 # ------------------------------------------------------------------
35 # CONSTRUCTOR - create widget
36 # ------------------------------------------------------------------
39 # Create a menu widget for the plug-in window
40 set menubar [GDBMenuBar $itk_interior.menubar]
42 # Create a toolbar widget for the plug-in window
43 set toolbar [GDBToolBar $itk_interior.toolbar]
46 pack $toolbar -expand 1 -fill both
48 # Create a frame for the subclass to use
49 set child [frame $itk_interior.child]
52 pack $child -expand 1 -fill both
54 eval itk_initialize $args
55 add_hook gdb_no_inferior_hook [code $this no_inferior]
58 # ------------------------------------------------------------------
59 # DESTRUCTOR - destroy window containing widget
60 # ------------------------------------------------------------------
62 remove_hook gdb_no_inferior_hook [code $this no_inferior]
67 # ------------------------------------------------------------------
68 # ACCESSOR METHOD - Retrieve childsite
69 # ------------------------------------------------------------------
70 public method childsite {} {
74 # Don't automatically reload plugins.
75 protected method _ignore_on_save {} { return 1 }
77 ####################################################################
79 # State control methods used by both the menu and the toolbar
81 ####################################################################
83 # ------------------------------------------------------------------
84 # METHOD: idle - handle IdleEvent
85 # ------------------------------------------------------------------
86 protected method idle {event} {
87 debug "PluginWindow::idle"
91 # ------------------------------------------------------------------
92 # METHOD: busy - BusyEvent handler
93 # Invoked when gdb is going to run the inferior
94 # ------------------------------------------------------------------
95 public method busy {event} {
96 debug "PluginWindow::busy"
100 # ------------------------------------------------------------------
101 # METHOD: no_inferior
102 # Invoked when gdb detects the inferior is gone
103 # ------------------------------------------------------------------
104 protected method no_inferior {} {
109 ####################################################################
110 # The following method enables/disables both menus and buttons.
111 ####################################################################
113 # ------------------------------------------------------------------
114 # METHOD: enable_ui - enable/disable the appropriate buttons and menus
115 # Called from the busy, idle, and no_inferior hooks.
118 # value Control Other State
119 # 0 off off gdb is busy
120 # 1 on on gdb has inferior, and is idle
121 # 2 off on gdb has no inferior, and is idle
122 # ------------------------------------------------------------------
123 public method enable_ui {on} {
126 # Do the enabling so that all the disabling happens first, this way if a
127 # button belongs to two groups, enabling takes precedence, which is
133 set enable_list {Control disabled \
137 # Idle, with inferior
138 set enable_list {Control normal \
143 set enable_list {Control disabled \
147 debug "Unknown type: $on in enable_ui"
152 $menubar set_class_state $enable_list
153 $toolbar set_class_state $enable_list
156 ####################################################################
160 ####################################################################
163 private variable child
165 ####################################################################
169 ####################################################################
171 # The GdbMenuBar component
172 protected variable menubar
174 # The GdbToolBar component
175 protected variable toolbar
177 ####################################################################
181 ####################################################################