VariablePanel.st
author Claus Gittinger <cg@exept.de>
Tue, 28 Oct 1997 20:25:29 +0100
changeset 1362 f2a9bc6ad68d
parent 1350 a25b2a5f3c7c
child 1381 d69604d4bbb8
permissions -rw-r--r--
new resource naming
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
SimpleView subclass:#VariablePanel
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
    14
	instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
		handlePosition handleColor handleStyle handleLevel noColor
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
    16
		trackLine redrawLocked orientation handleLabels knobHeight'
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
    17
	classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
		DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
		DefaultHandleLevel DefaultVCursor DefaultHCursor'
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
    20
	poolDictionaries:''
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
    21
	category:'Views-Layout'
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
    24
!VariablePanel class methodsFor:'documentation'!
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 COPYRIGHT (c) 1991 by Claus Gittinger
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	      All Rights Reserved
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    a View to separate its subviews vertically by a movable bar;
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    the size-ratios of the subviews can be changed by moving this bar.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    In order to correctly setup this kind of view, the subviews must
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    be created with a relative origin & relative corner.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    The panel does not verify the relative subview bounds; 
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    therefore, it is your responsibility to set those relative sizes to fit
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    according the orientation (see bad example below).
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    The bar-handle is either an exposed knob (style == #motif)
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    or the form defined in Scroller (style ~~ #motif)
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    or nothing.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    Typically creation is done as:
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    57
        p := VariablePanel in:superView.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    58
        p orientation:#vertical.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    60
        v1 := <someViewClass> origin:0.0 @ 0.0
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    61
                              corner:1.0 @ 0.5
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    62
                                  in:p.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    63
        v2 := <someViewClass> origin:0.0 @ 0.5 
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    64
                              corner:1.0 @ 0.8 
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    65
                                  in:p.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    66
        v3 := <someViewClass> origin:0.0 @ 0.8 
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    67
                              corner:1.0 @ 1.0
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    68
                                  in:p.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    69
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    70
    The two subclasses VariableHorizontalPanel and VariableVerticalPanel
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    71
    preset the orientation. They are a kept for backward compatibility
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    72
    (in previous versions, there used to be no common VariablePanel (super-) class).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    Notice: if it is required to insert a fixed-size view in the panel,
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    use an extra view & insets, and place the subview into that extra view.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    see examples.
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    78
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
    79
    [instance Variables:]
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    80
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    81
        barHeight               <Integer>       the height of the bar (for verticalPanels)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    82
        barWidth                <Integer>       the width of the bar  (for horizontalPanels)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    83
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    84
        separatingLine          <Boolean>       show a separating line (as in motif style)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    85
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    86
        shadowForm              <Image/Form>    form (shadow part) drawn as handle - if nonNil
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    87
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    88
        lightForm               <Image/Form>    form (light part) drawn as handle - if nonNil
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    89
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    90
        showHandle              <Boolean>       if false, no handle is drawn
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    91
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    92
        handlePosition          <Symbol>        where is the handle - one of #left, #center, #right
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    93
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    94
        handleColor             <Color>         inside color of handle - defaults to viewBackground
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    95
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    96
        handleStyle             <Symbol>        type of handle; one of #next, #motif or nil
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    97
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    98
        handleLevel             <Integer>       3D level of handle (only valid if no form is given)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    99
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   100
        trackLine               <Boolean>       if true, an inverted line is drawn for tracking;
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   101
                                                otherwise, the whole bar is inverted.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   102
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   103
        redrawLocked                            internal - locks redraws while tracking
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   104
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   105
        orientation             <Symbol>        one of #horizontal / #vertical
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   106
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   107
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   108
    [styleSheet values:]
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   109
        variablePanelShowHandle         true/false - should a handle be shown (default:true)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   110
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   111
        variablePanelHandleStyle        #next / #motif / #iris / #full nil (special handles)
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   112
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   113
        variablePanelHandlePosition     #left / #center / #right (default:#right)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   114
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   115
        variablePanelHandleLevel        3D level of heandle (default:2)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   116
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   117
        variablePanelTrackingLine       when moved, track an inverted line (as in motif)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   118
                                        as opposed to tracking the whole bar (default:false)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   119
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   120
        variablePanelSeparatingLine     draw a separating line in the bar as in motif (default:false)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   121
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   122
        variablePanelHandleColor        color of the handle. (default:Black)
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   123
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   124
        variablePanelHandleEnteredColor color of the handle when the pointer is in the bar (default:nil)
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   125
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   126
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   127
        PanelView
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   128
        
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   129
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   130
        Claus Gittinger
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
examples
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
"
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   136
   example (notice that the subviews MUST have relative bounds):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   137
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   138
        |top p v1 v2 v3|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   140
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   141
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   143
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   144
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   145
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   146
                 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   147
        p orientation:#vertical.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   149
        v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   150
        v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   151
        v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   153
        v1 viewBackground:(Color red).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   154
        v2 viewBackground:(Color green).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   155
        v3 viewBackground:(Color yellow).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   157
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   158
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   162
   change the handles level:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   163
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   164
        |top p v1 v2 v3|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   166
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   167
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   169
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   170
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   171
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   172
                 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   173
        p orientation:#vertical.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   174
        p handleLevel:-1.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   176
        v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   177
        v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   178
        v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   180
        v1 viewBackground:(Color red).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   181
        v2 viewBackground:(Color green).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   182
        v3 viewBackground:(Color yellow).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   184
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   185
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   189
   change the handles style to nil makes it invisible:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   190
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   191
        |top p v1 v2 v3|
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   192
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   193
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   194
        top extent:300@300.
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   195
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   196
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   197
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   198
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   199
                 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   200
        p orientation:#vertical.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   201
        p handleStyle:nil.
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   202
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   203
        v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   204
        v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   205
        v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   206
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   207
        v1 viewBackground:(Color red).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   208
        v2 viewBackground:(Color green).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   209
        v3 viewBackground:(Color yellow).
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   210
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   211
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   212
                                                                        [exEnd]
397
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   213
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   214
7038c3c38ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   215
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   216
   define your own handle (-bitmap):
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   217
                                                                        [exBegin]
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   218
        |top p v1 v2 v3|
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   219
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   220
        top := StandardSystemView new.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   221
        top extent:300@300.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   222
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   223
        p := VariablePanel 
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   224
                 origin:0.0 @ 0.0
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   225
                 corner:1.0 @ 1.0
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   226
                 in:top.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   227
        p orientation:#vertical.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   228
        p handleImage:(Image fromFile:'bitmaps/ScrollLt.8.xbm').
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   229
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   230
        v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   231
        v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   232
        v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   233
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   234
        v1 viewBackground:(Color red).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   235
        v2 viewBackground:(Color green).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   236
        v3 viewBackground:(Color yellow).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   237
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   238
        top open
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   239
                                                                        [exEnd]
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   240
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   241
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   242
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   243
   another handle-bitmap:
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   244
                                                                        [exBegin]
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   245
        |top p v1 v2 v3|
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   246
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   247
        top := StandardSystemView new.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   248
        top extent:300@300.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   249
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   250
        p := VariablePanel 
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   251
                 origin:0.0 @ 0.0
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   252
                 corner:1.0 @ 1.0
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   253
                 in:top.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   254
        p orientation:#vertical.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   255
        p handleImage:(Form width:9
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   256
                            height:11
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   257
                            fromArray:#(
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   258
                                        2r00000000 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   259
                                        2r00001000 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   260
                                        2r00011100 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   261
                                        2r00111110 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   262
                                        2r01111111 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   263
                                        2r00000000 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   264
                                        2r01111111 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   265
                                        2r00111110 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   266
                                        2r00011100 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   267
                                        2r00001000 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   268
                                        2r00000000 2r00000000
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   269
                                       )
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   270
                      ).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   271
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   272
        v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   273
        v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   274
        v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   275
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   276
        v1 viewBackground:(Color red).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   277
        v2 viewBackground:(Color green).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   278
        v3 viewBackground:(Color yellow).
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   279
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   280
        top open
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   281
                                                                        [exEnd]
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   282
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   283
    placing scrolled and unscrolled views into a variablePanel:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   284
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   285
        |top p v1 v2 v3|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   287
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   288
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   290
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   291
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   292
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   293
                 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   294
        p orientation:#vertical.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   296
        v1 := ScrollableView for:SelectionInListView in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   297
        v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   298
        v1 list:(FileDirectory directoryNamed:'/etc') contents.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   299
        v1 action:[:selNr |
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   300
                |fullName stream text|
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   301
                fullName := '/etc/' , v1 selectionValue.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   302
                stream := fullName asFilename readStream.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   303
                stream notNil ifTrue:[
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   304
                    text := stream contents.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   305
                    v2 contents:text.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   306
                    v3 contents:text
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   307
                ]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   308
        ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   310
        v2 := TextView origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   312
        v3 := ScrollableView for:TextView in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   313
        v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   314
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   315
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   318
    dynamically adding/removing views:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   319
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   320
        |top p v1 v2 b|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   322
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   323
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   325
        b := Toggle label:'show' in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   326
        b showLamp:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   327
        b origin:0.0 @ 0.0 corner:(1.0 @ 40).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   328
        b action:[:state |
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   329
                state ifTrue:[
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   330
                    b label:'hide'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   331
                    v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   332
                    v2 := ScrollableView for:EditTextView.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   333
                    v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   334
                    v2 contents:'another text'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   335
                    p addSubView:v2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   336
                    v2 realize.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   337
                ] ifFalse:[
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   338
                    b label:'show'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   339
                    v2 destroy.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   340
                    v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   341
                ]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   342
            ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   344
        p := VariablePanel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   345
                origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   346
                corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   347
                in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   348
        p orientation:#vertical.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   349
        p topInset:50.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   351
        v1 := ScrollableView for:EditTextView in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   352
        v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   353
        v1 contents:'some text'.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   355
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   356
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   359
    dynamically flipping orientation:
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    Notice: you have to change the relative bounds of the subviews first.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   361
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   362
        |top p v1 v2 b|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   364
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   365
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   367
        b := Toggle label:'flip' in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   368
        b showLamp:false.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   369
        b origin:0.0 @ 0.0 corner:(1.0 @ 40).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   370
        b action:[:state |
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   371
                state ifTrue:[
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   372
                    v1 origin:0.0 @ 0.0 corner:0.5 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   373
                    v2 origin:0.5 @ 0.0 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   374
                    p orientation:#horizontal.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   375
                ] ifFalse:[
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   376
                    v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   377
                    v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   378
                    p orientation:#vertical.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   379
                ].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   380
            ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   382
        p := VariablePanel
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   383
                origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   384
                corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   385
                in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   386
        p orientation:#vertical.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   387
        p topInset:50.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   389
        v1 := ScrollableView for:EditTextView in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   390
        v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   391
        v1 contents:'some text'.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   393
        v2 := ScrollableView for:EditTextView in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   394
        v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   395
        v2 contents:'another text'.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   397
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   398
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   401
   combining fix-size with variable size:
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
   (need 3 extra frame-views to place the extra labels into)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   403
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   404
        |top p v1 l1 v2 l2 v3 l3 f1 f2 f3|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   406
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   407
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   409
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   410
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   411
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   412
                 in:top.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   414
        p orientation:#vertical.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   415
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   416
        f1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   417
        f2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   418
        f3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   420
        v1 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f1.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   421
        v2 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   422
        v3 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f3.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   424
        l1 := Label label:'sub1' in:f1.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   425
        l2 := Label label:'sub2' in:f2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   426
        l3 := Label label:'sub3' in:f3.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   428
        l1 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   429
           bottomInset:(l1 preferredExtent y negated).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   430
        l2 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   431
           bottomInset:(l2 preferredExtent y negated).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   432
        l3 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   433
           bottomInset:(l3 preferredExtent y negated).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   435
        v1 topInset:(l1 preferredExtent y); level:-1.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   436
        v2 topInset:(l2 preferredExtent y); level:-1.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   437
        v3 topInset:(l3 preferredExtent y); level:-1.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   439
        v1 viewBackground:(Color red).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   440
        v2 viewBackground:(Color green).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   441
        v3 viewBackground:(Color yellow).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   443
        top open
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   444
                                                                        [exEnd]
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   445
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   446
   VerticalPansels allow a label to be associated with the
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   447
   handles; this looks much like the above, but is slightly
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   448
   more compact. Notice, no label can be placed above the first 
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   449
   view - it has no handle.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   450
                                                                        [exBegin]
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   451
        |top p v1 v2 v3|
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   452
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   453
        top := StandardSystemView new.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   454
        top extent:300@300.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   455
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   456
        p := VariablePanel 
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   457
                 origin:0.0 @ 0.0
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   458
                 corner:1.0 @ 1.0
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   459
                 in:top.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   460
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   461
        p orientation:#vertical.
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   462
        p handleLabels:#('ignored' 'sub2' 'sub3').
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   463
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   464
        v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   465
        v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   466
        v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   467
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   468
        v1 viewBackground:(Color red).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   469
        v2 viewBackground:(Color green).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   470
        v3 viewBackground:(Color yellow).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   471
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   472
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   473
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   475
   handle labels can be more than strings ....
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   476
   (however, they should have about the same height, since
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   477
    the largest defines heights of all bars;
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   478
    retry the example below with a larger bitmap image ...)
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   479
                                                                        [exBegin]
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   480
        |top e p v1 v2 v3|
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   481
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   482
        top := StandardSystemView new.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   483
        top extent:300@300.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   484
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   485
        p := VariablePanel 
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   486
                 origin:0.0 @ 0.0
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   487
                 corner:1.0 @ 1.0
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   488
                 in:top.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   489
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   490
        p orientation:#vertical.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   491
        e := Array with:#bold
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   492
                   with:#color->Color red.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   493
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   494
        p handleLabels:(Array with:nil
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   495
                              with:('bold and red' asText emphasizeAllWith:e)
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   496
                              with:(Image fromFile:'ScrollRt.xbm')).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   497
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   498
        v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   499
        v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   500
        v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p.
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   501
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   502
        v1 viewBackground:(Color red).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   503
        v2 viewBackground:(Color green).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   504
        v3 viewBackground:(Color yellow).
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   505
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   506
        top open
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   507
                                                                        [exEnd]
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   508
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   509
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
   BAD EXAMPLE (wrong relative sizes - repaired on handle move):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   512
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   513
        |top p v1 v2 v3|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   515
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   516
        top extent:300@300.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   518
        p := VariablePanel 
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   519
                 origin:0.0 @ 0.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   520
                 corner:1.0 @ 1.0
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   521
                 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   522
        p orientation:#vertical.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   524
        v1 := View origin:0.0 @ 0.0   corner:1.0 @ (1/4) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   525
        v2 := View origin:0.0 @ (1/2) corner:1.0 @ (3/4) in:p.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   526
        v3 := View origin:0.0 @ (3/4) corner:1.0 @ 1.0   in:p.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   528
        v1 viewBackground:(Color red).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   529
        v2 viewBackground:(Color green).
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   530
        v3 viewBackground:(Color yellow).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   532
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   533
                                                                        [exEnd]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   537
!VariablePanel class methodsFor:'defaults'!
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
1158
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   539
cursorForOrientation:orientation
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   540
    "return an appropriate cursor"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   541
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   542
    |cursor|
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   543
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   544
    orientation == #vertical ifTrue:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   545
        DefaultVCursor notNil ifTrue:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   546
            cursor := DefaultVCursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   547
        ] ifFalse:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   548
            cursor := Cursor 
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   549
                        sourceForm:(Image fromFile:'bitmaps/VVPanel.xbm')
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   550
                        maskForm:(Image fromFile:'bitmaps/VVPanel_m.xbm')
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   551
                        hotX:8
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   552
                        hotY:8.
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   553
            "
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   554
             if bitmaps are not available, use a standard cursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   555
            "
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   556
            cursor isNil ifTrue:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   557
                "which one looks better ?"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   558
                cursor := Cursor upDownArrow
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   559
                "cursor := Cursor upLimitArrow"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   560
            ].
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   561
            DefaultVCursor := cursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   562
        ]
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   563
    ] ifFalse:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   564
        DefaultHCursor notNil ifTrue:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   565
            cursor := DefaultHCursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   566
        ] ifFalse:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   567
            cursor := Cursor 
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   568
                        sourceForm:(Image fromFile:'bitmaps/VHPanel.xbm')
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   569
                        maskForm:(Image fromFile:'bitmaps/VHPanel_m.xbm')
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   570
                        hotX:8
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   571
                        hotY:8.
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   572
            "
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   573
             if bitmaps are not available, use a standard cursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   574
            "
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   575
            cursor isNil ifTrue:[
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   576
                "which one looks better ?"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   577
                cursor := Cursor leftRightArrow
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   578
                "cursor := Cursor leftLimitArrow"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   579
            ].
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   580
            DefaultHCursor := cursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   581
        ]
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   582
    ].
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   583
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   584
    ^ cursor
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   585
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   586
    "Created: 28.3.1997 / 13:40:01 / cg"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   587
    "Modified: 28.3.1997 / 14:45:29 / cg"
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   588
!
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   589
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
lightFormOn:aDisplay
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
    "use same handle as Scroller"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
    ^ Scroller handleLightFormOn:aDisplay
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
shadowFormOn:aDisplay
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
    "use same handle as Scroller"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
    ^ Scroller handleShadowFormOn:aDisplay
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
   603
    "extract values from the styleSheet and cache them in class variables"
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
   604
1350
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   605
    <resource: #style (#'variablePanel.showHandle' #'variablePanel.handleStyle'
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   606
                       #'variablePanel.handlePosition' #'variablePanel.handleLevel'
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   607
                       #'variablePanel.trackingLine' #'variablePanel.trackingStyle'
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   608
                       #'variablePanel.separatingLine' #'variablePanel.handleColor')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
   609
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   610
    |lineModeBoolean|
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   611
1350
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   612
    DefaultShowHandle := StyleSheet at:'variablePanel.showHandle' default:true.
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   613
    DefaultHandleStyle := StyleSheet at:'variablePanel.handleStyle'.
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   614
    DefaultHandlePosition := StyleSheet at:'variablePanel.handlePosition' default:#right.
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   615
    DefaultHandleLevel := StyleSheet at:'variablePanel.handleLevel' default:2.
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   616
    DefaultTrackingLine := StyleSheet at:'variablePanel.trackingStyle' default:nil.
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   617
    DefaultTrackingLine isNil ifTrue:[
1350
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   618
        lineModeBoolean := StyleSheet at:'variablePanel.trackingLine' default:false.
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   619
        lineModeBoolean ifTrue:[
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   620
            DefaultTrackingLine := #solidLine
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   621
        ] ifFalse:[
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   622
            DefaultTrackingLine := #solidRectangle
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   623
        ]
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   624
    ].
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   625
1350
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   626
    DefaultSeparatingLine := StyleSheet at:'variablePanel.separatingLine' default:false.
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   627
    DefaultHandleColor := StyleSheet colorAt:'variablePanel.handleColor' default:Black.
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
   628
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   629
    "
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   630
     VariablePanel updateStyleCache
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   631
    "
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
   632
1350
a25b2a5f3c7c new viewStyle resource names
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   633
    "Modified: 14.10.1997 / 01:26:42 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
!VariablePanel methodsFor:'accessing'!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
addSubView:aView
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   639
    "a view is added; adjust other subviews sizes"
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   640
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
    super addSubView:aView.
1043
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   642
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   643
"/    (aView relativeOrigin isNil 
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   644
"/    or:[aView relativeExtent isNil and:[aView relativeCorner isNil]]) ifTrue:[
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   645
"/        aView geometryLayout:nil.
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   646
"/        aView origin:0.0@0.0.
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   647
"/        aView extent:1.0@0.5.
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   648
"/        self setupSubviews
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   649
"/    ].
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   650
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
    realized ifTrue:[
1043
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   652
        self resizeSubviews.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
    ]
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    "Created: 17.1.1996 / 22:41:00 / cg"
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   656
    "Modified: 24.2.1996 / 19:05:05 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
orientation
485
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   660
    "return my orientation; either #horizontal or #vertical"
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   661
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
    ^ orientation
485
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   663
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   664
    "Modified: 6.3.1996 / 18:08:45 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
orientation:aSymbol
485
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   668
    "change  my orientation; aSymbol must be one of #horizontal or #vertical.
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   669
     Changing implies a resize of my subViews."
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   670
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   671
    aSymbol ~~ orientation ifTrue:[
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   672
        orientation := aSymbol.
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   673
        self initCursor.
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   674
        self anyNonRelativeSubviews ifTrue:[
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   675
            self setupSubviews
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   676
        ].
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   677
        shown ifTrue:[
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   678
            self cursor:cursor.
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   679
            self sizeChanged:nil.
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   680
            self invalidate.
485
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   681
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
    ]
485
50cbbe748ac9 commentary
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   683
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   684
    "Modified: 29.5.1996 / 16:22:35 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   687
removeSubView:aView
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   688
    "a view is removed; adjust other subviews sizes"
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   689
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   690
    super removeSubView:aView.
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   691
    shown ifTrue:[
1043
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   692
        (superView isNil or:[superView shown]) ifTrue:[
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   693
            self setupSubviews.
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   694
            self resizeSubviews.
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
   695
        ]
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   696
    ]
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   697
! !
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   698
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   699
!VariablePanel methodsFor:'accessing-look'!
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   700
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
barHeight
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
    "return the height of the separating bar"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
    ^ barHeight
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
barHeight:nPixel
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
    "set the height of the separating bar"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
    barHeight := nPixel.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
1207
2668cd0caee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   712
    "make certain bar is visible and catchable"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
    (barHeight < 4) ifTrue:[
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   714
        barHeight := 4
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   717
    "make it even, so spacing is equally spreadable among subviews"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
    barHeight odd ifTrue:[
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   719
        barHeight := barHeight + 1
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
    ]
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   721
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   722
    "Modified: 7.11.1996 / 20:07:11 / cg"
1207
2668cd0caee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   723
    "Modified: 28.4.1997 / 14:30:33 / dq"
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   724
!
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   725
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   726
handleImage:aBitmapOrImage
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   727
    "define the handles image"
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   728
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   729
    shadowForm := aBitmapOrImage.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   730
    lightForm := nil.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   731
    self computeBarHeight.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   732
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   733
    "Created: 7.11.1996 / 20:21:10 / cg"
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   734
    "Modified: 7.11.1996 / 20:27:22 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   737
handleLabels:aCollectionOfLabels
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   738
    orientation == #horizontal ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   739
        self error:'not allowed for horizontal panels'
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   740
    ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   741
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   742
    handleLabels := aCollectionOfLabels.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   743
    self computeBarHeight.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   744
    self resizeSubviews.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   745
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   746
!
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   747
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
handleLevel:aNumber
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
    "define the 3D level of the handle (only with some styles).
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
     Normally, this is defined via styleSheet files, but this entry allows
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
     individual views to be manipulated."
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
    handleLevel := aNumber
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
handlePosition
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
    "return the position of the handle"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
    ^ handlePosition
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
handlePosition:aSymbol
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
    "define the position of the handle; the argument aSymbol
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
     may be one of #left, #right or #center"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
    handlePosition := aSymbol
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   769
handleShadowImage:shadowImage lightImage:lightImage
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   770
    "define the handles image; both shadow and light parts"
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   771
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   772
    shadowForm := shadowImage.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   773
    lightForm := lightImage.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   774
    self computeBarHeight.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   775
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   776
    "Created: 7.11.1996 / 20:21:51 / cg"
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   777
    "Modified: 7.11.1996 / 20:27:26 / cg"
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   778
!
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   779
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   780
handleStyle:styleSymbol
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   781
    "define the style of the handle;
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   782
     styleSymbol may be #motif to draw a little knob or
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   783
     anything else to draw scrollBars handleForm.
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   784
     Normally, this is defined via styleSheet files, but this entry allows
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   785
     individual views to be manipulated."
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   787
    (styleSymbol ~~ handleStyle) ifTrue:[
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   788
        handleStyle := styleSymbol.
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   789
        handleStyle == #next ifTrue:[
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   790
            shadowForm := self class shadowFormOn:device.
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   791
            lightForm := self class lightFormOn:device.
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   792
        ] ifFalse:[
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   793
            shadowForm := lightForm := nil
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   794
        ].
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   795
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   796
        shadowForm notNil ifTrue:[
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   797
            (self is3D and:[handleStyle ~~ #motif]) ifTrue:[
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   798
                self barHeight:(shadowForm height + 2).
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   799
                barWidth := shadowForm width
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   800
            ]
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   801
        ].
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   802
        shown ifTrue:[
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   803
            self resizeSubviews.
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   804
            self invalidate
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   805
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
    ]
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   807
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   808
    "Created: 24.2.1996 / 19:04:07 / cg"
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   809
    "Modified: 29.5.1996 / 16:22:24 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
style:styleSymbol
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
    "define the style of the handle;
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
     styleSymbol may be #motif to draw a little knob or
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
     anything else to draw scrollBars handleForm.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
     Normally, this is defined via styleSheet files, but this entry allows
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
     individual views to be manipulated."
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   819
    self handleStyle:styleSymbol
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
395
db172e0f3d56 renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   821
    "Modified: 24.2.1996 / 19:04:19 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
!VariablePanel methodsFor:'drawing'!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   826
drawHandle:hIndex atX:hx y:hy
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
    "draw a single handle at hx/hy"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   829
    |h w x y m lbl maxKnob
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   830
     mar           "{ Class: SmallInteger }"
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   831
     barWidthInt   "{ Class: SmallInteger }"
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   832
     barHeightInt  "{ Class: SmallInteger }" |
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   834
    (handleStyle isNil 
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   835
    or:[handleStyle == #none]) ifTrue:[^ self].
396
973d4a9fa32c setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
   836
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   837
    mar := margin.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   838
    barHeightInt := barHeight.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   839
    barWidthInt := barWidth.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   840
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    shadowForm notNil ifTrue:[
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   842
        h := shadowForm height.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   843
        w := shadowForm width .
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   844
        maxKnob := h min:barHeightInt.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
    ] ifFalse:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   846
        maxKnob := knobHeight min: barHeightInt.
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   847
        maxKnob := maxKnob max:4.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   848
        w := h := maxKnob - 4.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
    self paint:viewBackground.
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   852
    self lineStyle:#solid.
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   853
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
    orientation == #vertical ifTrue:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   855
        self fillRectangleX:mar y:hy 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   856
                      width:(width - mar - mar) 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   857
                     height:barHeightInt.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   858
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   859
        (handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   860
            m := (maxKnob - h) // 2.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   861
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   862
            shadowForm isNil ifTrue:[
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   863
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   864
                y := hy + (barHeightInt // 2).   "/ center of the bar
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   866
                separatingLine ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   867
                    self paint:shadowColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   868
                    self displayLineFromX:mar y:y toX:(width - mar) y:y.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   869
                    y := y + 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   870
                    self paint:lightColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   871
                    self displayLineFromX:mar y:y toX:(width - mar) y:y.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   872
                ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   873
                self paint:viewBackground.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   874
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   875
                self fillRectangleX:(hx - barWidthInt) y:hy 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   876
                             width:(barWidthInt + barWidthInt) 
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   877
                             height:h.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   879
                handleStyle == #line ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   880
                    self paint:handleColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   881
                    self displayLineFromX:hx - barWidthInt y:y toX:hx + barWidthInt y:y
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   882
                ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   883
                    y := hy.   
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   884
                    handleStyle == #st80 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   885
                        y := y - 1
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   886
                    ].
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   887
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   888
                    handleStyle == #full ifTrue:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   889
                        self drawEdgesForX:0-handleLevel
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   890
                                         y:(y + m)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   891
                                     width:width+handleLevel+handleLevel
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   892
                                    height:h 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   893
                                     level:handleLevel.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   894
                    ] ifFalse:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   895
                        self drawEdgesForX:(hx - barWidthInt)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   896
                                         y:(y + m)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   897
                                     width:(barWidthInt + barWidthInt)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   898
                                    height:h 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   899
                                     level:handleLevel.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   901
                        handleStyle == #iris ifTrue:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   902
                            self paint:handleColor.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   903
                            self fillDeviceRectangleX:(hx - barWidthInt + 2)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   904
                                                    y:(y + m + 2)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   905
                                                width:(barWidthInt + barWidthInt - 4)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   906
                                               height:h - 4
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   907
                        ]
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   908
                    ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   909
                ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   910
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   911
                y := hy.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   912
                self drawHandleFormAtX:hx y:(y + m)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   913
            ].
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   914
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   915
            handleStyle == #st80 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   916
                y := hy - 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   917
                self paint:lightColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   918
                self displayLineFromX:mar y:y toX:(width - mar - mar - 1) y:y.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   919
                self displayLineFromX:0 y:hy toX:0 y:(hy + knobHeight - 1).
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   920
                y := hy + knobHeight - 2.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   921
                self paint:shadowColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   922
                self displayLineFromX:mar y:y toX:(width - mar) y:y.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   923
                    "uncomment the -1 if you dont like the notch at the right end"
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   924
                    "                            VVV"
1119
3f872db73136 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   925
                self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1).
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   926
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   927
        ] ifFalse:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   928
            y := hy + barHeightInt - 1.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   929
            self paint:handleColor.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   930
            separatingLine ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   931
                self displayLineFromX:0 y:hy+1 toX:width y:hy+1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   932
                self displayLineFromX:0 y:y toX:width y:y.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   933
            ].
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   934
            self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   935
        ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   937
        lbl := self handleLabelAt:hIndex.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   938
        lbl notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   939
            hIndex ~~ 1 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   940
                self paint:Color black.
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   941
                lbl isImageOrForm ifTrue:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   942
                    lbl displayOn:self x:mar y:hy
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   943
                ] ifFalse:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   944
                    lbl displayOn:self x:mar y:hy + font ascent + 1
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
   945
                ]
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   946
            ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   947
        ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   948
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
    ] ifFalse:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   950
        self fillRectangleX:hx y:mar 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   951
                      width:barHeightInt
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   952
                     height:(height - mar - mar).
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   953
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   954
        (handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   955
             m := (barHeightInt - w) // 2.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   956
             shadowForm isNil ifTrue:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   957
                x := hx + (barHeightInt // 2).
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   958
                separatingLine ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   959
                    self paint:shadowColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   960
                    self displayLineFromX:x y:mar toX:x y:(height - mar).
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   961
                    x := x + 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   962
                    self paint:lightColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   963
                    self displayLineFromX:x y:mar toX:x y:(height - mar).
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   964
                ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   965
                self paint:viewBackground.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   966
                self fillRectangleX:hx y:(hy - barWidthInt) 
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   967
                              width:w 
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   968
                             height:(barWidthInt + barWidthInt).
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   970
                handleStyle == #line ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   971
                    self paint:handleColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   972
                    self displayLineFromX:x y:hy - barWidthInt toX:x y:hy + barWidthInt.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   973
                ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   974
                    x := hx.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   975
                    handleStyle == #st80 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   976
                        x := x - 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   977
                    ].
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   978
                    handleStyle == #full ifTrue:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   979
                        self drawEdgesForX:(x + m)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   980
                                         y:0-handleLevel
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   981
                                     width:w
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   982
                                    height:height+handleLevel+handleLevel 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   983
                                     level:handleLevel.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   984
                    ] ifFalse:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   985
                        self drawEdgesForX:(x + m)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   986
                                         y:(hy - barWidthInt)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   987
                                     width:w 
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   988
                                    height:(barWidthInt + barWidthInt)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   989
                                     level:handleLevel.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   990
                        handleStyle == #iris ifTrue:[
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   991
                            self paint:handleColor.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   992
                            self fillDeviceRectangleX:(x + m + 2)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   993
                                                    y:(hy - barWidthInt + 2)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   994
                                                width:w - 4
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   995
                                               height:(barWidthInt + barWidthInt - 4)
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
   996
                        ].
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   997
                    ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   998
                ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
   999
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1000
                x := hx.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1001
                self drawHandleFormAtX:(x + m) y:hy
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1002
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1003
            handleStyle == #st80 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1004
                x := hx - 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1005
                self paint:lightColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1006
                self displayLineFromX:x y:mar toX:x y:(height - mar).
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1007
                self displayLineFromX:hx y:0 toX:(hx + barHeightInt - 1) y:0.
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1008
                x := hx + barHeightInt - 2.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1009
                self paint:shadowColor.
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1010
                self displayLineFromX:x y:mar toX:x y:(height - mar).
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1011
                    "uncomment the -1 if you dont like the notch at the bottom end"
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1012
                    "                   VVV"
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1013
                self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeightInt - 1) y:height-1.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1014
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1015
        ] ifFalse:[
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1016
            x := hx + barHeightInt - 1.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1017
            self paint:handleColor.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1018
            separatingLine ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1019
                self displayLineFromX:hx+1 y:0 toX:hx+1 y:height.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1020
                self displayLineFromX:x y:0 toX:x y:height.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1021
            ].
1096
e17800280f82 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1043
diff changeset
  1022
            self fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1023
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1026
    "Modified: 19.3.1997 / 11:16:53 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
drawHandleFormAtX:hx y:hy
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1030
    "draw a handles bitmap at hx/hy"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1031
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1032
    shadowForm notNil ifTrue:[
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1033
        self paint:shadowColor.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1034
        self displayForm:shadowForm x:hx y:hy.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1035
    ].
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1036
    lightForm notNil ifTrue:[
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1037
        self paint:lightColor.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1038
        self displayForm:lightForm x:hx y:hy.
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1039
    ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
    self paint:viewBackground
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1041
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1042
    "Modified: 7.11.1996 / 20:25:33 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1043
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
invertHandleBarAtX:hx y:hy
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1046
    trackLine == #dashedLine ifTrue:[
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1047
        self lineStyle:#dashed.
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1048
    ].
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1049
1220
9bc6add9aa54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1050
    self clippedByChildren:false.
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1051
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
    self xoring:[
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1053
        |yL xL halfHeight|
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1054
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1055
        halfHeight := barHeight // 2.
1207
2668cd0caee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
  1056
        yL := hy + halfHeight - 1.
2668cd0caee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
  1057
        xL := hx + halfHeight - 1.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1059
        orientation == #vertical ifTrue:[
1130
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1060
            (trackLine == #solidLine 
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1061
            or:[trackLine == #dashedLine]) ifTrue:[
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1062
                self displayLineFromX:0 y:yL toX:width y:yL.
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1063
            ] ifFalse:[
1130
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1064
                self fillRectangleX:0 y:hy width:width height:barHeight
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1065
            ]
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1066
        ] ifFalse:[
1130
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1067
            (trackLine == #solidLine 
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1068
            or:[trackLine == #dashedLine]) ifTrue:[
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1069
                self displayLineFromX:xL y:0 toX:xL y:height.
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1070
            ] ifFalse:[
1130
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1071
                self fillRectangleX:hx y:0 width:barHeight height:height
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1072
            ]
1130
3c9a9961d225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1073
        ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
    ].
1220
9bc6add9aa54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  1075
    self clippedByChildren:true.
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1076
    trackLine == #dashedLine ifTrue:[
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1077
        self lineStyle:#solid.
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1078
    ].
1129
17a77892f180 added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents: 1119
diff changeset
  1079
1131
98922cb07e5b allow handleStyle of #none
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1080
    "Modified: 19.3.1997 / 11:18:54 / cg"
1207
2668cd0caee7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
  1081
    "Modified: 28.4.1997 / 14:56:26 / dq"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
lockRedraw
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1085
    redrawLocked := true
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1088
redraw
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
    "redraw all of the handles"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
    redrawLocked ~~ true ifTrue:[
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1092
        self redrawHandlesFrom:1 to:(self subViews size)
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
    ]
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1094
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1095
    "Modified: 28.1.1997 / 17:54:15 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1096
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1097
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1098
redrawHandlesFrom:start to:stop
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1099
    "redraw some handles"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1100
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1101
    (self subViews size > 0) ifTrue:[
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1102
        showHandle ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1103
            self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex |
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1104
                self drawHandle:hIndex atX:(hPoint x) y:(hPoint y)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1105
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1106
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1107
    ]
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1108
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1109
    "Modified: 28.1.1997 / 17:54:33 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1110
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1112
unlockRedraw
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1113
    redrawLocked := false
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1114
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
1159
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1116
!VariablePanel methodsFor:'enumerating subviews'!
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1117
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1118
changeSequenceOrderFor:aSubView to:anIndex
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1119
    "change a subview's position into subviews collection
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1120
    "
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1121
    |success|
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1122
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1123
    success := super changeSequenceOrderFor:aSubView to:anIndex.
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1124
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1125
    success ifTrue:[
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1126
        self setupSubviews.
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1127
        self resizeSubviews.
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1128
    ].
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1129
    ^ success
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1130
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1131
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1132
! !
856ac1c6046c changeSequenceOrderFor:to:
ca
parents: 1158
diff changeset
  1133
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
!VariablePanel methodsFor:'event handling'!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
sizeChanged:how
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
    "my size has changed; resize my subviews"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
    shown ifTrue:[
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1140
        (how == #smaller) ifTrue:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1141
            self resizeSubviews
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1142
        ] ifFalse:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1143
            "/
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1144
            "/ do it in reverse order, to avoid some redraws
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1145
            "/
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1146
            self resizeSubviewsFrom:(self subViews size) to:1
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1147
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
    self changed:#sizeOfView with:how.
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1150
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1151
    "Modified: 28.1.1997 / 17:56:30 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1152
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1153
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1154
!VariablePanel methodsFor:'initializing'!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1155
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1156
computeBarHeight
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 924
diff changeset
  1157
    "compute the height if the separating bar from either the
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 924
diff changeset
  1158
     form or an explicit height given in the styleSheet"
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 924
diff changeset
  1159
1362
f2a9bc6ad68d new resource naming
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
  1160
    <resource: #style (#'variablePanel.barHeight')>
924
81f3ca4512bd allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
  1161
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1162
    |bH h|
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1163
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1164
    shadowForm notNil ifTrue:[
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1165
        bH := shadowForm height + 2.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1166
    ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1167
        self is3D ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1168
            h := 3
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1169
        ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1170
            h := 2
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1171
        ].
1362
f2a9bc6ad68d new resource naming
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
  1172
        bH := styleSheet at:'variablePanel.barHeight'.
924
81f3ca4512bd allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
  1173
        bH isNil ifTrue:[
81f3ca4512bd allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
  1174
            bH := (h * device verticalPixelPerMillimeter) rounded.
81f3ca4512bd allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
  1175
        ].
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1176
    ].
876
9766a5eda233 examples
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
  1177
    self barHeight:bH.
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1178
    knobHeight := bH.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1179
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1180
    handleLabels notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1181
        font := font on:device.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1182
        bH := handleLabels inject:bH into:[:maxSoFar :thisLabel |
874
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1183
                                           thisLabel isNil ifTrue:[
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1184
                                                maxSoFar
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1185
                                           ] ifFalse:[
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1186
                                                maxSoFar max:(thisLabel heightOn:self)
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1187
                                           ]
f79d88b92c1b example & fix for images
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1188
                                          ].
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1189
        bH := bH + font descent - 1
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1190
    ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1191
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1192
    self barHeight:bH.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1193
1362
f2a9bc6ad68d new resource naming
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
  1194
    "Modified: / 26.10.1997 / 17:06:30 / cg"
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1195
!
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1196
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
defaultControllerClass
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
    ^ VariablePanelController
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
fixSize 
1151
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1202
    super fixSize.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
    extentChanged ifTrue:[
1151
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1204
        self resizeSubviews
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1205
    ].
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1206
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1207
    "Modified: 22.3.1997 / 01:19:55 / stefan"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
initCursor
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
    "set the cursor - a double arrow"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
1158
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
  1213
    cursor := self class cursorForOrientation:orientation
900
0541b96dd173 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 876
diff changeset
  1214
1158
225c0d52068d cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
  1215
    "Modified: 28.3.1997 / 14:45:44 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
  1219
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
  1220
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1221
    |mm|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
    super initStyle.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
    handleColor := DefaultHandleColor on:device.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
    DefaultHandleStyle isNil ifTrue:[
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1228
        handleStyle := styleSheet name
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
    ] ifFalse:[
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1230
        handleStyle := DefaultHandleStyle
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1233
    handleLevel := DefaultHandleLevel.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1234
    showHandle := DefaultShowHandle.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1235
    handlePosition := DefaultHandlePosition.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1236
    trackLine := DefaultTrackingLine.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    separatingLine := DefaultSeparatingLine.
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1239
    handleStyle == #next ifTrue:[
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1240
        shadowForm := self class shadowFormOn:device.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1241
        lightForm := self class lightFormOn:device.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1242
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1243
        barWidth := shadowForm width.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1244
    ] ifFalse:[
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1245
        shadowForm := lightForm := nil.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1246
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1247
        mm := device verticalPixelPerMillimeter.
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1248
        barWidth := (2 * mm) rounded. "motif style width"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
    ].
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1250
    self computeBarHeight.
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1251
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1252
    handleStyle == #mswindows ifTrue:[
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1253
        barWidth := (ArrowButton new direction:#up) width + 1 
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
    ].
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1255
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
  1256
    "Modified: 22.1.1997 / 11:57:58 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
initialize
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1260
    orientation isNil ifTrue:[orientation := #vertical].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
    super initialize.
496
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1262
f22ac16a5093 commentary & code cleanup
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
  1263
    "Modified: 7.3.1996 / 14:08:25 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1264
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
!VariablePanel methodsFor:'private'!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
anyNonRelativeSubviews
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
    "return true, if any of my subviews has no relative origin/extent"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1271
    self subViews do:[:aComponent |
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1272
        aComponent relativeCorner isNil ifTrue:[^ true].
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1273
        aComponent relativeOrigin isNil ifTrue:[^ true]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
    ].
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
    ^ false
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1276
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1277
    "Modified: 28.1.1997 / 17:57:26 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1280
handleLabelAt:hIndex
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1281
    handleLabels notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1282
        ^ handleLabels at:hIndex ifAbsent:nil
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1283
    ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1284
    ^ nil
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1285
!
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1286
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1287
handleOriginsWithIndexDo:aBlock
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
    "evaluate the argument block for every handle-origin"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1290
    self handleOriginsWithIndexFrom:1 to:(self subViews size) do:aBlock
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1291
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1292
    "Modified: 28.1.1997 / 17:53:44 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1295
handleOriginsWithIndexFrom:start to:stop do:aBlock
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
    "evaluate the argument block for some handle-origins"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1298
    |x y hw hh hDelta vDelta subViews
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
     first "{ Class: SmallInteger }"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
     last  "{ Class: SmallInteger }"|
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1302
    (subViews := self subViews) notNil ifTrue:[
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1303
        shadowForm notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1304
            hw := shadowForm width.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1305
            hh := shadowForm height.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1306
        ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1307
            hw := hh := barWidth
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1308
        ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1310
        (handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1311
            hDelta := barWidth // 2.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1312
            vDelta := barWidth // 2.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1313
        ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1314
            hDelta := vDelta := 0
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1315
        ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1317
        (handlePosition == #left) ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1318
            x := hDelta. 
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1319
            y := vDelta
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1320
        ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1321
            (handlePosition == #right) ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1322
                x := width - hw - margin - hDelta.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1323
                y := height - hh - margin - vDelta.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1324
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1325
                x := width - barWidth // 2.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1326
                y := height - barWidth // 2
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1327
            ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1328
        ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1329
        first := start + 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1330
        last := stop.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1331
        first to:last do:[:index |
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1332
            |view|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1334
            view := subViews at:index.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1335
            orientation == #vertical ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1336
                y := view top "origin y" - barHeight + 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1337
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1338
                x := view left "origin x" - barHeight + 1.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1339
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1340
            aBlock value:(x @ y) value:index
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1341
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
    ]
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1343
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1344
    "Modified: 28.1.1997 / 17:54:07 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
resizeSubviews
1151
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1348
    "readjust size of all subviews"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1350
    self resizeSubviewsFrom:1 to:(self subViews size)
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1351
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1352
    "Modified: 28.1.1997 / 17:54:42 / cg"
1151
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1353
    "Modified: 22.3.1997 / 01:01:31 / stefan"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1356
resizeSubviewsFrom:start to:stop
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
    "readjust size of some subviews"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1359
    |step nSubviews subViews|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1361
    (subViews := self subViews) size > 0 ifTrue:[
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1362
        (start <= stop) ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1363
            step := 1
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1364
        ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1365
            step := -1
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1366
        ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1367
        nSubviews := subViews size.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1368
        start to:stop by:step do:[:index |
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1369
            |bw view o1 o2 relOrg relCorner newOrg newCorner newExt|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1370
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1371
            view := subViews at:index.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1372
            bw := view borderWidth.
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1374
            index == 1 ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1375
                o1 := 0.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1376
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1377
                o1 := barHeight // 2 - bw
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1378
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1379
            index ==  nSubviews ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1380
                o2 := 0.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1381
            ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1382
                o2 := barHeight // 2 - bw
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1383
            ].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1384
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1385
            newOrg := view computeOrigin.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1386
            newOrg notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1387
                (index ~~ 1) ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1388
                    orientation == #vertical ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1389
                        newOrg y:(newOrg y + o1)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1390
                    ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1391
                        newOrg x:(newOrg x + o1)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1392
                    ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1393
                ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1394
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1395
            newExt := view computeExtent.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1396
            newExt notNil ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1397
                orientation == #vertical ifTrue:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1398
                    newExt y:(newExt y - o2 - o1)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1399
                ] ifFalse:[
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1400
                    newExt x:(newExt x - o2 - o1)
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1401
                ]
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1402
            ].
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1403
            view pixelOrigin:newOrg extent:newExt.
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1404
        ]
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
    ]
873
d1274f0256a6 removed transcript message
Claus Gittinger <cg@exept.de>
parents: 871
diff changeset
  1406
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1407
    "Modified: 28.1.1997 / 17:55:03 / cg"
1151
94aff1c7b0aa Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents: 1131
diff changeset
  1408
    "Modified: 22.3.1997 / 01:02:21 / stefan"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
!
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1410
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1411
setupSubviews
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
    "setup subviews sizes (in case of non-relative sizes)"
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1414
    |pos delta subViews nSubViews "{ Class: SmallInteger }"|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
300
0823ef38e629 adding/removing views to Panels
ah
parents: 299
diff changeset
  1416
    "/ setup all subviews to spread evenly ...
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1418
    subViews := self subViews.
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1419
    nSubViews := subViews size.
1043
f0eeb4035bb8 re-setup subViews when removing a subview;
ca
parents: 980
diff changeset
  1420
    nSubViews == 0 ifTrue:[^ self].
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1422
    pos := 0.0. 
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1423
    delta := 1.0 / nSubViews.
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1424
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1425
    1 to:nSubViews do:[:index |
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1426
        |view|
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1428
        view := subViews at:index.
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1429
        orientation == #vertical ifTrue:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1430
            index == subViews size ifTrue:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1431
                view origin:(0.0 @ pos) corner:(1.0 @ 1.0)
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1432
            ] ifFalse:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1433
                view origin:(0.0 @ pos) corner:(1.0 @ (pos + delta))
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1434
            ].
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1435
        ] ifFalse:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1436
            index == subViews size ifTrue:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1437
                view origin:(pos @ 0.0) corner:(1.0 @ 1.0)
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1438
            ] ifFalse:[
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1439
                view origin:(pos @ 0.0) corner:((pos + delta) @ 1.0)
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1440
            ].
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1441
        ].
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1442
        pos := pos + delta
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
    ]
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1444
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1445
    "Modified: 28.1.1997 / 17:56:20 / cg"
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
! !
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1448
!VariablePanel methodsFor:'private tableView protocol'!
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1449
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1450
setupSubviewOrigins
826
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1451
    "setup subviews origins 
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1452
     if we only have relative extents 
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1453
     (Variable Panels need relative origins and corners!!) (SV 16.1.95)"
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1454
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1455
    |x y e eX eY subViews n "{ Class: SmallInteger }"|
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1456
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1457
    x := y := 0.0.
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1458
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1459
    subViews := self subViews.
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1460
    n := subViews size.
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1461
    1 to:n do:[:index |
826
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1462
        |view|
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1463
826
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1464
        view := subViews at:index.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1465
        e := view relativeExtent.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1466
        e notNil ifTrue:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1467
            view relativeExtent:nil.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1468
            eX := e x.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1469
            eY := e y.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1470
            index == n ifTrue:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1471
                view origin:(x @ y) corner:(1.0 @ 1.0)
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1472
            ] ifFalse:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1473
                orientation == #vertical ifTrue:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1474
                    view origin:(x @ y) corner:(1.0 @ (y+eY))
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1475
                ] ifFalse:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1476
                    view origin:(x @ y) corner:((x+eX) @ 1.0)
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1477
                ].
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1478
            ].
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1479
            orientation == #vertical ifTrue:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1480
                y := y + eY.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1481
            ] ifFalse:[    
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1482
                x := x + eX.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1483
            ]
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1484
        ] ifFalse: [
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1485
            view origin:(x @ y).
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1486
            orientation == #vertical ifTrue:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1487
                y := view relativeCorner y.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1488
            ] ifFalse:[
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1489
                x := view relativeCorner x.
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1490
            ]
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1491
        ].
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1492
    ]
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1493
138bc07c873b Add comment.
Stefan Vogel <sv@exept.de>
parents: 722
diff changeset
  1494
    "Modified: 21.8.1996 / 10:01:29 / stefan"
980
6079922a5519 eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents: 966
diff changeset
  1495
    "Modified: 28.1.1997 / 17:55:21 / cg"
299
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1496
! !
d2f955840ad5 oops - tableViews private interface was lost - reintroduced
ah
parents: 295
diff changeset
  1497
871
541b8f9e8237 add label to vertical panel
ca
parents: 826
diff changeset
  1498
!VariablePanel class methodsFor:'documentation'!
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
version
1362
f2a9bc6ad68d new resource naming
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
  1501
    ^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.35 1997-10-28 19:25:29 cg Exp $'
295
aa5887bff1b2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
! !