source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/opentea/create_switchform.tcl @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 3.8 KB
Line 
1#  This program is under CECILL_B licence. See footer for details.
2
3
4
5###############################################
6# Switch form,based upon the Tabnotebook
7# Beware of multiple matches bindings like in scrollbars
8################################################
9
10# creation of the notebook without tabs
11proc switchform_create { win } {
12    global widgetInfo
13    ttk::frame $win
14    ttk::frame $win.blank
15    label $win.blank.logo -image bg_200 -text "Nothing selected..." -compound top -font "helvetica 30" -bg [ThemeColor 1.0] -fg [ThemeColor 0.9]
16   
17    pack $win.blank.logo -side left -padx 200 -pady 20
18   
19    pack $win -side top -expand 1 -fill both
20}
21
22# add a tab to the switchform
23proc switchform_add { win name } {
24                ttk::frame $win.$name
25}
26
27# remove a tab to the switchform
28proc switchform_del { win name } {
29                destroy $win.$name
30}
31
32
33# raise a tab in the switchform
34proc switchform_raise { win name } {
35    global widgetInfo
36    catch {
37        if { [winfo ismapped $win.$name] == 0 } {
38            foreach wc [winfo children $win] {
39            pack forget $wc 
40        }
41        pack $win.$name  -side top -fill x
42        set widgetInfo(fixedview) 1
43        event generate . <<SetView>>
44        set widgetInfo(fixedview) 0
45        }
46    }
47   
48}
49
50
51# raise a tab in the switchform
52proc switchform_blank { win  } {
53    global widgetInfo
54    catch {
55        foreach wc [winfo children $win] {
56            pack forget $wc
57        }
58    }
59    pack $win.blank -side top
60   
61    set widgetInfo(fixedview) 1
62    event generate . <<SetView>>
63    set widgetInfo(fixedview) 0
64}
65
66
67# return where child widgets must be packed
68proc switchform_interior { win name } {
69        return $win.$name
70}
71
72
73
74
75
76# former version using tabnotebooks
77
78proc switchform_create2 { win } {
79    ttk::notebook $win -style "NoTabs.TNotebook"
80    ttk::notebook::enableTraversal $win
81    pack $win -side top -expand 1 -fill both
82}
83
84proc switchform_add2 { win name } {
85                $win add [ttk::frame $win.$name] -sticky news
86}
87
88proc switchform_raise2 { win name } {
89   
90    if { [$win select] != "$win.$name" } {
91        $win select $win.$name
92        $win configure -height -1
93        update idletasks
94        set height 0
95        foreach wc [winfo children $win.$name] {
96            incr height [winfo reqheight $wc]
97        }
98        $win configure -height $height
99    }
100}
101
102
103
104
105#  Copyright CERFACS 2014
106#   
107#  antoine.dauptain@cerfacs.fr
108#   
109#  This software is a computer program whose purpose is to ensure technology
110#  transfer between academia and industry.
111#   
112#  This software is governed by the CeCILL-B license under French law and
113#  abiding by the rules of distribution of free software.  You can  use,
114#  modify and/ or redistribute the software under the terms of the CeCILL-B
115#  license as circulated by CEA, CNRS and INRIA at the following URL
116#  "http://www.cecill.info".
117#   
118#  As a counterpart to the access to the source code and  rights to copy,
119#  modify and redistribute granted by the license, users are provided only
120#  with a limited warranty  and the software's author,  the holder of the
121#  economic rights,  and the successive licensors  have only  limited
122#  liability.
123#   
124#  In this respect, the user's attention is drawn to the risks associated
125#  with loading,  using,  modifying and/or developing or reproducing the
126#  software by the user in light of its specific status of free software,
127#  that may mean  that it is complicated to manipulate,  and  that  also
128#  therefore means  that it is reserved for developers  and  experienced
129#  professionals having in-depth computer knowledge. Users are therefore
130#  encouraged to load and test the software's suitability as regards their
131#  requirements in conditions enabling the security of their systems and/or
132#  data to be ensured and,  more generally, to use and operate it in the
133#  same conditions as regards security.
134#   
135#  The fact that you are presently reading this means that you have had
136#  knowledge of the CeCILL-B license and that you accept its terms.
Note: See TracBrowser for help on using the repository browser.