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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [generic/] [dialogshell.itk] - Diff between revs 578 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 578 Rev 1765
# Dialogshell
# Dialogshell
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# This class is implements a dialog shell which is a top level widget
# This class is implements a dialog shell which is a top level widget
# composed of a button box, separator, and child site area.  The class
# composed of a button box, separator, and child site area.  The class
# also has methods to control button construction.
# also has methods to control button construction.
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
#  AUTHOR: Mark L. Ulferts              EMAIL: mulferts@austin.dsccc.com
#  AUTHOR: Mark L. Ulferts              EMAIL: mulferts@austin.dsccc.com
#
#
#  @(#) $Id: dialogshell.itk,v 1.1.1.1 2002-01-16 10:24:50 markom Exp $
#  @(#) $Id: dialogshell.itk,v 1.1.1.1 2002-01-16 10:24:50 markom Exp $
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
#            Copyright (c) 1995 DSC Technologies Corporation
#            Copyright (c) 1995 DSC Technologies Corporation
# ======================================================================
# ======================================================================
# Permission to use, copy, modify, distribute and license this software
# Permission to use, copy, modify, distribute and license this software
# and its documentation for any purpose, and without fee or written
# and its documentation for any purpose, and without fee or written
# agreement with DSC, is hereby granted, provided that the above copyright
# agreement with DSC, is hereby granted, provided that the above copyright
# notice appears in all copies and that both the copyright notice and
# notice appears in all copies and that both the copyright notice and
# warranty disclaimer below appear in supporting documentation, and that
# warranty disclaimer below appear in supporting documentation, and that
# the names of DSC Technologies Corporation or DSC Communications
# the names of DSC Technologies Corporation or DSC Communications
# Corporation not be used in advertising or publicity pertaining to the
# Corporation not be used in advertising or publicity pertaining to the
# software without specific, written prior permission.
# software without specific, written prior permission.
#
#
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# SOFTWARE.
# ======================================================================
# ======================================================================
#
#
# Usual options.
# Usual options.
#
#
itk::usual Dialogshell {
itk::usual Dialogshell {
    keep -background -cursor -foreground -modality
    keep -background -cursor -foreground -modality
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
#                            DIALOGSHELL
#                            DIALOGSHELL
# ------------------------------------------------------------------
# ------------------------------------------------------------------
class iwidgets::Dialogshell {
class iwidgets::Dialogshell {
    inherit iwidgets::Shell
    inherit iwidgets::Shell
    constructor {args} {}
    constructor {args} {}
    itk_option define -thickness thickness Thickness 3
    itk_option define -thickness thickness Thickness 3
    itk_option define -buttonboxpos buttonBoxPos Position s
    itk_option define -buttonboxpos buttonBoxPos Position s
    itk_option define -separator separator Separator on
    itk_option define -separator separator Separator on
    itk_option define -padx padX Pad 10
    itk_option define -padx padX Pad 10
    itk_option define -pady padY Pad 10
    itk_option define -pady padY Pad 10
    public method childsite {}
    public method childsite {}
    public method index {args}
    public method index {args}
    public method add {args}
    public method add {args}
    public method insert {args}
    public method insert {args}
    public method delete {args}
    public method delete {args}
    public method hide {args}
    public method hide {args}
    public method show {args}
    public method show {args}
    public method default {args}
    public method default {args}
    public method invoke {args}
    public method invoke {args}
    public method buttonconfigure {args}
    public method buttonconfigure {args}
    public method buttoncget {index option}
    public method buttoncget {index option}
}
}
#
#
# Provide a lowercased access method for the Dialogshell class.
# Provide a lowercased access method for the Dialogshell class.
#
#
proc ::iwidgets::dialogshell {pathName args} {
proc ::iwidgets::dialogshell {pathName args} {
    uplevel ::iwidgets::Dialogshell $pathName $args
    uplevel ::iwidgets::Dialogshell $pathName $args
}
}
#
#
# Use option database to override default resources of base classes.
# Use option database to override default resources of base classes.
#
#
option add *Dialogshell.master "." widgetDefault
option add *Dialogshell.master "." widgetDefault
# ------------------------------------------------------------------
# ------------------------------------------------------------------
#                        CONSTRUCTOR
#                        CONSTRUCTOR
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::constructor {args} {
body iwidgets::Dialogshell::constructor {args} {
    itk_option remove iwidgets::Shell::padx iwidgets::Shell::pady
    itk_option remove iwidgets::Shell::padx iwidgets::Shell::pady
    #
    #
    # Create the user child site, separator, and button box,
    # Create the user child site, separator, and button box,
    #
    #
    itk_component add -protected dschildsite {
    itk_component add -protected dschildsite {
        frame $itk_interior.dschildsite
        frame $itk_interior.dschildsite
    }
    }
    itk_component add separator {
    itk_component add separator {
        frame $itk_interior.separator -relief sunken
        frame $itk_interior.separator -relief sunken
    }
    }
    itk_component add bbox {
    itk_component add bbox {
        iwidgets::Buttonbox $itk_interior.bbox
        iwidgets::Buttonbox $itk_interior.bbox
    } {
    } {
        usual
        usual
        rename -padx -buttonboxpadx buttonBoxPadX Pad
        rename -padx -buttonboxpadx buttonBoxPadX Pad
        rename -pady -buttonboxpady buttonBoxPadY Pad
        rename -pady -buttonboxpady buttonBoxPadY Pad
    }
    }
    #
    #
    # Set the itk_interior variable to be the childsite for derived
    # Set the itk_interior variable to be the childsite for derived
    # classes.
    # classes.
    #
    #
    set itk_interior $itk_component(dschildsite)
    set itk_interior $itk_component(dschildsite)
    #
    #
    # Set up the default button so that if  is pressed in
    # Set up the default button so that if  is pressed in
    # any widget, it will invoke the default button.
    # any widget, it will invoke the default button.
    #
    #
    bind $itk_component(hull)  [code $this invoke]
    bind $itk_component(hull)  [code $this invoke]
    #
    #
    # Initialize the widget based on the command line options.
    # Initialize the widget based on the command line options.
    #
    #
    eval itk_initialize $args
    eval itk_initialize $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
#                             OPTIONS
#                             OPTIONS
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -thickness
# OPTION: -thickness
#
#
# Specifies the thickness of the separator.  It sets the width and
# Specifies the thickness of the separator.  It sets the width and
# height of the separator to the thickness value and the borderwidth
# height of the separator to the thickness value and the borderwidth
# to half the thickness.
# to half the thickness.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
configbody iwidgets::Dialogshell::thickness {
configbody iwidgets::Dialogshell::thickness {
    $itk_component(separator) config -height $itk_option(-thickness)
    $itk_component(separator) config -height $itk_option(-thickness)
    $itk_component(separator) config -width $itk_option(-thickness)
    $itk_component(separator) config -width $itk_option(-thickness)
    $itk_component(separator) config \
    $itk_component(separator) config \
            -borderwidth [expr $itk_option(-thickness) / 2]
            -borderwidth [expr $itk_option(-thickness) / 2]
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -buttonboxpos
# OPTION: -buttonboxpos
#
#
# Specifies the position of the button box relative to the child site.
# Specifies the position of the button box relative to the child site.
# The separator appears between the child site and button box.
# The separator appears between the child site and button box.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
configbody iwidgets::Dialogshell::buttonboxpos {
configbody iwidgets::Dialogshell::buttonboxpos {
    set parent [winfo parent $itk_component(bbox)]
    set parent [winfo parent $itk_component(bbox)]
    switch $itk_option(-buttonboxpos) {
    switch $itk_option(-buttonboxpos) {
        n {
        n {
            $itk_component(bbox) configure -orient horizontal
            $itk_component(bbox) configure -orient horizontal
            grid $itk_component(bbox) -row 0 -column 0 -sticky ew
            grid $itk_component(bbox) -row 0 -column 0 -sticky ew
            grid $itk_component(separator) -row 1 -column 0 -sticky ew
            grid $itk_component(separator) -row 1 -column 0 -sticky ew
            grid $itk_component(dschildsite) -row 2 -column 0 -sticky nsew
            grid $itk_component(dschildsite) -row 2 -column 0 -sticky nsew
            grid rowconfigure $parent 0 -weight 0
            grid rowconfigure $parent 0 -weight 0
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 2 -weight 1
            grid rowconfigure $parent 2 -weight 1
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 2 -weight 0
            grid columnconfigure $parent 2 -weight 0
        }
        }
        s {
        s {
            $itk_component(bbox) configure -orient horizontal
            $itk_component(bbox) configure -orient horizontal
            grid $itk_component(dschildsite) -row 0 -column 0 -sticky nsew
            grid $itk_component(dschildsite) -row 0 -column 0 -sticky nsew
            grid $itk_component(separator) -row 1 -column 0 -sticky ew
            grid $itk_component(separator) -row 1 -column 0 -sticky ew
            grid $itk_component(bbox) -row 2 -column 0 -sticky ew
            grid $itk_component(bbox) -row 2 -column 0 -sticky ew
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 2 -weight 0
            grid columnconfigure $parent 2 -weight 0
        }
        }
        w {
        w {
            $itk_component(bbox) configure -orient vertical
            $itk_component(bbox) configure -orient vertical
            grid $itk_component(bbox) -row 0 -column 0 -sticky ns
            grid $itk_component(bbox) -row 0 -column 0 -sticky ns
            grid $itk_component(separator) -row 0 -column 1 -sticky ns
            grid $itk_component(separator) -row 0 -column 1 -sticky ns
            grid $itk_component(dschildsite) -row 0 -column 2 -sticky nsew
            grid $itk_component(dschildsite) -row 0 -column 2 -sticky nsew
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid columnconfigure $parent 0 -weight 0
            grid columnconfigure $parent 0 -weight 0
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 2 -weight 1
            grid columnconfigure $parent 2 -weight 1
        }
        }
        e {
        e {
            $itk_component(bbox) configure -orient vertical
            $itk_component(bbox) configure -orient vertical
            grid $itk_component(dschildsite) -row 0 -column 0 -sticky nsew
            grid $itk_component(dschildsite) -row 0 -column 0 -sticky nsew
            grid $itk_component(separator) -row 0 -column 1 -sticky ns
            grid $itk_component(separator) -row 0 -column 1 -sticky ns
            grid $itk_component(bbox) -row 0 -column 2 -sticky ns
            grid $itk_component(bbox) -row 0 -column 2 -sticky ns
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 0 -weight 1
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 1 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid rowconfigure $parent 2 -weight 0
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 0 -weight 1
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 1 -weight 0
            grid columnconfigure $parent 2 -weight 0
            grid columnconfigure $parent 2 -weight 0
        }
        }
        default {
        default {
            error "bad buttonboxpos option\
            error "bad buttonboxpos option\
                    \"$itk_option(-buttonboxpos)\": should be n,\
                    \"$itk_option(-buttonboxpos)\": should be n,\
                    s, e, or w"
                    s, e, or w"
        }
        }
    }
    }
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -separator
# OPTION: -separator
#
#
# Boolean option indicating wheather to display the separator.
# Boolean option indicating wheather to display the separator.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
configbody iwidgets::Dialogshell::separator {
configbody iwidgets::Dialogshell::separator {
    if {$itk_option(-separator)} {
    if {$itk_option(-separator)} {
        $itk_component(separator) configure -relief sunken
        $itk_component(separator) configure -relief sunken
    } else {
    } else {
        $itk_component(separator) configure -relief flat
        $itk_component(separator) configure -relief flat
    }
    }
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -padx
# OPTION: -padx
#
#
# Specifies a padding distance for the childsite in the X-direction.
# Specifies a padding distance for the childsite in the X-direction.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
configbody iwidgets::Dialogshell::padx {
configbody iwidgets::Dialogshell::padx {
    grid configure $itk_component(dschildsite) -padx $itk_option(-padx)
    grid configure $itk_component(dschildsite) -padx $itk_option(-padx)
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -pady
# OPTION: -pady
#
#
# Specifies a padding distance for the childsite in the Y-direction.
# Specifies a padding distance for the childsite in the Y-direction.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
configbody iwidgets::Dialogshell::pady {
configbody iwidgets::Dialogshell::pady {
    grid configure $itk_component(dschildsite) -pady $itk_option(-pady)
    grid configure $itk_component(dschildsite) -pady $itk_option(-pady)
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
#                            METHODS
#                            METHODS
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: childsite
# METHOD: childsite
#
#
# Return the pathname of the user accessible area.
# Return the pathname of the user accessible area.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::childsite {} {
body iwidgets::Dialogshell::childsite {} {
    return $itk_component(dschildsite)
    return $itk_component(dschildsite)
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: index index
# METHOD: index index
#
#
# Thin wrapper of Buttonbox's index method.
# Thin wrapper of Buttonbox's index method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::index {args} {
body iwidgets::Dialogshell::index {args} {
    uplevel $itk_component(bbox) index $args
    uplevel $itk_component(bbox) index $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: add tag ?option value ...?
# METHOD: add tag ?option value ...?
#
#
# Thin wrapper of Buttonbox's add method.
# Thin wrapper of Buttonbox's add method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::add {args} {
body iwidgets::Dialogshell::add {args} {
    uplevel $itk_component(bbox) add $args
    uplevel $itk_component(bbox) add $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: insert index tag ?option value ...?
# METHOD: insert index tag ?option value ...?
#
#
# Thin wrapper of Buttonbox's insert method.
# Thin wrapper of Buttonbox's insert method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::insert {args} {
body iwidgets::Dialogshell::insert {args} {
    uplevel $itk_component(bbox) insert $args
    uplevel $itk_component(bbox) insert $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: delete tag
# METHOD: delete tag
#
#
# Thin wrapper of Buttonbox's delete method.
# Thin wrapper of Buttonbox's delete method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::delete {args} {
body iwidgets::Dialogshell::delete {args} {
    uplevel $itk_component(bbox) delete $args
    uplevel $itk_component(bbox) delete $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: hide index
# METHOD: hide index
#
#
# Thin wrapper of Buttonbox's hide method.
# Thin wrapper of Buttonbox's hide method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::hide {args} {
body iwidgets::Dialogshell::hide {args} {
    uplevel $itk_component(bbox) hide $args
    uplevel $itk_component(bbox) hide $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: show index
# METHOD: show index
#
#
# Thin wrapper of Buttonbox's show method.
# Thin wrapper of Buttonbox's show method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::show {args} {
body iwidgets::Dialogshell::show {args} {
    uplevel $itk_component(bbox) show $args
    uplevel $itk_component(bbox) show $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: default index
# METHOD: default index
#
#
# Thin wrapper of Buttonbox's default method.
# Thin wrapper of Buttonbox's default method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::default {args} {
body iwidgets::Dialogshell::default {args} {
    uplevel $itk_component(bbox) default $args
    uplevel $itk_component(bbox) default $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: invoke ?index?
# METHOD: invoke ?index?
#
#
# Thin wrapper of Buttonbox's invoke method.
# Thin wrapper of Buttonbox's invoke method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::invoke {args} {
body iwidgets::Dialogshell::invoke {args} {
    uplevel $itk_component(bbox) invoke $args
    uplevel $itk_component(bbox) invoke $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: buttonconfigure index ?option? ?value option value ...?
# METHOD: buttonconfigure index ?option? ?value option value ...?
#
#
# Thin wrapper of Buttonbox's buttonconfigure method.
# Thin wrapper of Buttonbox's buttonconfigure method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::buttonconfigure {args} {
body iwidgets::Dialogshell::buttonconfigure {args} {
    uplevel $itk_component(bbox) buttonconfigure $args
    uplevel $itk_component(bbox) buttonconfigure $args
}
}
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: buttoncget index option
# METHOD: buttoncget index option
#
#
# Thin wrapper of Buttonbox's buttoncget method.
# Thin wrapper of Buttonbox's buttoncget method.
# ------------------------------------------------------------------
# ------------------------------------------------------------------
body iwidgets::Dialogshell::buttoncget {index option} {
body iwidgets::Dialogshell::buttoncget {index option} {
  uplevel $itk_component(bbox) buttoncget [list $index] \
  uplevel $itk_component(bbox) buttoncget [list $index] \
        [list $option]
        [list $option]
}
}
 
 

powered by: WebSVN 2.1.0

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