Unnamed Fossil Project

Check-in [933694c7ea]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:initial version
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:933694c7eaf03e69a55f4fa11343019ac6fc992e
User & Date: arnulf 2013-09-14 20:49:36
Context
2013-09-14
20:51
initial version check-in: 6ce1f45125 user: arnulf tags: trunk
20:49
initial version check-in: 933694c7ea user: arnulf tags: trunk
20:38
initial version check-in: 6d5e4aeec4 user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added library/ntkTreeareaElement.tcl.

















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#---------------------------------------------------------------------------
# ntkTreerowElement.tcl --
#
# This file contains a ntkWidget TreerowElement commands implementation
#
# this code is derived from the tile/ttk implementation written by
# Joe English
#
# Copyright (c) 2007-2013 by Arnulf P. Wiedemann
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: ntkTreerowElement.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk::classes {

# Used in scrollbars and scales in place of "border".

::itcl::extendedclass TreerowElement {
    inherit baseElement utils

    # Please excuse the gross misspelling "LITE" for "LIGHT",
    # but it makes things line up nicer.
    
    private common shadowColors
    # top-left outer, top-left inner, bottom-right inner, bottom-right outer
    set shadowColors(flat)   [list FLAT FLAT FLAT FLAT]
    set shadowColors(groove) [list DARK LITE DARK LITE]
    set shadowColors(raised) [list LITE FLAT DARK BRDR]
    set shadowColors(ridge)  [list LITE DARK LITE DARK]
    set shadowColors(solid)  [list BRDR BRDR BRDR BRDR]
    set shadowColors(sunken) [list BRDR DARK FLAT LITE]

    private common thinShadowColors
    # top-left, bottom-right
    set thinShadowColors(flat)   [list FLAT FLAT]
    set thinShadowColors(groove) [list DARK LITE]
    set thinShadowColors(raised) [list LITE DARK]
    set thinShadowColors(ridge)  [list LITE DARK]
    set thinShadowColors(solid)  [list BRDR BRDR]
    set thinShadowColors(sunken) [list DARK LITE]

    protected option [list -borderwidth borderwidth Borderwidth] \
            -default 2
    protected option [list -treerowcolor treerowcolor TreerowColor] \
            -default #a9a9a9
    protected option [list -treerowrelief treerowRelief TreerowRelief] \
            -default sunken
    protected option [list -depth depth Depth] \
            -default 0

    constructor {args} {}

    public method InitializeOptionValues {styleName tkwin state}
    public method ElementSize {widthVar heightVar treerowVar}
    public method ElementDraw {box state}
 
}

#================================ constructor ============================
#     
#=========================================================================

::itcl::body TreerowElement::constructor {args} {
#puts stderr "++++ TreerowElement::constructor!$args!"
}

#================================ InitializeOptionValues ============================
#     
#=========================================================================

::itcl::body TreerowElement::InitializeOptionValues {styleName tkwin state} {
#puts stderr "++++ InitializeOptionValues!sN!$styleName!t!$tkwin!s!$state!"
    InitializeOptionValuesBase $styleName $tkwin $state
    return
}

#================================ ElementSize ============================
#     
#=========================================================================

::itcl::body TreerowElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding

    set borderWidth [cget -borderwidth]
    set padding [list $borderWidth $borderWidth $borderWidth $borderWidth]
#puts stderr "TreerowElement::ElementSize!bw!$borderWidth!w!$width!h!$height!p!$padding!"
}

#================================ ElementDraw ============================
#     
#=========================================================================

::itcl::body TreerowElement::ElementDraw {box state} {
#puts stderr "TreerowElement ElementDraw $box $state"
    set depth [cget -depth]
    set borderWidth [cget -borderwidth]
    set relief [cget -treerowrelief]
    set backgroundValue [cget -treerowcolor]
    set backgroundColor [ColorValue2RGBA $backgroundValue]
    lassign [GetElementPositions $box] pos1 pos2 pos3 pos4
    set shadows [::ntk::classes::border::GetShadows $backgroundColor]
    lassign $shadows darkColor lightColor
    lassign [GetElementPositions $box] pos1 pos2 pos3 pos4
#puts stderr "BACKGROUND2!$pos1!$pos2!$pos3!$pos4!"
    ::gles2::builtin::fillrectangle [list $pos1 $backgroundColor] [list $pos2 $backgroundColor] [list $pos3 $backgroundColor] [list $pos4 $backgroundColor]
    if {$borderWidth > 0 && $relief ne "flat"} {
	lassign $box x y width height
	set z 0
	set mybox [list $x $y $z $width $height $depth]
	::ntk::classes::border::DrawRectangleBorder $mybox $borderWidth $relief $shadows
        ::gles2::swapbuffers
    }
}

} ; # end namepsace ::ntk::classes

Added library/ntkTreeitemIndicatorElement.tcl.











































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#---------------------------------------------------------------------------
# ntkTreeitemIndicatorElement.tcl --
#
# This file contains a ntkWidget TreeitemIndicatorElement commands implementation
#
# this code is derived from the tile/ttk implementation written by
# Joe English
#
# Copyright (c) 2007-2013 by Arnulf P. Wiedemann
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: ntkTreeitemIndicatorElement.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk::classes {

::itcl::extendedclass TreeitemIndicatorElement {
    inherit baseElement utils

    private variable defaultWidth 13
    private variable defaultHeight 13

    protected option [list -background Background Background] \
            -default #d9d9d9
    protected option [list -indicatorrelief indicatorRelief TreeitemIndicatorRelief] \
            -default raised
    protected option [list -indicatorwidth indicatorDiameter TreeitemIndicatorDiameter] \
            -default "4.0m"
    protected option [list -indicatorheight indicatorDiameter TreeitemIndicatorDiameter] \
            -default "1.7m"
    protected option [list -indicatormargin indicatorMargin TreeitemIndicatorMargin] \
            -default [list 5 0]
    protected option [list -borderwidth borderWidth BorderWidth] \
            -default 2

    public method InitializeOptionValues {styleName tkwin state}
    public method indicatorElementConfigure {option value}
    public method ElementSize {widthVar heightVar paddingVar}
    public method ElementDraw {box state}
}


#================================ InitializeOptionValues ============================
#     
#=========================================================================

::itcl::body TreeitemIndicatorElement::InitializeOptionValues {styleName tkwin state} {
    InitializeOptionValuesBase $styleName $tkwin $state
}

#================================ indicatorElementConfigure ===================
#     
#=========================================================================

::itcl::body TreeitemIndicatorElement::indicatorElementConfigure {option value} {
}

#================================ ElementSize ===================
#     
#=========================================================================

::itcl::body TreeitemIndicatorElement::ElementSize {widthVar heightVar paddingVar} {
    upvar $widthVar width
    upvar $heightVar height
    upvar $paddingVar padding

    set padding [cget -indicatormargin]
    ::ntk::classes::layout::InitPadding $padding padding
    lassign $padding l t r b
    set w [cget -indicatorwidth]
    set h [cget -indicatorheight]
    set w [::ntk::classes::utils::Value2Pixel $w]
    set h [::ntk::classes::utils::Value2Pixel $h]
    if {$w == 0} {
        set w 1
    }
    if {$h == 0} {
        set h 1
    }
    set width [expr {$w + $l + $r}]
    set height [expr {$h + $t + $b}]
    set padding [list $l $t $r $b]
}

#================================ ElementDraw ===================
#     
#=========================================================================

::itcl::body TreeitemIndicatorElement::ElementDraw {box state} {
#puts stderr "INDICATOR MENU elementDraw!$box!"
    set background [cget -background]
    set indicatorcolor $background
    set borderWidth [cget -borderwidth]
    set relief [cget -indicatorrelief]
    set padding [cget -indicatormargin]
    ::ntk::classes::layout::InitPadding $padding padding
    set b [::ntk::classes::layout::PadBox $box $padding]
    lassign $b x y width height
#puts stderr "B!$b!r!$relief!"
    # TEMPORARY!!!
    set color [ColorValue2RGBA $indicatorcolor]
    lassign [GetElementPositions $b] pos1 pos2 pos3 pos4
#puts stderr "POS border!$pos1!$pos2!$pos3!$pos4!"
    ::gles2::builtin::fillrectangle [list $pos1 $color] [list $pos2 $color] [list $pos3 $color] [list $pos4 $color]
    if {$relief ne "flat"} {
        set shadows [::ntk::classes::border::GetShadows $color]
        lassign $shadows darkColor lightColor
	set depth 0
	set z 0
	set b [list $x $y $z $width $height $depth]
        ::ntk::classes::border::DrawRectangleBorder $b $borderWidth $relief $shadows
    }
}

} ; # end namespace ::ntk::classes

Added library/ntkTreerowElement.tcl.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#---------------------------------------------------------------------------
# ntkTreeareaElement.tcl --
#
# This file contains a ntkWidget TreeareaElement commands implementation
#
# this code is derived from the tile/ttk implementation written by
# Joe English
#
# Copyright (c) 2007-2013 by Arnulf P. Wiedemann
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: ntkTreeareaElement.tcl
#--------------------------------------------------------------------------

namespace eval ::ntk::classes {

# Used in scrollbars and scales in place of "border".

::itcl::extendedclass TreeareaElement {
    inherit baseElement utils


    constructor {args} {}

    public method InitializeOptionValues {styleName tkwin state}
    public method ElementSize {widthVar heightVar treeareaVar}
    public method ElementDraw {box state}
 
}

#================================ constructor ============================
#     
#=========================================================================

::itcl::body TreeareaElement::constructor {args} {
#puts stderr "++++ TreeareaElement::constructor!$args!"
}

#================================ InitializeOptionValues ============================
#     
#=========================================================================

::itcl::body TreeareaElement::InitializeOptionValues {styleName tkwin state} {
#puts stderr "++++ InitializeOptionValues!sN!$styleName!t!$tkwin!s!$state!"
}

#================================ ElementSize ============================
#     
#=========================================================================

::itcl::body TreeareaElement::ElementSize {widthVar heightVar paddingVar} {
}

#================================ ElementDraw ============================
#     
#=========================================================================

::itcl::body TreeareaElement::ElementDraw {box state} {
}

} ; # end namepsace ::ntk::classes