Changeset 1725 for branches/blt4


Ignore:
Timestamp:
May 20, 2010, 8:27:02 AM (14 years ago)
Author:
gah
Message:
 
Location:
branches/blt4/gui/scripts
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/flowvisviewer.tcl

    r1719 r1725  
    169169}
    170170
     171itk::usual TkPushbutton {
     172}
     173
    171174# ----------------------------------------------------------------------
    172175# CONSTRUCTOR
     
    301304
    302305    itk_component add volume {
    303         Rappture::PushButton $f.volume \
     306        blt::tk::pushbutton $f.volume \
    304307            -onimage [Rappture::icon volume-on] \
    305308            -offimage [Rappture::icon volume-off] \
     
    387390    # Play
    388391    itk_component add play {
    389         Rappture::PushButton $itk_component(flowcontrols).play \
     392        blt::tk::pushbutton $itk_component(flowcontrols).play \
    390393            -onimage [Rappture::icon flow-pause] \
    391394            -offimage [Rappture::icon flow-play] \
     
    399402    # Loop
    400403    itk_component add loop {
    401         Rappture::PushButton $itk_component(flowcontrols).loop \
     404        blt::tk::pushbutton $itk_component(flowcontrols).loop \
    402405            -onimage [Rappture::icon flow-loop] \
    403406            -offimage [Rappture::icon flow-loop] \
     
    22502253    # X-value slicer...
    22512254    itk_component add xCutButton {
    2252         Rappture::PushButton $inner.xbutton \
     2255        blt::tk::pushbutton $inner.xbutton \
    22532256            -onimage [Rappture::icon x-cutplane] \
    22542257            -offimage [Rappture::icon x-cutplane] \
     
    22772280    # Y-value slicer...
    22782281    itk_component add yCutButton {
    2279         Rappture::PushButton $inner.ybutton \
     2282        blt::tk::pushbutton $inner.ybutton \
    22802283            -onimage [Rappture::icon y-cutplane] \
    22812284            -offimage [Rappture::icon y-cutplane] \
     
    23042307    # Z-value slicer...
    23052308    itk_component add zCutButton {
    2306         Rappture::PushButton $inner.zbutton \
     2309        blt::tk::pushbutton $inner.zbutton \
    23072310            -onimage [Rappture::icon z-cutplane] \
    23082311            -offimage [Rappture::icon z-cutplane] \
  • branches/blt4/gui/scripts/heightmapviewer.tcl

    r1719 r1725  
    109109    keep -plotbackground -plotforeground
    110110}
     111itk::usual TkPushbutton {
     112}
    111113
    112114# ----------------------------------------------------------------------
     
    216218
    217219    itk_component add surface {
    218         Rappture::PushButton $f.surface \
     220        blt::tk::pushbutton $f.surface \
    219221            -onimage [Rappture::icon volume-on] \
    220222            -offimage [Rappture::icon volume-off] \
  • branches/blt4/gui/scripts/molvisviewer.tcl

    r1719 r1725  
    141141itk::usual MolvisViewer {
    142142    keep -background -foreground -cursor -font
     143}
     144itk::usual TkPushbutton {
    143145}
    144146
     
    263265
    264266    itk_component add labels {
    265         Rappture::PushButton $f.labels \
     267        blt::tk::pushbutton $f.labels \
    266268            -onimage [Rappture::icon molvis-labels-view] \
    267269            -offimage [Rappture::icon molvis-labels-view] \
     
    275277
    276278    itk_component add rock {
    277         Rappture::PushButton $f.rock \
     279        blt::tk::pushbutton $f.rock \
    278280            -onimage [Rappture::icon molvis-rock-view] \
    279281            -offimage [Rappture::icon molvis-rock-view] \
  • branches/blt4/gui/scripts/nanovisviewer.tcl

    r1719 r1725  
    161161    keep -plotbackground -plotforeground
    162162}
     163itk::usual TkPushbutton {
     164}
    163165
    164166# ----------------------------------------------------------------------
     
    267269
    268270    itk_component add volume {
    269         Rappture::PushButton $f.volume \
     271        blt::tk::pushbutton $f.volume \
    270272            -onimage [Rappture::icon volume-on] \
    271273            -offimage [Rappture::icon volume-off] \
  • branches/blt4/gui/scripts/pushbutton.tcl

    r1670 r1725  
    3838    public method select {}
    3939    public method toggle {}
     40    public method disable {}
     41    public method enable {}
    4042
    4143    protected method _fixValue {args}
    4244
    4345    private variable _state 0
    44     public variable command "";         # Command to be invoked
    45     private variable _variable "";      # Variable to be set.
    46     public variable onimage "";         # Image displayed when selected
    47     public variable offimage "";        # Image displayed when deselected.
    48     public variable onvalue "1";        # Value set when selected.
    49     public variable offvalue "0";       # Value set when deselected.
     46    private variable _enabled 1
     47    public variable command "";         # Command to be invoked
     48    private variable _variable "";      # Variable to be set.
     49    public variable onimage "";         # Image displayed when selected
     50    public variable offimage "";        # Image displayed when deselected.
     51    public variable disabledimage "";   # Image displayed when deselected.
     52    public variable onvalue "1";        # Value set when selected.
     53    public variable offvalue "0";       # Value set when deselected.
    5054}
    5155
     
    6064itcl::body Rappture::PushButton::constructor {args} {
    6165    itk_component add button {
    62         label $itk_interior.button -borderwidth 1 -relief sunken
     66        label $itk_interior.button -borderwidth 1 -relief sunken
    6367    } {
    64         usual
    65         ignore -padx -pady -relief -borderwidth -background
     68        usual
     69        ignore -padx -pady -relief -borderwidth -background
    6670    }
    6771    bind $itk_component(button) <ButtonPress> \
     
    7276}
    7377
    74 # ----------------------------------------------------------------------
    75 # CONSTRUCTOR
    76 # ----------------------------------------------------------------------
    77 itcl::body Rappture::PushButton::destructor {} {
    78    if {"" != $_variable} {
    79         upvar #0 $_variable var
    80         trace remove variable var write [itcl::code $this _fixValue]
     78itcl::body Rappture::PushButton::invoke {} {
     79    if { !$_enabled } {
     80        puts "in invoke button not enabled"
     81        return
    8182    }
    82 }
    83 
    84 itcl::body Rappture::PushButton::invoke {} {
    8583    toggle
    8684    if { $command != "" } {
    87         uplevel \#0 $command
     85        uplevel \#0 $command
    8886    }
    8987}
    9088
    9189itcl::body Rappture::PushButton::toggle {} {
     90    if { !$_enabled } {
     91        return
     92    }
    9293    set _state [expr !$_state]
    9394    if { $_state } {
    94         select
     95        select
    9596    } else {
    96         deselect
     97        deselect
     98    }
     99}
     100
     101itcl::body Rappture::PushButton::disable {} {
     102    if { $_enabled } {
     103        set _enabled [expr !$_enabled]
     104        $itk_component(button) configure -relief raise \
     105            -image $disabledimage -bg grey85
     106    }
     107}
     108
     109itcl::body Rappture::PushButton::enable {} {
     110    if { !$_enabled } {
     111        set _enabled [expr !$_enabled]
     112        _fixValue
    97113    }
    98114}
     
    107123itcl::body Rappture::PushButton::_fixValue {args} {
    108124    if {"" == $itk_option(-variable)} {
    109         return
     125        return
    110126    }
    111127    upvar #0 $itk_option(-variable) var
     
    125141
    126142itcl::body Rappture::PushButton::select {} {
     143    if { !$_enabled } {
     144        return
     145    }
    127146    upvar #0 $_variable state
    128147    set state $onvalue
     
    130149
    131150itcl::body Rappture::PushButton::deselect {} {
     151    if { !$_enabled } {
     152        return
     153    }
    132154    upvar #0 $_variable state
    133155    set state $offvalue
  • branches/blt4/gui/scripts/xyprint.tcl

    r1719 r1725  
    809809        "Set the size (points) of the font."
    810810
    811     Rappture::PushButton $page.fontweight \
     811    blt::tk::pushbutton $page.fontweight \
    812812        -width 18 -height 18 \
    813813        -onimage [Rappture::icon font-bold] \
     
    819819        "Use the bold version of the font."
    820820
    821     Rappture::PushButton $page.fontslant \
     821    blt::tk::pushbutton $page.fontslant \
    822822        -width 18 -height 18 \
    823823        -onimage [Rappture::icon font-italic] \
     
    962962        "Set the size (points) of the tick font."
    963963
    964     Rappture::PushButton $page.tickfontweight \
     964    blt::tk::pushbutton $page.tickfontweight \
    965965        -width 18 -height 18 \
    966966        -onimage [Rappture::icon font-bold] \
     
    972972        "Use the bold version of the tick font."
    973973
    974     Rappture::PushButton $page.tickfontslant \
     974    blt::tk::pushbutton $page.tickfontslant \
    975975        -width 18 -height 18 \
    976976        -onimage [Rappture::icon font-italic] \
     
    10091009        "Set the size (point) of the title font."
    10101010
    1011     Rappture::PushButton $page.titlefontweight \
     1011    blt::tk::pushbutton $page.titlefontweight \
    10121012        -width 18 -height 18 \
    10131013        -onimage [Rappture::icon font-bold] \
     
    10191019        "Use the bold version of the title font."
    10201020
    1021     Rappture::PushButton $page.titlefontslant \
     1021    blt::tk::pushbutton $page.titlefontslant \
    10221022        -width 18 -height 18 \
    10231023        -onimage [Rappture::icon font-italic] \
Note: See TracChangeset for help on using the changeset viewer.