Ignore:
Timestamp:
Jul 19, 2005, 1:15:04 AM (19 years ago)
Author:
mmc
Message:

Fixed the rendering of groups, and groups within groups.
If groups are mixed in with other elements, then they are
drawn with a gray outline/heading, with the title taken
from the <group><about><label>. However, if a group
contains only other groups, then it is treated as a tabbed
notebook, and each group within is put on a separate page.

WARNING: There are many bad interactions between the
blt::tabset, the Rappture::Scroller, and the Rappture::Pager.
Pages shake violently when all are in play. The only way I
could get them to settle down was by putting the tabs above
the pages they control. Have to revisit this some time to
make it look better...

File:
1 edited

Legend:

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

    r22 r26  
    1212package require Itk
    1313
     14option add *GroupEntry.headingBackground #cccccc widgetDefault
     15option add *GroupEntry.headingForeground white widgetDefault
     16option add *GroupEntry.font -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
     17
    1418itcl::class Rappture::GroupEntry {
    1519    inherit itk::Widget
     20
     21    itk_option define -heading heading Heading 1
    1622
    1723    constructor {owner path args} { # defined below }
     
    2127    public method label {}
    2228    public method tooltip {}
     29
     30    protected method _fixheading {}
    2331
    2432    private variable _owner ""    ;# thing managing this control
     
    4250    set _owner $owner
    4351    set _path $path
     52
     53    itk_component add heading {
     54        ::label $itk_interior.heading -anchor w
     55    } {
     56        usual
     57        rename -background -headingbackground headingBackground Background
     58        rename -foreground -headingforeground headingForeground Foreground
     59    }
     60
     61    $itk_component(heading) configure \
     62        -text [$_owner xml get $_path.about.label]
     63    Rappture::Tooltip::for $itk_component(heading) \
     64        [$_owner xml get $_path.about.description]
     65
     66    itk_component add outline {
     67        frame $itk_interior.outline -borderwidth 1
     68    } {
     69        usual
     70        ignore -borderwidth
     71        rename -background -headingbackground headingBackground Background
     72    }
     73    pack $itk_component(outline) -expand yes -fill both
     74
     75    itk_component add inner {
     76        frame $itk_component(outline).inner -borderwidth 3
     77    } {
     78        usual
     79        ignore -borderwidth
     80    }
     81    pack $itk_component(inner) -expand yes -fill both
    4482
    4583    eval itk_initialize $args
     
    67105# ----------------------------------------------------------------------
    68106itcl::body Rappture::GroupEntry::label {} {
    69     return [$_owner xml get $_path.about.label]
     107    return ""  ;# manage the label inside this group
    70108}
    71109
     
    81119    return [$_owner xml get $_path.about.description]
    82120}
     121
     122# ----------------------------------------------------------------------
     123# CONFIGURATION OPTION: -heading
     124# Turns the heading bar at the top of this group on/off.
     125# ----------------------------------------------------------------------
     126itcl::configbody Rappture::GroupEntry::heading {
     127    if {![string is boolean -strict $itk_option(-heading)]} {
     128        error "bad value \"$itk_option(-heading)\": should be boolean"
     129    }
     130
     131    set str [$itk_component(heading) cget -text]
     132    if {$itk_option(-heading) && "" != $str} {
     133        eval pack forget [pack slaves $itk_component(hull)]
     134        pack $itk_component(heading) -side top -fill x
     135        pack $itk_component(outline) -expand yes -fill both
     136        $itk_component(outline) configure -borderwidth 1
     137        $itk_component(inner) configure -borderwidth 3
     138    } else {
     139        pack forget $itk_component(heading)
     140        $itk_component(outline) configure -borderwidth 0
     141        $itk_component(inner) configure -borderwidth 0
     142    }
     143}
Note: See TracChangeset for help on using the changeset viewer.