OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [generic/] [extfileselectiondialog.itk] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#
2
# Extfileselectiondialog
3
# ----------------------------------------------------------------------
4
# Implements a file selection dialog that is a slightly extended version
5
# of the OSF/Motif standard composite widget.  The Extfileselectionbox
6
# differs from the Motif standard in that the filter and selection
7
# fields are comboboxes and the files and directory lists are in a
8
# paned window.
9
#
10
# ----------------------------------------------------------------------
11
#  AUTHOR: Mark L. Ulferts               EMAIL: mulferts@spd.dsccc.com
12
#
13
#  @(#) $Id: extfileselectiondialog.itk,v 1.1.1.1 2002-01-16 10:24:50 markom Exp $
14
# ----------------------------------------------------------------------
15
#            Copyright (c) 1997 DSC Technologies Corporation
16
# ======================================================================
17
# Permission to use, copy, modify, distribute and license this software
18
# and its documentation for any purpose, and without fee or written
19
# agreement with DSC, is hereby granted, provided that the above copyright
20
# notice appears in all copies and that both the copyright notice and
21
# warranty disclaimer below appear in supporting documentation, and that
22
# the names of DSC Technologies Corporation or DSC Communications
23
# Corporation not be used in advertising or publicity pertaining to the
24
# software without specific, written prior permission.
25
#
26
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
28
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
29
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
30
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
31
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
32
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
33
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
34
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
35
# SOFTWARE.
36
# ======================================================================
37
 
38
#
39
# Usual options.
40
#
41
itk::usual Extfileselectiondialog {
42
    keep -activebackground -activerelief -background -borderwidth -cursor \
43
         -elementborderwidth -foreground -highlightcolor -highlightthickness \
44
         -insertbackground -insertborderwidth -insertofftime -insertontime \
45
         -insertwidth -jump -labelfont -modality -selectbackground \
46
         -selectborderwidth -textbackground -textfont
47
}
48
 
49
# ------------------------------------------------------------------
50
#                        EXTFILESELECTIONDIALOG
51
# ------------------------------------------------------------------
52
class iwidgets::Extfileselectiondialog {
53
    inherit iwidgets::Dialog
54
 
55
    constructor {args} {}
56
 
57
    public {
58
        method childsite {}
59
        method get {}
60
        method filter {}
61
    }
62
 
63
    protected method _dbldir {}
64
}
65
 
66
#
67
# Provide a lowercased access method for the Extfileselectiondialog class.
68
#
69
proc ::iwidgets::extfileselectiondialog {pathName args} {
70
    uplevel ::iwidgets::Extfileselectiondialog $pathName $args
71
}
72
 
73
#
74
# Use option database to override default resources of base classes.
75
#
76
option add *Extfileselectiondialog.borderWidth 2 widgetDefault
77
 
78
option add *Extfileselectiondialog.title "File Selection Dialog" widgetDefault
79
 
80
option add *Extfileselectiondialog.width 350 widgetDefault
81
option add *Extfileselectiondialog.height 400 widgetDefault
82
 
83
option add *Extfileselectiondialog.master "." widgetDefault
84
 
85
# ------------------------------------------------------------------
86
#                        CONSTRUCTOR
87
# ------------------------------------------------------------------
88
body iwidgets::Extfileselectiondialog::constructor {args} {
89
    component hull configure -borderwidth 0
90
    itk_option add hull.width hull.height
91
 
92
    #
93
    # Turn off pack propagation for the hull widget so the width
94
    # and height options become active.
95
    #
96
    pack propagate $itk_component(hull) no
97
 
98
    #
99
    # Instantiate a file selection box widget.
100
    #
101
    itk_component add fsb {
102
        iwidgets::Extfileselectionbox $itk_interior.fsb -width 150 -height 150 \
103
                -selectioncommand [code $this invoke] \
104
                -selectdircommand [code $this default Apply] \
105
                -selectfilecommand [code $this default OK]
106
    } {
107
        usual
108
 
109
        keep -labelfont -childsitepos -directory -dirslabel \
110
            -dirsearchcommand -dirson -fileslabel -fileson \
111
            -filesearchcommand -filterlabel -filteron \
112
            -filetype -invalid -mask -nomatchstring \
113
            -selectionlabel -selectionon
114
    }
115
    grid $itk_component(fsb) -sticky nsew
116
    grid rowconfigure $itk_interior 0 -weight 1
117
    grid columnconfigure $itk_interior 0 -weight 1
118
 
119
    $itk_component(fsb) component filter configure \
120
        -focuscommand [code $this default Apply]
121
    $itk_component(fsb) component selection configure \
122
        -focuscommand [code $this default OK]
123
    $itk_component(fsb) component dirs configure \
124
                -dblclickcommand [code $this _dbldir]
125
    $itk_component(fsb) component files configure \
126
                -dblclickcommand [code $this invoke]
127
 
128
    buttonconfigure Apply -text "Filter" \
129
            -command [code $itk_component(fsb) filter]
130
 
131
    set itk_interior [$itk_component(fsb) childsite]
132
 
133
    hide Help
134
 
135
    eval itk_initialize $args
136
}
137
 
138
# ------------------------------------------------------------------
139
#                            METHODS
140
# ------------------------------------------------------------------
141
 
142
# ------------------------------------------------------------------
143
# METHOD: childsite
144
#
145
# Thinwrapped method of file selection box class.
146
# ------------------------------------------------------------------
147
body iwidgets::Extfileselectiondialog::childsite {} {
148
    return [$itk_component(fsb) childsite]
149
}
150
 
151
# ------------------------------------------------------------------
152
# METHOD: get
153
#
154
# Thinwrapped method of file selection box class.
155
# ------------------------------------------------------------------
156
body iwidgets::Extfileselectiondialog::get {} {
157
    return [$itk_component(fsb) get]
158
}
159
 
160
# ------------------------------------------------------------------
161
# METHOD: filter
162
#
163
# Thinwrapped method of file selection box class.
164
# ------------------------------------------------------------------
165
body iwidgets::Extfileselectiondialog::filter {} {
166
    return [$itk_component(fsb) filter]
167
}
168
 
169
# ------------------------------------------------------------------
170
# PROTECTED METHOD: _dbldir
171
#
172
# Double select in directory list.  If the files list is on then
173
# make the default button the filter and invoke.  If not, just invoke.
174
# ------------------------------------------------------------------
175
body iwidgets::Extfileselectiondialog::_dbldir {} {
176
    if {$itk_option(-fileson)} {
177
        default Apply
178
    }
179
 
180
    invoke
181
}
182
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.