summaryrefslogtreecommitdiff
path: root/gdb/gdbtk/library/toplevelwin.ith
blob: 0a3f4ad18b761c3352beae7d7d648f27951f1b2a (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
# TopLevelWin 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.


itcl::class TopLevelWin {
  inherit ManagedWin
  
  private variable frame ""

  constructor {args} {
    debug $itk_interior

    # create a container frame
    conFrame $itk_interior.container
    pack $itk_interior.container -fill both -expand 1
    
    # set up bindings for group iconification/deiconification    
    # NOT IMPLEMENTED YET
    #set top [winfo toplevel [namespace tail $this]]
    #bind_for_toplevel_only $top <Unmap> {
    #     manage_iconify iconify
    #}
    #bind_for_toplevel_only $top <Map> {
    #     manage_iconify deiconify
    #}
    incr numTopWins
  }
  
  public method conFrame {win} {
    set frame [cyg::panedwindow $win -height 5i]
    return $frame.con
  }

  public method conAdd {child args} {
    parse_args {{resizable 1}}
    $frame add $child -margin 0 -resizable $resizable
    return [$frame childsite $child].con
  }

  public method sizeWinByChild {child} {
    if {[catch {$frame childsite $child} childWin]} {
      debug "Could not find child $child"
      return
    }
    set width [winfo reqwidth $childWin]
    $frame configure -width $width
    
  }

  destructor {
    debug
    incr numTopWins -1
  }
}