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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [library/] [LabEntry.tcl] - Blame information for rev 1767

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# LabEntry.tcl --
2
#
3
#       TixLabelEntry Widget: an entry box with a label
4
#
5
# Copyright (c) 1996, Expert Interface Technologies
6
#
7
# See the file "license.terms" for information on usage and redistribution
8
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
#
10
 
11
 
12
tixWidgetClass tixLabelEntry {
13
    -classname TixLabelEntry
14
    -superclass tixLabelWidget
15
    -method {
16
    }
17
    -flag {
18
        -disabledforeground -state
19
    }
20
    -forcecall {
21
        -state
22
    }
23
    -static {
24
    }
25
    -configspec {
26
        {-disabledforeground disabledForeground DisabledForeground #303030}
27
        {-state state State normal}
28
    }
29
    -default {
30
        {.borderWidth                   0}
31
        {*entry.relief                  sunken}
32
        {*entry.width                   7}
33
        {*label.anchor                  e}
34
        {*label.borderWidth             0}
35
        {*Label.font                   -Adobe-Helvetica-Bold-R-Normal--*-120-*}
36
        {*Entry.background              #c3c3c3}
37
    }
38
}
39
 
40
proc tixLabelEntry:ConstructFramedWidget {w frame} {
41
    upvar #0 $w data
42
 
43
    tixChainMethod $w ConstructFramedWidget $frame
44
 
45
    set data(w:entry)  [entry $frame.entry]
46
    pack $data(w:entry) -side left -expand yes -fill both
47
 
48
    # This value is used to configure the disable/normal fg of the ebtry
49
    #
50
    set data(entryfg) [$data(w:entry) cget -fg]
51
    set data(labelfg) [$data(w:label) cget -fg]
52
}
53
 
54
proc tixLabelEntryBind {} {
55
  tixBind TixLabelEntry <FocusIn>  {
56
    if {![tixStrEq [focus -displayof [set %W(w:entry)]] [set %W(w:entry)]]} {
57
        focus [%W subwidget entry]
58
        [set %W(w:entry)] selection from 0
59
        [set %W(w:entry)] selection to end
60
        [set %W(w:entry)] icursor end
61
    }
62
  }
63
}
64
 
65
 
66
#----------------------------------------------------------------------
67
#                           CONFIG OPTIONS
68
#----------------------------------------------------------------------
69
proc tixLabelEntry:config-state {w value} {
70
    upvar #0 $w data
71
 
72
    if {$value == "normal"} {
73
        catch {
74
            $data(w:label) config -fg $data(labelfg)
75
        }
76
        $data(w:entry) config -state $value -fg $data(entryfg)
77
    } else {
78
        catch {
79
            $data(w:label) config -fg $data(-disabledforeground)
80
        }
81
        $data(w:entry) config -state $value -fg $data(-disabledforeground)
82
    }
83
}

powered by: WebSVN 2.1.0

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