Ignore:
Timestamp:
May 9, 2013, 11:29:37 AM (11 years ago)
Author:
mmc
Message:

Fixes for nanoHUB ticket #258058 and #258045 -- note within a group tab
doesn't fill out the area properly. Should work better now. Also fixed
tabs to contain the window, instead of floating above the cotents as they
have for a long time.

Fixed boolean controls to have a more obvious on/off switch instead of a
checkbox. Fixed integers and spinners to use larger +/- buttons that are
easier to press on an iPad. Fixed numbers and other gauges to have the
same relief style as entries and other widgets.

Added new layout styles to groups: horizontal, vertical, tabs, and sentence.
You can now explicitly make a layout vertical instead of tabs by setting
the layout to "vertical" instead of throwing in a separator. Updated the
zoo/groups example to show off new horizontal and sentence types.

Fixed the "drawing" example in the zoo to gray out the trapezoid top when
it is disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/gauge.tcl

    r3510 r3642  
    2020option add *Gauge.sampleWidth 30 widgetDefault
    2121option add *Gauge.sampleHeight 20 widgetDefault
     22option add *Gauge.borderWidth 2 widgetDefault
     23option add *Gauge.relief sunken widgetDefault
    2224option add *Gauge.valuePosition "right" widgetDefault
    2325option add *Gauge.textBackground #cccccc widgetDefault
     
    5759    private variable _value 0  ;# value for this widget
    5860
    59     blt::bitmap define GaugeArrow-up {
    60         #define up_width 8
    61         #define up_height 4
    62         static unsigned char up_bits[] = {
    63            0x10, 0x38, 0x7c, 0xfe};
    64     }
    65     blt::bitmap define GaugeArrow-down {
    66         #define arrow_width 8
    67         #define arrow_height 4
    68         static unsigned char arrow_bits[] = {
    69            0xfe, 0x7c, 0x38, 0x10};
    70     }
    71 
    7261    blt::bitmap define GaugeArrow {
    7362        #define arrow_width 9
     
    8776# ----------------------------------------------------------------------
    8877itcl::body Rappture::Gauge::constructor {args} {
     78    itk_option remove hull.borderwidth hull.relief
     79    component hull configure -borderwidth 0
     80
    8981    itk_component add icon {
    9082        canvas $itk_interior.icon -width 1 -height 1 \
     
    9385        usual
    9486        ignore -highlightthickness -highlightbackground -highlightcolor
    95     }
    96     pack $itk_component(icon) -side left
     87        ignore -borderwidth -relief
     88    }
    9789    bind $itk_component(icon) <Configure> [itcl::code $this _redraw]
    9890
    9991    itk_component add -protected vframe {
    10092        frame $itk_interior.vframe
     93    } {
     94        keep -borderwidth -relief
    10195    }
    10296
    10397    itk_component add value {
    104         label $itk_component(vframe).value -borderwidth 1 -width 7 \
    105             -textvariable [itcl::scope _value]
     98        label $itk_component(vframe).value -width 7 \
     99            -borderwidth 1 -relief flat -textvariable [itcl::scope _value]
    106100    } {
    107101        rename -background -textbackground textBackground Background
     
    146140
    147141    itk_component add spinup {
    148         button $itk_component(spinner).up -bitmap GaugeArrow-up \
     142        button $itk_component(spinner).up -image [Rappture::icon intplus] \
    149143            -borderwidth 1 -relief raised -highlightthickness 0 \
    150144            -command [itcl::code $this bump 1]
     
    152146        usual
    153147        ignore -borderwidth -highlightthickness
    154     }
    155     pack $itk_component(spinup) -side top -expand yes -fill both
     148        rename -background -buttonbackground buttonBackground Background
     149    }
     150    pack $itk_component(spinup) -side left -expand yes -fill both
    156151
    157152    itk_component add spindn {
    158         button $itk_component(spinner).down -bitmap GaugeArrow-down \
     153        button $itk_component(spinner).down -image [Rappture::icon intminus] \
    159154            -borderwidth 1 -relief raised -highlightthickness 0 \
    160155            -command [itcl::code $this bump -1]
     
    162157        usual
    163158        ignore -borderwidth -highlightthickness
    164     }
    165     pack $itk_component(spindn) -side bottom -expand yes -fill both
     159        rename -background -buttonbackground buttonBackground Background
     160    }
     161    pack $itk_component(spindn) -side right -expand yes -fill both
    166162
    167163
    168164    itk_component add presets {
    169165        button $itk_component(vframe).psbtn -bitmap GaugeArrow \
    170             -borderwidth 1 -highlightthickness 0 -relief flat
     166            -borderwidth 1 -highlightthickness 0 -relief raised
    171167    } {
    172168        usual
    173169        ignore -borderwidth -relief -highlightthickness
    174         rename -background -textbackground textBackground Background
    175170    }
    176171
     
    470465        $itk_component($comp) configure -relief solid
    471466    } else {
    472         $itk_component($comp) configure -relief flat
     467        if {$comp eq "presets"} {
     468            $itk_component($comp) configure -relief raised
     469        } else {
     470            $itk_component($comp) configure -relief flat
     471        }
    473472    }
    474473}
     
    560559        }
    561560        unpost {
    562             $itk_component(presets) configure -relief flat
     561            $itk_component(presets) configure -relief raised
    563562        }
    564563        select {
     
    600599
    601600    if {"" != $itk_option(-image) || "" != $itk_option(-spectrum)} {
    602         pack $itk_component(icon) -side $pos
     601        pack $itk_component(icon) -side $pos -padx 2
    603602    }
    604603}
Note: See TracChangeset for help on using the changeset viewer.