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