SimpleView.st
author Claus Gittinger <cg@exept.de>
Mon, 22 Apr 1996 23:39:59 +0200
changeset 586 b91f10f632d5
parent 584 6106ad13708d
child 616 56cf67c82664
permissions -rw-r--r--
commentary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
135
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
claus
parents:
diff changeset
    12
claus
parents:
diff changeset
    13
PseudoView subclass:#SimpleView
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    14
	instanceVariableNames:'superView subViews components styleSheet resources borderColor
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    15
		borderWidth borderShape viewShape top left extentChanged
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    16
		originChanged cornerChanged relativeOrigin relativeExtent
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    17
		relativeCorner originRule extentRule cornerRule insets viewport
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    18
		layout shown hiddenOnRealize name level margin innerClipRect
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    19
		shadowColor lightColor bitGravity viewGravity controller
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    20
		windowGroup'
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    21
	classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    22
		DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
472
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
    23
		DefaultShadowColor DefaultBorderWidth DefaultFocusColor
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
    24
		DefaultFocusBorderWidth ReturnFocusWhenClosingModalBoxes'
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    25
	poolDictionaries:''
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    26
	category:'Views-Basic'
135
claus
parents:
diff changeset
    27
!
claus
parents:
diff changeset
    28
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
    29
SimpleView class instanceVariableNames:'ClassResources DefaultFont'
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    30
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    31
"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    32
 The following class instance variables are inherited by this class:
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    33
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    34
	PseudoView - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    35
	DeviceDrawable - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    36
	DisplayMedium - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    37
	GraphicsContext - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    38
	Object - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    39
"
140
claus
parents: 138
diff changeset
    40
!
135
claus
parents:
diff changeset
    41
claus
parents:
diff changeset
    42
!SimpleView class methodsFor:'documentation'!
claus
parents:
diff changeset
    43
claus
parents:
diff changeset
    44
copyright
claus
parents:
diff changeset
    45
"
claus
parents:
diff changeset
    46
 COPYRIGHT (c) 1989 by Claus Gittinger
claus
parents:
diff changeset
    47
	      All Rights Reserved
claus
parents:
diff changeset
    48
claus
parents:
diff changeset
    49
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    50
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    51
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    52
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    53
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    54
 hereby transferred.
claus
parents:
diff changeset
    55
"
claus
parents:
diff changeset
    56
!
claus
parents:
diff changeset
    57
claus
parents:
diff changeset
    58
documentation
claus
parents:
diff changeset
    59
"
claus
parents:
diff changeset
    60
    this class implements functions common to all Views which do not work on / show a model. 
claus
parents:
diff changeset
    61
    Previously, all of this functionality used to be in the old View class, but has been
claus
parents:
diff changeset
    62
    separated into this new SimpleView (which does not know about models) and the new View, which
claus
parents:
diff changeset
    63
    does so.
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    64
    I'd prefer to call this class View and the current View class a ModelView,
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    65
    but for backward compatibility its better to leave things the way they are
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    66
    (there are simply too many subclasses of View around ...).
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    67
135
claus
parents:
diff changeset
    68
    Instances of SimpleView are seldom used, most views in the system inherit 
claus
parents:
diff changeset
    69
    from this class. 
claus
parents:
diff changeset
    70
    However, sometimes a view is used to create a dummy view for framing 
claus
parents:
diff changeset
    71
    or layout purposes.
claus
parents:
diff changeset
    72
claus
parents:
diff changeset
    73
    Instance variables:
claus
parents:
diff changeset
    74
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    75
        superView               <View>                  my superview i.e. the view I am in
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    76
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    77
        subViews                <Collection>            the collection of subviews
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    78
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    79
        components              <Collection>            collection of gadgets (will be merged with subViews, soon)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    80
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    81
        borderColor             <Color>                 color of border
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    82
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    83
        borderWidth             <Number>                borderWidth in pixels (device dep.)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    84
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    85
        borderShape             <Form>                  shape of border (if device supports it)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    86
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    87
        viewShape               <Form>                  shape of view (if device supports it)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    88
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    89
        top                     <Number>                actual top coordinate (pixels) in superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    90
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    91
        left                    <Number>                actual left coordinate (pixels) in superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    92
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    93
        extendChanged           <Boolean>               true if extend changed during setup
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    94
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    95
        originChanged           <Boolean>               true if origin changed during setup
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    96
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    97
        viewport                <Rectangle>             my Rectangle in superviews coordinates
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    98
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
    99
        relativeOrigin          <Number>                relative origin in percent within superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   100
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   101
        relativeExtent          <Number>                relative extent in percent within superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   102
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   103
        relativeCorner          <Number>                relative corner in percent within superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   104
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   105
        originRule              <Block>                 rule to compute origin if superview changes size
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   106
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   107
        extentRule              <Block>                 rule to compute extent if superview changes size
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   108
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   109
        cornerRule              <Block>                 rule to compute corner if superview changes size
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   110
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   111
        insets                  <Array>                 array with top, left, bottom & right insets (or nil)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   112
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   113
        layout                  <LayoutObject>          not yet implemented - will replace the above layout
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   114
                                                        variables.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   115
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   116
        shown                   <Boolean>               true if visible (false if iconified, unmapped or covered)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   117
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   118
        hiddenOnRealize         <Boolean>               dont show automatically when superview is realized
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   119
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   120
        name                    <String>                my name (future use for resources)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   121
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   122
        level                   <Number>                3D level relative to superview
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   123
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   124
        margin                  <Number>                convenient margin
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   125
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   126
        innerClipRect           <Rectangle>             convenient inner clip (minus margin)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   127
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   128
        shadowColor             <Color>                 color used to draw 3D shadowed edges
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   129
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   130
        lightColor              <Color>                 color used to draw 3D lighted edges
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   131
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   132
        bitGravity              <nil | Symbol>          gravity of contents (if device supports it)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   133
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   134
        viewGravity             <nil | Symbol>          gravity of view (if device supports it)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   135
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   136
        controller              <nil | Controller>      the controller (if any)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   137
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   138
        windowGroup             <WindowGroup>           the windowGroup
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   139
135
claus
parents:
diff changeset
   140
claus
parents:
diff changeset
   141
claus
parents:
diff changeset
   142
    Class variables:
claus
parents:
diff changeset
   143
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   144
        Grey                    <Color>                 the color grey - its used so often
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   145
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   146
        ViewSpacing             <Number>                preferred spacing between views; 1mm
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   147
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   148
        CentPoint               <Point>                 100 @ 100 - its used so often
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   149
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   150
        StyleSheet              <ResourcePack>          contains all view-style specifics
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   151
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   152
        ReturnFocusWhenClosingModalBoxes                if true, a closing modalBox returns
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   153
                                <Boolean>               the keyboard focus to the view which was
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   154
                                                        active when the box was opened.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   155
                                                        If false (the default), it is left to
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   156
                                                        window manager to assign a new focus.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   157
                                                        If running on olwm/olvwm (which requires an
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   158
                                                        explicit click to reassign a focus), it is
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   159
                                                        better to turn this on in a private.rc file.
135
claus
parents:
diff changeset
   160
claus
parents:
diff changeset
   161
    styleSheet parameters:
claus
parents:
diff changeset
   162
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   163
        popupShadow             <Boolean>               if true, popupViews show a shadow below
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   164
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   165
        popupLevel              <nil | Integer>         3D level
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   166
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   167
        borderWidth             <nil | Integer>         borderWidth (ignored in 3D styles)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   168
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   169
        borderColor             <nil | Color>           borderColor (ignored in 3D styles)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   170
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   171
        viewBackground          <nil | Color>           views background
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   172
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   173
        shadowColor             <nil | Color>           color for shadow edges (ignored in 2D styles)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   174
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   175
        lightColor              <nil | Color>           color for light edges (ignored in 2D styles)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   176
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   177
        font                    <nil | Font>            font to use
135
claus
parents:
diff changeset
   178
claus
parents:
diff changeset
   179
claus
parents:
diff changeset
   180
    TODO:
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   181
        get rid of relativeOrigin, relativeCorner, originRule, extentRule,
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   182
        and insets; replace by a single object which defines the size
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   183
        (mhmh - ST-80 seems to call this LayoutFrame ?)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   184
        -> be prepared for a change here in the near future and ONLY use
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   185
           access methods to get those instance variables' values
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   186
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   187
        get rid of 3D level & margin, move it to extra wrappers
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   188
        (although this will make view setup more complicated, it will remove
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   189
         complexity from the internals of view. Also, it will allow for more
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   190
         varieties of borders.)
151
claus
parents: 145
diff changeset
   191
        
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   192
        add components (could also call them gadgets or lightweight views)
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   193
        - views are expensive in terms of X resources. This would make all
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   194
        framing/edge and panel helper views become cheap ST objects, instead
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
   195
        of views.
135
claus
parents:
diff changeset
   196
"
151
claus
parents: 145
diff changeset
   197
!
claus
parents: 145
diff changeset
   198
claus
parents: 145
diff changeset
   199
examples 
claus
parents: 145
diff changeset
   200
"
claus
parents: 145
diff changeset
   201
    (all examples below use different viewBackgrounds, 
claus
parents: 145
diff changeset
   202
     to make the individual subviews visible)
claus
parents: 145
diff changeset
   203
claus
parents: 145
diff changeset
   204
    fixed position/size:
claus
parents: 145
diff changeset
   205
claus
parents: 145
diff changeset
   206
       |top v1 v2|
claus
parents: 145
diff changeset
   207
claus
parents: 145
diff changeset
   208
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   209
       top extent:300@300.
claus
parents: 145
diff changeset
   210
claus
parents: 145
diff changeset
   211
       v1 := View origin:10@10
claus
parents: 145
diff changeset
   212
		  corner:50@50
claus
parents: 145
diff changeset
   213
		      in:top.
claus
parents: 145
diff changeset
   214
       v2 := View origin:60@10
claus
parents: 145
diff changeset
   215
		  corner:150@100
claus
parents: 145
diff changeset
   216
		      in:top.
claus
parents: 145
diff changeset
   217
claus
parents: 145
diff changeset
   218
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   219
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   220
claus
parents: 145
diff changeset
   221
       top open
claus
parents: 145
diff changeset
   222
claus
parents: 145
diff changeset
   223
claus
parents: 145
diff changeset
   224
    same, using ST-80 way of bulding up view hierarchies
claus
parents: 145
diff changeset
   225
    (recommended, if you plan to port applications later)
claus
parents: 145
diff changeset
   226
claus
parents: 145
diff changeset
   227
       |top v1 v2|
claus
parents: 145
diff changeset
   228
claus
parents: 145
diff changeset
   229
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   230
       top extent:300@300.
claus
parents: 145
diff changeset
   231
claus
parents: 145
diff changeset
   232
       v1 := View new.
claus
parents: 145
diff changeset
   233
       v1 origin:10@10 corner:50@50.
claus
parents: 145
diff changeset
   234
claus
parents: 145
diff changeset
   235
       v2 := View new.
claus
parents: 145
diff changeset
   236
       v2 origin:60@10 corner:150@100.
claus
parents: 145
diff changeset
   237
claus
parents: 145
diff changeset
   238
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   239
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   240
claus
parents: 145
diff changeset
   241
       top add:v1.
claus
parents: 145
diff changeset
   242
       top add:v2.
claus
parents: 145
diff changeset
   243
claus
parents: 145
diff changeset
   244
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   245
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   246
claus
parents: 145
diff changeset
   247
       top open
claus
parents: 145
diff changeset
   248
claus
parents: 145
diff changeset
   249
claus
parents: 145
diff changeset
   250
    fixed origin, variable size:
claus
parents: 145
diff changeset
   251
claus
parents: 145
diff changeset
   252
       |top v1 v2|
claus
parents: 145
diff changeset
   253
claus
parents: 145
diff changeset
   254
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   255
       top extent:300@300.
claus
parents: 145
diff changeset
   256
claus
parents: 145
diff changeset
   257
       v1 := View new.
claus
parents: 145
diff changeset
   258
       v1 origin:10@10 corner:50@0.5.
claus
parents: 145
diff changeset
   259
claus
parents: 145
diff changeset
   260
       v2 := View new.
claus
parents: 145
diff changeset
   261
       v2 origin:60@10 corner:150@0.5.
claus
parents: 145
diff changeset
   262
claus
parents: 145
diff changeset
   263
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   264
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   265
claus
parents: 145
diff changeset
   266
       top add:v1.
claus
parents: 145
diff changeset
   267
       top add:v2.
claus
parents: 145
diff changeset
   268
claus
parents: 145
diff changeset
   269
       top open
claus
parents: 145
diff changeset
   270
claus
parents: 145
diff changeset
   271
claus
parents: 145
diff changeset
   272
    fixed origin, variable size, 
claus
parents: 145
diff changeset
   273
    bottomInset for constant distance from bottom:
claus
parents: 145
diff changeset
   274
claus
parents: 145
diff changeset
   275
       |top v1 v2|
claus
parents: 145
diff changeset
   276
claus
parents: 145
diff changeset
   277
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   278
       top extent:300@300.
claus
parents: 145
diff changeset
   279
claus
parents: 145
diff changeset
   280
       v1 := View new.
claus
parents: 145
diff changeset
   281
       v1 origin:10@10 corner:50@1.0.
claus
parents: 145
diff changeset
   282
       v1 bottomInset:10.
claus
parents: 145
diff changeset
   283
claus
parents: 145
diff changeset
   284
       v2 := View new.
claus
parents: 145
diff changeset
   285
       v2 origin:60@10 corner:150@1.0.
claus
parents: 145
diff changeset
   286
       v2 bottomInset:10.
claus
parents: 145
diff changeset
   287
claus
parents: 145
diff changeset
   288
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   289
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   290
claus
parents: 145
diff changeset
   291
       top add:v1.
claus
parents: 145
diff changeset
   292
       top add:v2.
claus
parents: 145
diff changeset
   293
claus
parents: 145
diff changeset
   294
       top open
claus
parents: 145
diff changeset
   295
claus
parents: 145
diff changeset
   296
claus
parents: 145
diff changeset
   297
    variable origin, variable size, 
claus
parents: 145
diff changeset
   298
claus
parents: 145
diff changeset
   299
       |top v1 v2|
claus
parents: 145
diff changeset
   300
claus
parents: 145
diff changeset
   301
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   302
       top extent:300@300.
claus
parents: 145
diff changeset
   303
claus
parents: 145
diff changeset
   304
       v1 := View new.
claus
parents: 145
diff changeset
   305
       v1 origin:0.0@0.0 corner:0.5@0.5.
claus
parents: 145
diff changeset
   306
claus
parents: 145
diff changeset
   307
       v2 := View new.
claus
parents: 145
diff changeset
   308
       v2 origin:0.5@0.0 corner:1.0@0.5.
claus
parents: 145
diff changeset
   309
claus
parents: 145
diff changeset
   310
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   311
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   312
claus
parents: 145
diff changeset
   313
       top add:v1.
claus
parents: 145
diff changeset
   314
       top add:v2.
claus
parents: 145
diff changeset
   315
claus
parents: 145
diff changeset
   316
       top open
claus
parents: 145
diff changeset
   317
claus
parents: 145
diff changeset
   318
claus
parents: 145
diff changeset
   319
    variable origin, variable size, 
claus
parents: 145
diff changeset
   320
    insets for some constant distance
claus
parents: 145
diff changeset
   321
claus
parents: 145
diff changeset
   322
       |top v1 v2|
claus
parents: 145
diff changeset
   323
claus
parents: 145
diff changeset
   324
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   325
       top extent:300@300.
claus
parents: 145
diff changeset
   326
claus
parents: 145
diff changeset
   327
       v1 := View new.
claus
parents: 145
diff changeset
   328
       v1 origin:0.0@0.0 corner:0.5@0.5.
claus
parents: 145
diff changeset
   329
       v1 rightInset:5.
claus
parents: 145
diff changeset
   330
claus
parents: 145
diff changeset
   331
       v2 := View new.
claus
parents: 145
diff changeset
   332
       v2 origin:0.5@0.0 corner:1.0@0.5.
claus
parents: 145
diff changeset
   333
       v2 leftInset:5.
claus
parents: 145
diff changeset
   334
claus
parents: 145
diff changeset
   335
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   336
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   337
claus
parents: 145
diff changeset
   338
       top add:v1.
claus
parents: 145
diff changeset
   339
       top add:v2.
claus
parents: 145
diff changeset
   340
claus
parents: 145
diff changeset
   341
       top open
claus
parents: 145
diff changeset
   342
claus
parents: 145
diff changeset
   343
claus
parents: 145
diff changeset
   344
    using layout objects (ST-80 style):
claus
parents: 145
diff changeset
   345
    fully specifying the frame
claus
parents: 145
diff changeset
   346
claus
parents: 145
diff changeset
   347
       |top v1 v2|
claus
parents: 145
diff changeset
   348
claus
parents: 145
diff changeset
   349
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   350
       top extent:300@300.
claus
parents: 145
diff changeset
   351
claus
parents: 145
diff changeset
   352
       v1 := View new.
claus
parents: 145
diff changeset
   353
       v2 := View new.
claus
parents: 145
diff changeset
   354
claus
parents: 145
diff changeset
   355
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   356
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   357
claus
parents: 145
diff changeset
   358
       top add:v1 in:(LayoutFrame new
claus
parents: 145
diff changeset
   359
			leftFraction:0.25;
claus
parents: 145
diff changeset
   360
			rightFraction:0.75;
claus
parents: 145
diff changeset
   361
			topFraction:0.0;
claus
parents: 145
diff changeset
   362
			bottomFraction:0.5).
claus
parents: 145
diff changeset
   363
       top add:v2 in:(LayoutFrame new
claus
parents: 145
diff changeset
   364
			leftFraction:0.5;
claus
parents: 145
diff changeset
   365
			rightFraction:1.0;
claus
parents: 145
diff changeset
   366
			topFraction:0.5;
claus
parents: 145
diff changeset
   367
			bottomFraction:0.75).
claus
parents: 145
diff changeset
   368
claus
parents: 145
diff changeset
   369
       top open
claus
parents: 145
diff changeset
   370
claus
parents: 145
diff changeset
   371
claus
parents: 145
diff changeset
   372
    another one, with offsets:
claus
parents: 145
diff changeset
   373
claus
parents: 145
diff changeset
   374
       |top v1 v2|
claus
parents: 145
diff changeset
   375
claus
parents: 145
diff changeset
   376
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   377
       top extent:300@300.
claus
parents: 145
diff changeset
   378
claus
parents: 145
diff changeset
   379
       v1 := View new.
claus
parents: 145
diff changeset
   380
       v2 := View new.
claus
parents: 145
diff changeset
   381
claus
parents: 145
diff changeset
   382
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   383
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   384
claus
parents: 145
diff changeset
   385
       top add:v1 in:(LayoutFrame new
claus
parents: 145
diff changeset
   386
			leftFraction:0.0 offset:10;
claus
parents: 145
diff changeset
   387
			rightFraction:1.0 offset:-10;
claus
parents: 145
diff changeset
   388
			topFraction:0.0 offset:10;
claus
parents: 145
diff changeset
   389
			bottomFraction:0.5).
claus
parents: 145
diff changeset
   390
       top add:v2 in:(LayoutFrame new
claus
parents: 145
diff changeset
   391
			leftFraction:0.0 offset:30;
claus
parents: 145
diff changeset
   392
			rightFraction:1.0 offset:-30;
claus
parents: 145
diff changeset
   393
			topFraction:0.5 offset:10;
claus
parents: 145
diff changeset
   394
			bottomFraction:0.75).
claus
parents: 145
diff changeset
   395
claus
parents: 145
diff changeset
   396
       top open
claus
parents: 145
diff changeset
   397
claus
parents: 145
diff changeset
   398
claus
parents: 145
diff changeset
   399
    specifying origin only. Extent is views preferred
claus
parents: 145
diff changeset
   400
    (notice, that plain views have some defaultExtent of 100@100)
claus
parents: 145
diff changeset
   401
claus
parents: 145
diff changeset
   402
       |top v1 v2|
claus
parents: 145
diff changeset
   403
claus
parents: 145
diff changeset
   404
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   405
       top extent:300@300.
claus
parents: 145
diff changeset
   406
claus
parents: 145
diff changeset
   407
       v1 := View new.
claus
parents: 145
diff changeset
   408
       v2 := View new.
claus
parents: 145
diff changeset
   409
claus
parents: 145
diff changeset
   410
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   411
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   412
claus
parents: 145
diff changeset
   413
       top add:v1 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   414
			leftFraction:0.25;
claus
parents: 145
diff changeset
   415
			topFraction:0.0).
claus
parents: 145
diff changeset
   416
       top add:v2 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   417
			leftFraction:0.5;
claus
parents: 145
diff changeset
   418
			topFraction:0.5).
claus
parents: 145
diff changeset
   419
claus
parents: 145
diff changeset
   420
       top open
claus
parents: 145
diff changeset
   421
claus
parents: 145
diff changeset
   422
    same example, using buttons which compute their preferredBounds:
claus
parents: 145
diff changeset
   423
claus
parents: 145
diff changeset
   424
       |top v1 v2|
claus
parents: 145
diff changeset
   425
claus
parents: 145
diff changeset
   426
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   427
       top extent:300@300.
claus
parents: 145
diff changeset
   428
claus
parents: 145
diff changeset
   429
       v1 := Button label:'foo'.
claus
parents: 145
diff changeset
   430
       v2 := Button label:'a very long buttonLabel'.
claus
parents: 145
diff changeset
   431
claus
parents: 145
diff changeset
   432
       v1 backgroundColor:(Color red).
claus
parents: 145
diff changeset
   433
       v2 backgroundColor:(Color yellow).
claus
parents: 145
diff changeset
   434
claus
parents: 145
diff changeset
   435
       top add:v1 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   436
			leftFraction:0.25;
claus
parents: 145
diff changeset
   437
			topFraction:0.0).
claus
parents: 145
diff changeset
   438
       top add:v2 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   439
			leftFraction:0.5;
claus
parents: 145
diff changeset
   440
			topFraction:0.5).
claus
parents: 145
diff changeset
   441
claus
parents: 145
diff changeset
   442
       top open
claus
parents: 145
diff changeset
   443
claus
parents: 145
diff changeset
   444
"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   445
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   446
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   447
layoutComputation 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   448
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   449
    Due to historic reasons, there are 2 mechanisms to resize a view:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   450
	- (old, to be eliminated mechanism)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   451
	    based upon info found in 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   452
		relativeOrigin / relativeCorner / relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   453
		originRule / cornerRule / extentRule
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   454
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   455
	- (new, will migrate to that one)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   456
	    letting a layoutObject compute things
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   457
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   458
    Actually, the old mechanism is just as powerful, as the new (layoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   459
    based) mechanism; with the help of block=rules, you can compute whatever
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   460
    geometry is desired.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   461
    However, having 6 instance variables in every view creates some overhead,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   462
    which can be avoided in most cases (most views are either fixed-size or
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   463
    relative-sized).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   464
    Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   465
    to use layoutObjects.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   466
    You will not see a difference at the views protocol level, since
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   467
    existing interfaces will (silently) create layoutObjects as appropriate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   468
    However, you should remove all direct accesses to the above mentioned
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   469
    instance variables, to be prepared for that change.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   470
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   471
    Notice, that a view recomputes its size whenever its superview
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   472
    changes size. This is done via:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   473
	sizeChanged
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   474
	    -> allSubviews: superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   475
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   476
    If the geometry computation as performed in superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   477
    is not powerful enough for your application, you can either:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   478
	- redefine superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   479
	- create a special layoutObject which computes a new layout.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   480
"
522
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   481
!
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   482
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   483
popupMenus 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   484
"
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   485
    Due to historic reasons, there are multiple mechanisms for popupMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   486
    definition:
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   487
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   488
        - static menus
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   489
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   490
        - dynamic menus from the view
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   491
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   492
        - dynamic menus from the model / menuHolder
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   493
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   494
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   495
    static menus
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   496
    ------------
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   497
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   498
    The easiest to use is a static menu; this is useful, if some view
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   499
    has a constant menu which never changes.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   500
    It can be defined at initialization time or redefined any time later.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   501
    The menu is defined with:
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   502
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   503
        someView middleButtonMenu:<aPopUpMenu>
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   504
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   505
    Compatibility note: 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   506
        static menus should no longer be used - their operation
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   507
        is incompatible with ST-80 and ST/X's dynamic menus.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   508
        Do not use them if you care for compatibility.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   509
    Also, they do not care for any menuPerformers or menuHolders.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   510
    (instead, they use a receiver instance variable, which gets the messages).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   511
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   512
    example:
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   513
        |top v1 v2|
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   514
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   515
        top := StandardSystemView new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   516
        top extent:300@300.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   517
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   518
        v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   519
        v1 viewBackground:Color red.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   520
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   521
        v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   522
        v2 viewBackground:Color yellow.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   523
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   524
        v1 middleButtonMenu:(
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   525
                                PopUpMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   526
                                   labels:#('foo' 'bar')
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   527
                                   selectors:#(foo bar)
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   528
                                   receiver:v1
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   529
                            ).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   530
                                        
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   531
        top open.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   532
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   533
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   534
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   535
    dynamic menus
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   536
    -------------
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   537
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   538
    A dynamic menu can be provided by the view itself, or by the model.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   539
    In addition, TextViews allow a separate menuHolder to provide the menu
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   540
    (i.e. it may be different from the model).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   541
    If the model shall provide the menu, set the views menuMessage to a selector
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   542
    which is sent to the model. This message should return a popUpMenu.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   543
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   544
    For textViews, the above is also valid, except if the menuHolder is explicitely
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   545
    set - in this case, that one provides the menu; not the model.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   546
    Dont get confused by the fact that menuHolders are only supported
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   547
    by textViews.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   548
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   549
    example: (in your application, the plug would be your application, topView or model)
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   550
    Notice, that all menu messages are sent to the view (because no model was set)
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   551
    - so the textView still performs the copy-function correctly 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   552
    (but of course, does not respond to the fooBar messages).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   553
    If a model was set, the menu would try the model first, but send its messages
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   554
    to the view IFF the model would not respond to the menu message.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   555
    (this allows mixing of menu messages for the view AND the model).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   556
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   557
        |top v1 v2 holder|
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   558
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   559
        holder := Plug new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   560
        holder respondTo:#menu1
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   561
                    with:[
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   562
                            v1 menuMessage:#otherMenu1.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   563
                            PopUpMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   564
                                labels:#('foo' 'bar')
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   565
                                selectors:#(foo bar).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   566
                         ].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   567
        holder respondTo:#otherMenu1
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   568
                    with:[  
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   569
                            v1 menuMessage:#menu1.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   570
                            PopUpMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   571
                                labels:#('other foo' 'other bar')
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   572
                                selectors:#(foo bar).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   573
                         ].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   574
        holder respondTo:#menu2
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   575
                    with:[  PopUpMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   576
                                labels:#('copy' 'bar2')
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   577
                                selectors:#(copySelection bar2)
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   578
                         ].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   579
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   580
        top := StandardSystemView new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   581
        top extent:300@300.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   582
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   583
        v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   584
        v1 viewBackground:Color red.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   585
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   586
        v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   587
        v2 contents:'pop me up'.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   588
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   589
        v1 model:holder; menuMessage:#menu1.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   590
        v2 menuHolder:holder; menuMessage:#menu2.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   591
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   592
        top open.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   593
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   594
    an additional goody is the possibility, to change the menuPerformer (textViews only).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   595
    If defined, that one will get the menus message (instead of the model/view).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   596
    However, like above, if it does not respond to the message, its still sent to
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   597
    the view. Notice, that with non-textViews, the menuPerformer is always the model.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   598
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   599
    example:
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   600
    (Notice: the executor understands the #copySelection message - therefore, the
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   601
     views built-in copy is NOT performed 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   602
     - it could be forwarded to the view, though.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   603
     This could be useful to intercept/filter things).
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   604
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   605
        |top v menuProvider menuExecutor |
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   606
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   607
        menuProvider := Plug new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   608
        menuProvider respondTo:#menu
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   609
                    with:[  PopUpMenu 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   610
                                labels:#('copy' 'foo')
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   611
                                selectors:#(copySelection foo)
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   612
                         ].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   613
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   614
        menuExecutor := Plug new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   615
        menuExecutor respondTo:#copySelection 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   616
                           with:[Transcript showCr:'copy function'].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   617
        menuExecutor respondTo:#foo 
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   618
                           with:[Transcript showCr:'foo function'].
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   619
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   620
        top := StandardSystemView new.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   621
        top extent:300@300.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   622
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   623
        v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   624
        v contents:'pop me up'.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   625
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   626
        v menuHolder:menuProvider; menuMessage:#menu.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   627
        v menuPerformer:menuExecutor.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   628
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   629
        top open.
1b041037c1ee added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   630
"
135
claus
parents:
diff changeset
   631
! !
claus
parents:
diff changeset
   632
claus
parents:
diff changeset
   633
!SimpleView class methodsFor:'initialization'!
claus
parents:
diff changeset
   634
claus
parents:
diff changeset
   635
initialize
claus
parents:
diff changeset
   636
    DefaultStyle isNil ifTrue:[
claus
parents:
diff changeset
   637
	Font initialize.
claus
parents:
diff changeset
   638
	Form initialize.
claus
parents:
diff changeset
   639
	Color initialize.
claus
parents:
diff changeset
   640
claus
parents:
diff changeset
   641
	Display notNil ifTrue:[
claus
parents:
diff changeset
   642
	    self defaultStyle:#normal.
claus
parents:
diff changeset
   643
	].
claus
parents:
diff changeset
   644
claus
parents:
diff changeset
   645
"/    self updateStyleCache.
claus
parents:
diff changeset
   646
	self == SimpleView ifTrue:[
claus
parents:
diff changeset
   647
	    Smalltalk addDependent:self   "/ to get language changes
claus
parents:
diff changeset
   648
	]
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   649
    ].
365
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   650
    ReturnFocusWhenClosingModalBoxes := false.
135
claus
parents:
diff changeset
   651
!
claus
parents:
diff changeset
   652
claus
parents:
diff changeset
   653
postAutoload
claus
parents:
diff changeset
   654
    self updateStyleCache.
claus
parents:
diff changeset
   655
! !
claus
parents:
diff changeset
   656
claus
parents:
diff changeset
   657
!SimpleView class methodsFor:'instance creation'!
claus
parents:
diff changeset
   658
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   659
extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   660
    "create a new view with given extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   661
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   662
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   663
		      font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   664
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   665
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   666
extent:extent in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   667
    "create a new view as a subview of aView with given extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   668
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   669
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   670
		      font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   671
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   672
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   673
extent:extent label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   674
    "create a new view with given extent and label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   675
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   676
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   677
		      font:nil label:label in:nil
135
claus
parents:
diff changeset
   678
!
claus
parents:
diff changeset
   679
claus
parents:
diff changeset
   680
in:aView
claus
parents:
diff changeset
   681
    "return a new view as a subview of aView.
claus
parents:
diff changeset
   682
     If aView is nil, it is left unspecified, in which superview
claus
parents:
diff changeset
   683
     the new view will be placed. The view can later be assigned
claus
parents:
diff changeset
   684
     by adding it to the superview via #addSubView:.
claus
parents:
diff changeset
   685
     If realized and no superview has ever been set, it will come
claus
parents:
diff changeset
   686
     up as a topview."
claus
parents:
diff changeset
   687
claus
parents:
diff changeset
   688
    |newView|
claus
parents:
diff changeset
   689
claus
parents:
diff changeset
   690
    newView := self basicNew.
claus
parents:
diff changeset
   691
    aView notNil ifTrue:[
claus
parents:
diff changeset
   692
	newView device:(aView device).
claus
parents:
diff changeset
   693
	newView superView:aView.
claus
parents:
diff changeset
   694
    ] ifFalse:[
151
claus
parents: 145
diff changeset
   695
	newView device:Screen current "Display"
135
claus
parents:
diff changeset
   696
    ].
claus
parents:
diff changeset
   697
    newView initialize.
claus
parents:
diff changeset
   698
    aView notNil ifTrue:[aView addSubView:newView].
claus
parents:
diff changeset
   699
    ^ newView
claus
parents:
diff changeset
   700
!
claus
parents:
diff changeset
   701
140
claus
parents: 138
diff changeset
   702
label:label
claus
parents: 138
diff changeset
   703
    "create a new view with given label"
135
claus
parents:
diff changeset
   704
claus
parents:
diff changeset
   705
    ^ self origin:nil extent:nil borderWidth:nil
140
claus
parents: 138
diff changeset
   706
		      font:nil label:label in:nil
claus
parents: 138
diff changeset
   707
!
claus
parents: 138
diff changeset
   708
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   709
label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   710
    "create a new view as subview of aView with given label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   711
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   712
    ^ self origin:nil extent:nil borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   713
		      font:nil label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   714
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   715
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   716
on:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   717
    "create a new drawable on aModel"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   718
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   719
    "although this one does not know about models,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   720
     it can still send the model-assign message. This was done
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   721
     to catch obsolete calls to on:aDevice.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   722
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   723
    ^ self new model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   724
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   725
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   726
onSameDeviceAs:anotherView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   727
    "create a view on the same device as anotherView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   728
     Used with popUpMenus, which should be created on the device of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   729
     its masterView."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   730
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   731
    |device|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   732
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   733
    anotherView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   734
	device := anotherView device.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   735
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   736
	device := Screen current "Display".
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   737
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   738
    ^ self onDevice:device
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   739
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   740
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   741
origin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   742
    "create a new view with given origin and extent"
135
claus
parents:
diff changeset
   743
140
claus
parents: 138
diff changeset
   744
    ^ self origin:origin corner:corner borderWidth:nil
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   745
			 font:nil label:nil in:nil
135
claus
parents:
diff changeset
   746
!
claus
parents:
diff changeset
   747
claus
parents:
diff changeset
   748
origin:anOrigin corner:aCorner borderWidth:bw font:aFont label:aLabel in:aView
claus
parents:
diff changeset
   749
    |newView|
claus
parents:
diff changeset
   750
claus
parents:
diff changeset
   751
    aView notNil ifTrue:[
claus
parents:
diff changeset
   752
	newView := self basicNew.
claus
parents:
diff changeset
   753
	newView device:(aView device).
376
2c81dc024e73 initialize views BEFORE sending addSubView to superview
ah
parents: 372
diff changeset
   754
	newView initialize.
135
claus
parents:
diff changeset
   755
	aView addSubView:newView.
claus
parents:
diff changeset
   756
    ] ifFalse:[
151
claus
parents: 145
diff changeset
   757
	newView := self onDevice:Screen current "Display"
135
claus
parents:
diff changeset
   758
    ].
claus
parents:
diff changeset
   759
    bw notNil ifTrue:[newView borderWidth:bw].
claus
parents:
diff changeset
   760
    anOrigin notNil ifTrue:[newView origin:anOrigin].
claus
parents:
diff changeset
   761
    aCorner notNil ifTrue:[newView corner:aCorner].
claus
parents:
diff changeset
   762
    aFont notNil ifTrue:[newView font:aFont].
claus
parents:
diff changeset
   763
    aLabel notNil ifTrue:[newView label:aLabel].
claus
parents:
diff changeset
   764
    ^ newView
claus
parents:
diff changeset
   765
!
claus
parents:
diff changeset
   766
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   767
origin:origin corner:corner borderWidth:bw in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   768
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   769
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   770
    ^ self origin:origin corner:corner borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   771
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   772
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   773
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   774
origin:origin corner:corner in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   775
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   776
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   777
    ^ self origin:origin corner:corner borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   778
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   779
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   780
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   781
origin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   782
    "create a new view with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   783
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   784
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   785
			 font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   786
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   787
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   788
origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   789
    "create a new view with given origin, extent and borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   790
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   791
    ^ self origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   792
			 font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   793
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   794
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   795
origin:anOrigin extent:anExtent borderWidth:bw font:aFont label:aLabel in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   796
    |newView|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   797
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   798
    aView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   799
	newView := self basicNew.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   800
	newView device:(aView device).
376
2c81dc024e73 initialize views BEFORE sending addSubView to superview
ah
parents: 372
diff changeset
   801
	newView initialize.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   802
	aView addSubView:newView.
140
claus
parents: 138
diff changeset
   803
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   804
	newView := self onDevice:Screen current "Display"
140
claus
parents: 138
diff changeset
   805
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   806
    bw notNil ifTrue:[newView borderWidth:bw].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   807
    anExtent notNil ifTrue:[newView extent:anExtent].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   808
    anOrigin notNil ifTrue:[newView origin:anOrigin].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   809
    aFont notNil ifTrue:[newView font:aFont].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   810
    aLabel notNil ifTrue:[newView label:aLabel].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   811
    ^ newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   812
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   813
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   814
origin:origin extent:extent borderWidth:bw in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   815
    "create a new view as a subview of aView with given origin, extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   816
     and borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   817
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   818
    ^ self origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   819
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   820
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   821
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   822
origin:origin extent:extent font:aFont label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   823
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   824
			 font:nil label:label in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   825
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   826
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   827
origin:origin extent:extent font:aFont label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   828
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   829
			 font:aFont label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   830
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   831
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   832
origin:origin extent:extent in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   833
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   834
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   835
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   836
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   837
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   838
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   839
origin:origin extent:extent label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   840
    "create a new view with given origin, extent and label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   841
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   842
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   843
			 font:nil label:label in:nil
135
claus
parents:
diff changeset
   844
!
claus
parents:
diff changeset
   845
claus
parents:
diff changeset
   846
origin:anOrigin extent:anExtent
claus
parents:
diff changeset
   847
		label:aLabel icon:aForm
claus
parents:
diff changeset
   848
		minExtent:minExtent maxExtent:maxExtent
claus
parents:
diff changeset
   849
    |newView|
claus
parents:
diff changeset
   850
151
claus
parents: 145
diff changeset
   851
    newView := self onDevice:Screen current "Display".
135
claus
parents:
diff changeset
   852
    anOrigin notNil ifTrue:[newView origin:anOrigin].
claus
parents:
diff changeset
   853
    anExtent notNil ifTrue:[newView extent:anExtent].
claus
parents:
diff changeset
   854
    aLabel notNil ifTrue:[newView label:aLabel].
claus
parents:
diff changeset
   855
    aForm notNil ifTrue:[newView icon:aForm].
claus
parents:
diff changeset
   856
    minExtent notNil ifTrue:[newView minExtent:minExtent].
claus
parents:
diff changeset
   857
    maxExtent notNil ifTrue:[newView maxExtent:maxExtent].
claus
parents:
diff changeset
   858
    ^ newView
claus
parents:
diff changeset
   859
!
claus
parents:
diff changeset
   860
140
claus
parents: 138
diff changeset
   861
origin:origin in:aView
claus
parents: 138
diff changeset
   862
    "create a new view as a subview of aView with given origin"
claus
parents: 138
diff changeset
   863
claus
parents: 138
diff changeset
   864
    ^ self origin:origin extent:nil borderWidth:nil
claus
parents: 138
diff changeset
   865
			 font:nil label:nil in:aView
135
claus
parents:
diff changeset
   866
! !
claus
parents:
diff changeset
   867
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   868
!SimpleView class methodsFor:'change & update'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   869
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   870
update:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   871
    something == #Language ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   872
	"flush resources on language changes"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   873
	self flushAllClassResources
135
claus
parents:
diff changeset
   874
    ]
claus
parents:
diff changeset
   875
! !
claus
parents:
diff changeset
   876
claus
parents:
diff changeset
   877
!SimpleView class methodsFor:'defaults'!
claus
parents:
diff changeset
   878
140
claus
parents: 138
diff changeset
   879
defaultExtent
586
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
   880
    "return the default extent of my instances.
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
   881
     The value returned here is usually ignored, and
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
   882
     the value from preferredExtent taken instead."
140
claus
parents: 138
diff changeset
   883
claus
parents: 138
diff changeset
   884
    CentPoint isNil ifTrue:[CentPoint := 100 @ 100].
claus
parents: 138
diff changeset
   885
    ^ CentPoint
586
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
   886
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
   887
    "Modified: 22.4.1996 / 23:38:39 / cg"
140
claus
parents: 138
diff changeset
   888
!
claus
parents: 138
diff changeset
   889
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   890
defaultFont
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   891
    DefaultFont notNil ifTrue:[^ DefaultFont].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   892
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   893
    DefaultFont isNil ifTrue:[
467
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   894
        self == SimpleView ifFalse:[
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   895
            DefaultFont := self superclass defaultFont.
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   896
        ] ifTrue:[
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   897
"/            DefaultFont := super defaultFont
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   898
        ].
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   899
    ].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   900
    DefaultFont notNil ifTrue:[DefaultFont := DefaultFont on:Display].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   901
    ^ DefaultFont
467
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   902
badc7ab65a2d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   903
    "Modified: 27.2.1996 / 02:20:54 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   904
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   905
450
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   906
defaultFont:aFont
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   907
    "set the default font used for drawing"
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   908
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   909
    DefaultFont := aFont.
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   910
    aFont notNil ifTrue:[
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   911
        DefaultFont := aFont on:Display
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   912
    ]
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   913
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   914
    "Modified: 18.3.1996 / 12:56:20 / cg"
450
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   915
!
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   916
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   917
defaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   918
    "return the default view style"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   919
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   920
    ^ DefaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   921
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   922
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   923
     View defaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   924
    "
135
claus
parents:
diff changeset
   925
!
claus
parents:
diff changeset
   926
claus
parents:
diff changeset
   927
defaultStyle:aStyle
claus
parents:
diff changeset
   928
    "set the view style for new views"
claus
parents:
diff changeset
   929
180
claus
parents: 176
diff changeset
   930
"/    aStyle ~~ DefaultStyle ifTrue:[
135
claus
parents:
diff changeset
   931
	DefaultStyle := aStyle.
claus
parents:
diff changeset
   932
	self updateAllStyleCaches.
180
claus
parents: 176
diff changeset
   933
"/    ]
135
claus
parents:
diff changeset
   934
claus
parents:
diff changeset
   935
    "
claus
parents:
diff changeset
   936
     View defaultStyle:#next. SystemBrowser start
claus
parents:
diff changeset
   937
     View defaultStyle:#motif. SystemBrowser start
claus
parents:
diff changeset
   938
     View defaultStyle:#iris. SystemBrowser start
claus
parents:
diff changeset
   939
     View defaultStyle:#st80. SystemBrowser start
claus
parents:
diff changeset
   940
     View defaultStyle:#normal. SystemBrowser start
claus
parents:
diff changeset
   941
    "
claus
parents:
diff changeset
   942
!
claus
parents:
diff changeset
   943
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   944
returnFocusWhenClosingModalBoxes
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   945
    "return the current focus-return behavior.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   946
     See #returnFocusWhenClosingModalBoxes: for a description."
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   947
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   948
    ^ ReturnFocusWhenClosingModalBoxes
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   949
!
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   950
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   951
returnFocusWhenClosingModalBoxes:aBoolean
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   952
    "control the keyboard-focus behavior when a modal dialog
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   953
     is closed. The default (true) is to return the focus to the view
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   954
     which was active when the dialog was opened.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   955
     If false, it is left up to the display to set the focus.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   956
     For owm / ovwm (which requires an explicit click for the focus),
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   957
     it is better to return the focus automatically.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   958
     For managers which assign the focus according the pointer position,
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   959
     it may be better to turn the focus-return off.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   960
     You should add a corresponding expression into your private.rc or 
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   961
     display.rc file."
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   962
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   963
    ReturnFocusWhenClosingModalBoxes := aBoolean
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   964
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   965
    "
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   966
     Dialog returnFocusWhenClosingModalBoxes:false
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   967
     Dialog returnFocusWhenClosingModalBoxes:true
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   968
    "
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   969
!
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   970
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   971
styleSheet:aViewStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   972
    "set the view style from a style-sheet"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   973
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   974
    StyleSheet := aViewStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   975
    DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   976
    self updateAllStyleCaches.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   977
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   978
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   979
updateAllStyleCaches
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   980
    "reload all style caches in all view classes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   981
     Needed after a style change or when a style file has been changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   982
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   983
    StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   984
    StyleSheet fileReadFailed ifTrue:[
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   985
        ('***** WARNING: no styleSheet for ' , DefaultStyle , '-style.') errorPrintNL.
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   986
        DefaultStyle ~~ #normal ifTrue:[
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   987
            DefaultStyle := #normal.
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   988
            StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   989
        
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   990
            StyleSheet fileReadFailed ifTrue:[
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   991
                '***** WARNING: not even a styleSheet for normal-style (using defaults).' errorPrintNL.
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   992
            ]
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   993
        ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   994
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   995
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   996
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   997
     tell all view classes to flush any
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   998
     cached style-data
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   999
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1000
    self changed:#style.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1001
    SimpleView updateStyleCache.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1002
    SimpleView allSubclassesDo:[:aClass |
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1003
        aClass defaultFont:nil.
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1004
        (aClass class implements:#updateStyleCache) ifTrue:[
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1005
            aClass updateStyleCache
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1006
        ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1007
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1008
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1009
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1010
     View updateAllStyleCaches
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1011
    "
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1012
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1013
    "Modified: 18.3.1996 / 12:56:26 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1014
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1015
135
claus
parents:
diff changeset
  1016
updateStyleCache
claus
parents:
diff changeset
  1017
    "this method gets some heavily used style stuff and keeps
claus
parents:
diff changeset
  1018
     it in class-variables for faster access.
claus
parents:
diff changeset
  1019
     Subclasses should redefine this to load any cached style-values
claus
parents:
diff changeset
  1020
     into faster class variables as well. These should NOT do a 
claus
parents:
diff changeset
  1021
     super updateStyleCache, since this method is called for all view-classes
claus
parents:
diff changeset
  1022
     anyway."
claus
parents:
diff changeset
  1023
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1024
    <resource: #style (#viewSpacing #font #borderWidth
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1025
                       #viewBackground #shadowColor #lightColor
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1026
                       #focusColor #focusBorderWidth)>
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1027
135
claus
parents:
diff changeset
  1028
    |bgGrey|
claus
parents:
diff changeset
  1029
claus
parents:
diff changeset
  1030
    "
claus
parents:
diff changeset
  1031
     when coming here the first time, we read the styleSheet
claus
parents:
diff changeset
  1032
     and keep the values in fast class variables
claus
parents:
diff changeset
  1033
    "
claus
parents:
diff changeset
  1034
    StyleSheet isNil ifTrue:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1035
        DefaultStyle := #normal.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1036
        StyleSheet := ViewStyle fromFile:'normal.style'.
135
claus
parents:
diff changeset
  1037
    ].
claus
parents:
diff changeset
  1038
claus
parents:
diff changeset
  1039
    Grey := StyleSheet viewGrey.
claus
parents:
diff changeset
  1040
    Grey isNil ifTrue:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1041
        Grey := Color grey
135
claus
parents:
diff changeset
  1042
    ].
claus
parents:
diff changeset
  1043
    Grey := Grey on:Display.
claus
parents:
diff changeset
  1044
151
claus
parents: 145
diff changeset
  1045
    StyleSheet fileReadFailed ifTrue:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1046
        bgGrey := White
135
claus
parents:
diff changeset
  1047
    ] ifFalse:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1048
        Display hasGreyscales ifTrue:[
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1049
            bgGrey := Grey
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1050
        ] ifFalse:[
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1051
            bgGrey := White 
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1052
        ]
135
claus
parents:
diff changeset
  1053
    ].
151
claus
parents: 145
diff changeset
  1054
    bgGrey := bgGrey on:Display.
135
claus
parents:
diff changeset
  1055
claus
parents:
diff changeset
  1056
    ViewSpacing := StyleSheet at:'viewSpacing'.
claus
parents:
diff changeset
  1057
    ViewSpacing isNil ifTrue:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1058
        ViewSpacing := Display verticalPixelPerMillimeter rounded.
135
claus
parents:
diff changeset
  1059
    ].
claus
parents:
diff changeset
  1060
claus
parents:
diff changeset
  1061
    DefaultBorderColor := StyleSheet colorAt:'borderColor' default:Black.
151
claus
parents: 145
diff changeset
  1062
claus
parents: 145
diff changeset
  1063
    StyleSheet fileReadFailed ifTrue:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1064
        DefaultBorderWidth := 1.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1065
        DefaultShadowColor := Black.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1066
        DefaultLightColor :=  White.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1067
        DefaultFocusColor := Black.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1068
        DefaultFocusBorderWidth := 2.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1069
        DefaultViewBackgroundColor := bgGrey.
151
claus
parents: 145
diff changeset
  1070
    ] ifFalse:[
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1071
        DefaultBorderWidth := StyleSheet at:'borderWidth' default:0.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1072
        DefaultViewBackgroundColor := StyleSheet colorAt:'viewBackground' default:bgGrey.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1073
        DefaultShadowColor := StyleSheet colorAt:'shadowColor'.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1074
        DefaultLightColor := StyleSheet colorAt:'lightColor'.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1075
        DefaultFocusColor := StyleSheet colorAt:'focusColor' default:Color red.
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1076
        DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
151
claus
parents: 145
diff changeset
  1077
    ].
135
claus
parents:
diff changeset
  1078
526
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1079
    self == SimpleView ifTrue:[
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1080
        DefaultFont := StyleSheet at:'font'.
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1081
        DefaultFont isNil ifTrue:[
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1082
            DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1083
        ].
3ba5c3844c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  1084
        DefaultFont := DefaultFont on:Display.
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1085
    ] ifFalse:[
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1086
        DefaultFont := nil
135
claus
parents:
diff changeset
  1087
    ].
claus
parents:
diff changeset
  1088
claus
parents:
diff changeset
  1089
    DefaultViewBackgroundColor isNil ifTrue:[
517
ffc3316a7d3b nicer message
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
  1090
        'VIEW: bad viewBackground in style - using white' errorPrintNL.
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1091
        DefaultViewBackgroundColor := White
135
claus
parents:
diff changeset
  1092
    ].
484
7c8dd17a160e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1093
527
743c5f8b932e defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1094
    "Modified: 18.3.1996 / 12:52:12 / cg"
135
claus
parents:
diff changeset
  1095
!
claus
parents:
diff changeset
  1096
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1097
viewSpacing
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1098
    "return a convenient number of pixels used to separate views (usually 1mm).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1099
     Having this value here at a common place makes certain that all views
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1100
     get a common look"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1101
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1102
    ^ ViewSpacing
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1103
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1104
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1105
!SimpleView class methodsFor:'resources'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1106
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1107
classResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1108
    "if not already loaded, get the classes resourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1109
     and return it"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1110
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1111
    ClassResources isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1112
	ClassResources := ResourcePack for:self.
140
claus
parents: 138
diff changeset
  1113
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1114
    ^ ClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1115
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1116
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1117
classResources:aResourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1118
    "allow setting of the classResources"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1120
    ClassResources := aResourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1121
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1122
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1123
flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1124
    "flush all classes resource translations.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1125
     Needed after a resource file has changed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1126
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1127
    ResourcePack flushCachedResourcePacks.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1128
    SimpleView flushClassResources.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1129
    SimpleView allSubclasses do:[:aClass |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1130
	aClass flushClassResources.
140
claus
parents: 138
diff changeset
  1131
    ]
claus
parents: 138
diff changeset
  1132
claus
parents: 138
diff changeset
  1133
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1134
     View flushAllClassResources
140
claus
parents: 138
diff changeset
  1135
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1136
    "to change the language:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1137
	Language := #english.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1138
	Smalltalk changed:#Language.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1139
	View flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1140
     or:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1141
	Language := #german.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1142
	Smalltalk changed:#Language.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1143
	View flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1144
    "     
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1145
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1146
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1147
flushClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1148
    "flush classes resource string translations.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1149
     Needed whenever a resource file or language has changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1150
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1151
    ClassResources := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1152
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1153
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1154
updateClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1155
    "flush classes resource string translations and reload them.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1156
     Needed whenever a resource file or language has changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1157
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1158
    ClassResources := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1159
    self classResources
135
claus
parents:
diff changeset
  1160
! !
claus
parents:
diff changeset
  1161
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1162
!SimpleView methodsFor:'ST-80 compatibility'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1163
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1164
checkForEvents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1165
    (shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1166
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1167
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1168
sensor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1169
    "return the views sensor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1170
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1171
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1172
	^ windowGroup sensor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1173
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1174
    ^ nil
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1175
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1176
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1177
viewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1178
    "return my viewport.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1179
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1180
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1181
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1182
    ^ viewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1183
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1184
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1185
viewport:aRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1186
    "define my extend in my superviews coordinate-system.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1187
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1188
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1189
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1190
    viewport := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1191
    self dimensionFromViewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1192
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1193
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1194
window
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1195
    "return my window (i.e. logical coordinate space).
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1196
     If there is no window, return the extent.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1197
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1198
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1199
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1200
    window isNil ifTrue:[^ width @ height].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1201
    ^ window
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1202
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1203
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1204
window:aRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1205
    "define my window (i.e. logical coordinate space).
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1206
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1207
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1208
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1209
    window := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1210
    subViews notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1211
	subViews do:[:s |
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1212
	    s superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1213
	]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1214
    ]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1215
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1216
"/    viewport isNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1217
"/        viewport := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1218
"/    ].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1219
"/    superView notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1220
"/        self superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1221
"/    ] ifFalse:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1222
"/        originChanged := true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1223
"/        extentChanged := true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1224
"/    ]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1225
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1226
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1227
window:aRectangle viewport:vRect
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1228
    "set the window and viewport.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1229
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1230
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1231
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1232
    window := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1233
    self viewport:vRect.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1234
    subViews notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1235
	subViews do:[:s |
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1236
	    s superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1237
	]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1238
    ]
151
claus
parents: 145
diff changeset
  1239
! !
claus
parents: 145
diff changeset
  1240
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1241
!SimpleView methodsFor:'accessing-bg & border'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1242
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1243
borderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1244
    "return my borderColor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1245
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1246
    ^ borderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1247
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1248
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1249
borderColor:aColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1250
    "set my borderColor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1251
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1252
    (aColor ~~ borderColor) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1253
	borderColor := aColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1254
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1255
	    self setBorderColor
135
claus
parents:
diff changeset
  1256
	]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1257
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1258
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1259
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1260
borderShape:aForm
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1261
    "set the borderShape to aForm"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1262
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1263
    borderShape := aForm.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1264
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1265
	device setWindowBorderShape:(aForm id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1266
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1267
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1268
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1269
borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1270
    "return my borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1271
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1272
    ^ borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1273
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1274
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1275
borderWidth:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1276
    "set my borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1277
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1278
    (aNumber ~~ borderWidth) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1279
	borderWidth := aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1280
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1281
	    device setWindowBorderWidth:aNumber in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1282
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1283
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1284
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1285
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1286
level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1287
    "return my level relative to superView (3D)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1288
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1289
    ^ level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1290
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1291
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1292
level:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1293
    "set my level relative to superView (3D)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1294
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1295
    |oldMargin how|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1296
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1297
    (aNumber ~~ level and:[aNumber notNil]) ifTrue:[
433
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1298
        self is3D ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1299
            level := aNumber.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1300
            oldMargin := margin.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1301
            margin := level abs.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1302
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1303
            realized ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1304
                margin ~~ oldMargin ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1305
                    (margin > oldMargin) ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1306
                        how := #smaller
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1307
                    ] ifFalse:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1308
                        how := #larger
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1309
                    ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1310
                    self sizeChanged:how.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1311
                    self setInnerClip.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1312
                ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1313
                shown ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1314
                    margin ~~ oldMargin ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1315
                        self clear.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1316
                        self redrawX:margin y:margin
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1317
                               width:width-(margin*2) 
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1318
                              height:height-(margin*2)
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1319
                    ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1320
                    self redrawEdges.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1321
               ]
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1322
            ]
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1323
        ]
135
claus
parents:
diff changeset
  1324
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1325
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1326
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1327
lightColor:aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1328
    "set the color to be used for lighted edges (3D only)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1329
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1330
    lightColor := aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1331
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1332
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1333
margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1334
    "return my margin - this is usually the level,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1335
     but can be more for some views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1336
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1337
    ^ margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1338
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1339
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1340
shadowColor:aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1341
    "set the color to be used for shadowed edges (3D only)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1342
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1343
    shadowColor := aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1344
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1345
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1346
viewBackground:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1347
    "set the viewBackground to something, a color, image or form.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1348
     If its a color and we run on a color display, also set shadow and light
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1349
     colors - this means, that a red view will get light-red and dark-red
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1350
     edges."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1351
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1352
    something isColor ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1353
	device hasGreyscales ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1354
	    shadowColor := something darkened.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1355
	    lightColor := something lightened
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1356
	]
135
claus
parents:
diff changeset
  1357
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1358
    super viewBackground:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1359
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1360
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1361
viewShape:aForm
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1362
    "set the viewShape to aForm"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1363
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1364
    viewShape := aForm.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1365
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1366
	device setWindowShape:(aForm id) in:drawableId
135
claus
parents:
diff changeset
  1367
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1368
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1369
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1370
!SimpleView methodsFor:'accessing-contents'!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1371
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1372
heightOfContents
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1373
    "return the height of the contents in logical units 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1374
     - defaults to views visible area here.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1375
    This method MUST be redefined in all view classess which are
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1376
    going to be scrolled AND show data which has different size than
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1377
    the view. For example, a view showing A4-size documents should return
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1378
    the number of vertical pixels such a document has on this device.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1379
    A view showing a bitmap of height 1000 should return 1000.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1380
    If not redefined, scrollbars have no way of knowing the actual size
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1381
    of the contents being shown. This is called by scrollBars to compute
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1382
    the relative height of the document vs. the views actual size.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1383
    The value returned here must be based on a scale of 1, since users
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1384
    of this will scale as appropriate."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1385
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1386
    ^ self innerHeight max:(self maxSubViewBottom)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1387
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1388
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1389
widthOfContents
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1390
    "return the width of the contents in logical units 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1391
     - defaults to views visible area here.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1392
    This method MUST be redefined in all view classess which are
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1393
    going to be scrolled AND show data which has different size than
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1394
    the view. For example, a view showing A4-size documents should return
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1395
    the number of horizontal pixels such a document has on this device.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1396
    A view showing a bitmap of width 500 should return 500.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1397
    If not redefined, scrollbars have no way of knowing the actual size
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1398
    of the contents being shown. This is called by scrollBars to compute
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1399
    the relative width of the document vs. the views actual width.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1400
    The value returned here must be based on a scale of 1, since users
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1401
    of this will scale as appropriate."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1402
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1403
    ^ self innerWidth max:(self maxSubViewRight)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1404
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1405
    "Modified: 8.2.1996 / 20:01:50 / cg"
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  1406
! !
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1407
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1408
!SimpleView methodsFor:'accessing-dimensions'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1409
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1410
allInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1411
    "set all insets; positive makes the view smaller,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1412
     negative makes it larger."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1413
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1414
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1415
	insets := Array new:4.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1416
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1417
    insets atAllPut:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1418
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1419
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1420
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1421
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1422
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1423
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1424
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1425
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1426
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1427
bottom
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1428
    "return the y position of the actual bottom edge (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1429
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1430
    ^ top + height - 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1431
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1432
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1433
bottom:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1434
    "set the corners y position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1435
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1436
    self corner:(self corner x @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1437
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1438
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1439
bottomInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1440
    "return the inset of the bottom edge; positive is to the top,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1441
     negative to the bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1442
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1443
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1444
    ^ insets at:4
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1445
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1446
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1447
bottomInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1448
    "set the inset of the bottom edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1449
     positive is to the top (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1450
     negative to the bottom (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1451
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1452
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1453
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1454
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1455
    insets at:4 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1456
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1457
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1458
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1459
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1460
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1461
	self superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1462
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1463
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1464
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1465
center
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1466
    "return the point at the center of the receiver (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1467
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1468
    ^ (left + (width // 2)) @ (top + (height // 2))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1469
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1470
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1471
center:newCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1472
    "move the receiver so that newCenter, aPoint becomes the center point"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1473
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1474
    self origin:(newCenter - ((width // 2) @ (height // 2)))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1475
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1476
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1477
computeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1478
    "compute my corner; if I have a layoutObject,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1479
     relative origins or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1480
     Blocks may return relative values or nil; nil means: take current value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1481
     Returns the corner point in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1482
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1483
    |org newCorner newExt x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1484
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1485
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1486
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1487
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1488
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1489
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1490
			    preferred:(self preferredBounds)) corner rounded
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1491
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1492
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1493
    (cornerRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1494
	newCorner := cornerRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1495
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1496
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1497
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1498
	x := newCorner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1499
	y := newCorner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1500
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1501
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1502
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1503
	    newCorner := self cornerFromRelativeCorner:x@y 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1504
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1505
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1506
	(relativeCorner notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1507
	    newCorner := self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1508
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1509
	    org := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1510
	    (extentRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1511
		newExt := extentRule value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1512
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1513
		(relativeExtent notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1514
		    newExt := self extentFromRelativeExtent:relativeExtent 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1515
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1516
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1517
	    newCorner := org + newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1518
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1519
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1520
    ^ newCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1521
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1522
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1523
computeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1524
    "compute my extent; if I have a layoutObject, a relative extent 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1525
     or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1526
     There is one catch here, if the dimension was defined
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1527
     by origin/corner, compute them here and take that value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1528
     I.e. origin/corner definition has precedence over extent definition.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1529
     Returns the extent in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1530
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1531
    |newOrg newExt newCorner x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1532
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1533
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1534
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1535
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1536
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1537
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1538
			    preferred:(self preferredBounds)) extent rounded
135
claus
parents:
diff changeset
  1539
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1540
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1541
    (cornerRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1542
	newCorner := cornerRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1543
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1544
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1545
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1546
	x := newCorner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1547
	y := newCorner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1548
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1549
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1550
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1551
	    newCorner := self cornerFromRelativeCorner:x@y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1552
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1553
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1554
	(relativeCorner notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1555
	    newCorner := self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1556
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1557
	    (extentRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1558
		newExt := extentRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1559
		"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1560
		 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1561
		"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1562
		x := newExt x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1563
		y := newExt y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1564
		x isNil ifTrue:[x := width].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1565
		y isNil ifTrue:[y := height].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1566
		((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1567
		    newExt := self extentFromRelativeExtent:x@y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1568
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1569
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1570
		(relativeExtent notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1571
		    newExt := self extentFromRelativeExtent:relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1572
		] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1573
		    newExt := (width @ height).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1574
		].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1575
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1576
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1577
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1578
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1579
    newCorner notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1580
	newOrg := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1581
	^ newCorner - newOrg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1582
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1583
    ^ newExt.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1584
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1585
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1586
computeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1587
    "compute my origin; if I have a layoutObject, a relative origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1588
     or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1589
     Blocks may return relative values or nil; nil means: take current value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1590
     Returns the origin point in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1591
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1592
    |newOrg x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1593
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1594
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1595
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1596
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1597
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1598
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1599
			    preferred:(self preferredBounds)) origin rounded
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1600
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1601
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1602
    (originRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1603
	newOrg := originRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1604
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1605
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1606
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1607
	x := newOrg x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1608
	y := newOrg y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1609
	x isNil ifTrue:[x := self origin x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1610
	y isNil ifTrue:[y := self origin y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1611
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1612
	    newOrg := self originFromRelativeOrigin:x@y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1613
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1614
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1615
	(relativeOrigin notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1616
	    newOrg := self originFromRelativeOrigin:relativeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1617
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1618
	    ^ (left @ top).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1619
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1620
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1621
    ^ newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1622
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1623
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1624
corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1625
    "return the lower right corner-point (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1626
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1627
"/    ^ (left + width "- 1") @ (top + height "- 1")
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1628
    ^ (left + width - 1) @ (top + height - 1)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1629
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1630
    "Modified: 31.8.1995 / 16:51:40 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1631
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1632
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1633
corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1634
    "set the views corner; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1635
     the corner argument may be:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1636
	 a point 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1637
	    where integer fields mean 'pixel-values'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1638
	    and float values mean 'relative-to-superview'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1639
	    and nil means 'take current value';
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1640
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1641
     Please migrate to use layoutObjects, if possible."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1642
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1643
    |x y pixelCorner c|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1644
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1645
    corner isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1646
	cornerRule := corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1647
	drawableId notNil ifTrue:[    
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1648
	    pixelCorner := corner value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1649
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1650
	    extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1651
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1652
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1653
	x := corner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1654
	y := corner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1655
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1656
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1657
	c := x @ y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1658
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1659
	    relativeCorner := c.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1660
	    pixelCorner := self cornerFromRelativeCorner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1661
	    pixelCorner isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1662
		extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1663
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1664
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1665
	    pixelCorner := c
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1666
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1667
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1668
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1669
    pixelCorner notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1670
	self pixelCorner:pixelCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1671
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1672
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1673
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1674
extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1675
    "set the views extent; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1676
     extent may be:
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1677
        a point 
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1678
            where integer fields mean 'pixel-values'
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1679
            and float values mean 'relative-to-superview'
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1680
            and nil means 'leave current value';
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1681
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1682
     Be careful when using relative extents: rounding errors may
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1683
     accumulate. Better use origin/corner. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1684
     Best: migrate to use layour objects."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1685
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1686
    |w h pixelExtent e|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1687
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1688
    extent isBlock ifTrue:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1689
        extentRule := extent.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1690
        drawableId notNil ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1691
            pixelExtent := extent value
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1692
        ] ifFalse:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1693
            extentChanged := true
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1694
        ]
135
claus
parents:
diff changeset
  1695
    ] ifFalse:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1696
        w := extent x.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1697
        h := extent y.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1698
        w isNil ifTrue:[w := width].
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1699
        h isNil ifTrue:[h := height].
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1700
        e := w@h.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1701
        ((w isInteger not) or:[h isInteger not]) ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1702
            relativeExtent := e.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1703
            pixelExtent := self extentFromRelativeExtent.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1704
            pixelExtent isNil ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1705
                extentChanged := true
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1706
            ]
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1707
        ] ifFalse:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1708
            relativeExtent := nil.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1709
            pixelExtent := e
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1710
        ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1711
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1712
    pixelExtent notNil ifTrue:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1713
        self pixelExtent:pixelExtent
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1714
    ]
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1715
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1716
    "Modified: 19.4.1996 / 15:11:15 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1717
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1718
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1719
geometryLayout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1720
    "this method will vanish, as soon as all implementations of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1721
     #layout: are removed ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1722
     (conflict for example in label>>layout:).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1723
     DO NOT USE #geometryLayout: in your code; it will be removed without
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1724
     notice."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1725
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1726
    ^ here layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1727
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1728
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1729
geometryLayout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1730
    "this method will vanish, as soon as all implementations of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1731
     #layout: are removed ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1732
     (conflict for example in label>>layout:).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1733
     DO NOT USE #geometryLayout: in your code; it will be removed without
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1734
     notice."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1735
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1736
    here layout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1737
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1738
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1739
height:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1740
    "set the views height in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1741
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1742
    self extent:(width @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1743
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1744
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1745
heightIncludingBorder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1746
    "return my height including border 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1747
     (this is my height as seen from the outside view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1748
      while #height returns the height as seen by myself)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1749
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1750
    ^ height + (2*borderWidth)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1751
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1752
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1753
horizontalInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1754
    "set the insets of the left/right edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1755
     positive makes it smaller, negative makes it larger"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1756
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1757
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1758
	insets := Array with:0 with:0 with:0 with:0
135
claus
parents:
diff changeset
  1759
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1760
    insets at:1 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1761
    insets at:3 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1762
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1763
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1764
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1765
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1766
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1767
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1768
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1769
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1770
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1771
innerHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1772
    "return the height of the view minus any 3D-shadow-borders"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1773
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1774
    (margin == 0) ifTrue:[^ height].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1775
    ^ height - (2 * margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1776
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1777
369
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1778
innerHeight:pixels
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1779
    "set the height of the view plus any 3D-shadow-borders.
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1780
     This does not work with a relative size."
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1781
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1782
    ^ self height:( pixels + (margin + self innerVerticalMargin * 2) ).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1783
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1784
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1785
innerHorizontalMargin
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1786
    "return any additional inner margin (i.e. contents margin).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1787
     This should be redefined by views which do add margins
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1788
     (for example: textViews do this)"
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1789
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1790
    ^ 0
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1791
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1792
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1793
innerVerticalMargin
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1794
    "return any additional inner margin (i.e. contents margin).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1795
     This should be redefined by views which do add margins
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1796
     (for example: textViews do this)"
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1797
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1798
    ^ 0
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1799
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1800
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1801
innerWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1802
    "return the width of the view minus any 3D-shadow-borders"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1803
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1804
    (level == 0) ifTrue:[^ width].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1805
    ^ width - (2 * margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1806
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1807
369
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1808
innerWidth:pixels
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1809
    "set the width of the view plus any 3D-shadow-borders.
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1810
     This does not work with a relative size."
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1811
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1812
    ^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1813
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1814
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1815
inset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1816
    "set all insets; positive makes the view smaller,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1817
     negative makes it larger."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1818
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1819
    self allInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1820
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1821
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1822
layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1823
    "return the layout object which controls my geometry.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1824
     Currently, this is nil in most cases, and my geometry is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1825
     defined by relativeOrigin/relativeCorner/relativeExtent,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1826
     originRule/extentRule/cornerRule and inset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1827
     Applications should be changed to use layoutObjects,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1828
     since the above listed instance variables will vanish."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1829
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1830
    ^ layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1831
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1832
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1833
layout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1834
    "set the layout object which controls my geometry.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1835
     Currently, this is almost nowhere used but views will be
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1836
     incrementally changed to use this new geometry management."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1837
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1838
    layout := aLayoutObject.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1839
    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1840
	originChanged := cornerChanged := extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1841
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1842
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1843
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1844
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1845
    "Modified: 19.9.1995 / 16:17:25 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1846
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1847
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1848
left
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1849
    "return the x position of the left border (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1850
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1851
    ^ left
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1852
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1853
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1854
left:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1855
    "set the x position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1856
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1857
    self origin:(aNumber @ top)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1858
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1859
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1860
left:newLeft top:newTop width:newWidth height:newHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1861
    "another way of specifying origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1862
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1863
    self origin:(newLeft @ newTop) extent:(newWidth @ newHeight)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1864
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1865
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1866
leftInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1867
    "return the inset of the left edge; positive is to the right,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1868
     negative to the left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1869
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1870
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1871
    ^ insets at:1 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1872
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1873
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1874
leftInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1875
    "set the inset of the left edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1876
     positive is to the right (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1877
     negative to the left (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1878
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1879
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1880
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1881
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1882
    insets at:1 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1883
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1884
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1885
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1886
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1887
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1888
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1889
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1890
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1891
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1892
makeFullyVisible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1893
    "make sure, that the view is fully visible by shifting it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1894
     into the visible screen area if nescessary.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1895
     This method will be moved to StandardSystemView ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1896
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1897
    |devBot devRight newTop newLeft|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1898
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1899
    newTop := top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1900
    newLeft := left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1901
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1902
    ((top + height) > (devBot := device height)) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1903
	newTop := devBot - height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1904
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1905
    ((left + width) > (devRight := device width)) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1906
	newLeft := devRight - width
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1907
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1908
    (newTop < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1909
	newTop := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1910
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1911
    (newLeft < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1912
	newLeft := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1913
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1914
    ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1915
	self origin:newLeft @ newTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1916
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1917
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1918
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1919
origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1920
    "return the origin (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1921
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1922
    ^ left@top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1923
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1924
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1925
origin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1926
    "set the views origin; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1927
     origin may be:
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1928
        a point 
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1929
            where integer fields mean 'pixel-values'
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1930
            and float values mean 'relative-to-superview'
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1931
            and nil means 'take current value';
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1932
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1933
     Please migrate to use layout objects."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1934
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1935
    |newLeft newTop pixelOrigin o|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1937
    origin isBlock ifTrue:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1938
        originRule := origin.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1939
        drawableId notNil ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1940
            pixelOrigin := origin value
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1941
        ] ifFalse:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1942
            originChanged := true
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1943
        ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1944
    ] ifFalse:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1945
        o := origin.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1946
        newLeft := origin x.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1947
        newTop := origin y.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1948
        newLeft isNil ifTrue:[newLeft := left].
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1949
        newTop isNil ifTrue:[newTop := top].
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1950
        o := newLeft @ newTop.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1951
        ((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1952
            relativeOrigin := o.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1953
            pixelOrigin := self originFromRelativeOrigin.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1954
            pixelOrigin isNil ifTrue:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1955
                originChanged := true
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1956
            ]
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1957
        ] ifFalse:[
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1958
            relativeOrigin := nil.
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1959
            pixelOrigin := o
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1960
        ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1961
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1962
    pixelOrigin notNil ifTrue:[
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1963
        self pixelOrigin:pixelOrigin
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1964
    ].
573
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1965
578ae7a2f7fa clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
  1966
    "Modified: 19.4.1996 / 15:12:36 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1967
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1968
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1969
origin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1970
    "set both origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1971
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1972
    |newLeft newTop newRight newBot|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1973
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1974
    "do it as one operation if possible"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1975
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1976
    origin isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1977
	corner isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1978
	    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1979
	    newLeft isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1980
		newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1981
		newTop isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1982
		    newRight := corner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1983
		    newRight isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1984
			newBot := corner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1985
			newBot isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1986
			    self pixelOrigin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1987
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1988
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1989
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1990
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1991
	]
135
claus
parents:
diff changeset
  1992
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1993
    self origin:origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1994
    self corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1995
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1996
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1997
origin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1998
    "set both origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1999
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2000
    |newLeft newTop newWidth newHeight|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2001
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2002
    "do it as one operation if possible"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2003
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2004
    origin isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2005
	extent isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2006
	    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2007
	    newLeft isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2008
		newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2009
		newTop isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2010
		    newWidth := extent x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2011
		    newWidth isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2012
			newHeight := extent y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2013
			newHeight isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2014
			    self pixelOrigin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2015
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2016
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2017
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2018
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2019
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2020
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2021
    self extent:extent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2022
    self origin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2023
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2024
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2025
originRelativeTo:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2026
    "return the origin (in pixels) relative to a superView,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2027
     or relative to the rootView (if the aView argument is nil).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2028
     If the receiver is nonNil and not a subview of aView, return nil."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2029
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2030
    |currentView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2031
     org  "{ Class: Point }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2032
     sumX "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2033
     sumY "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2034
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2035
    currentView := self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2036
    sumX := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2037
    sumY := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2038
    [currentView notNil] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2039
	(currentView == aView) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2040
	    ^ (sumX @ sumY)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2041
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2042
	org := currentView origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2043
	sumX := sumX + org x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2044
	sumY := sumY + org y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2045
	currentView := currentView superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2046
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2047
    (aView isNil or:[aView == RootView]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2048
	"return relative to screen ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2049
	^ (sumX @ sumY)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2050
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2051
    ^ nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2052
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2053
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2054
     |top sub1 sub2|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2055
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2056
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2057
     top extent:200@200.   
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2058
     sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2059
     sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2060
     top openAndWait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2061
     Transcript show:'button in top:'; showCr:(sub2 originRelativeTo:top).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2062
     Transcript show:'button on screen:'; showCr:(sub2 originRelativeTo:nil).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2063
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2064
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2065
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2066
relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2067
    "return the relative corner or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2068
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2069
    ^ relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2070
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2071
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2072
relativeCorner:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2073
    "set the relative corner"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2074
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2075
    relativeCorner := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2076
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2077
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2078
relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2079
    "return the relative extent or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2080
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2081
    ^ relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2082
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2083
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2084
relativeExtent:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2085
    "set the relative extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2086
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2087
    relativeExtent := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2088
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2089
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2090
relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2091
    "return the relative origin or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2092
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2093
    ^ relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2094
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2095
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2096
relativeOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2097
    "set the relative origin"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2098
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2099
    relativeOrigin := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2100
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2101
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2102
right
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2103
    "return the x position of the right edge  (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2104
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2105
    ^ left + width - 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2106
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2107
    "Modified: 31.8.1995 / 19:31:10 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2108
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2109
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2110
right:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2111
    "set the corners x position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2112
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2113
    self corner:(aNumber @ self corner y)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2114
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2115
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2116
rightInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2117
    "return the inset of the right edge; positive is to the left,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2118
     negative to the right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2120
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2121
    ^ insets at:3 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2122
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2123
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2124
rightInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2125
    "set the inset of the right edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2126
     positive is to the left (view becomes smaller), 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2127
     negative to the right (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2128
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2129
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2130
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2131
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2132
    insets at:3 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2133
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2134
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2135
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2136
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2137
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2138
	self superViewChangedSize.
135
claus
parents:
diff changeset
  2139
"/    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2140
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2141
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2142
sizeFixed:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2143
    "set/clear the fix-size attribute, if supported by concrete subclasses.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2144
     Views which want to resize themselfes as appropriate to their contents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2145
     should cease to do so and take their current size if sizeFixed is set to
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2146
     true. Currently, only supported by Labels.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2147
     This does NOT prevent the window manager from resizing the view, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2148
     instead it tell the view to NOT resize ITSELF.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2149
     Added here to provide a common protocol for all views."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2150
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2151
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2152
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2153
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2154
top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2155
    "return the y position of the top border"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2156
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2157
    ^ top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2158
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2159
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2160
top:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2161
    "set the y position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2162
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2163
    self origin:(left @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2164
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2165
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2166
topInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2167
    "return the inset of the top edge; positive is to the bottom,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2168
     negative to the top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2169
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2170
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2171
    ^ insets at:2 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2172
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2173
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2174
topInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2175
    "set the inset of the top edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2176
     positive is to the bottom (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2177
     negative to the top (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2178
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2179
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2180
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2181
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2182
    insets at:2 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2183
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2184
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2185
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2186
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2187
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2188
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2189
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2190
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2191
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2192
verticalInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2193
    "set the insets of the top/bottom edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2194
     positive makes it smaller, negative makes it larger"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2195
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2196
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2197
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2198
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2199
    insets at:2 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2200
    insets at:4 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2201
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2202
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2203
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2204
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2205
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2206
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2207
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2208
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2209
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2210
viewRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2211
    "return the inside area.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2212
     This is used by relative sized subviews and layout-computations
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2213
     to base relative coordinates on.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2214
     For most views, the value returned here (actual extent minus any
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2215
     margins required for 3D levels) is ok.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2216
     However, views which want some extra area around (for example: FramedBox)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2217
     may redefine this method to return a rectangle without this area
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2218
     (thus, a relative sized subviews coordinates will be based on this net area) "
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2219
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2220
    |m2|
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2221
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2222
    m2 := margin + margin.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2223
    ^ (margin @ margin) extent:((width - m2) @ (height - m2))
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2224
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2225
    "Modified: 8.2.1996 / 20:05:00 / cg"
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2226
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2227
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2228
width:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2229
    "set the views width in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2230
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2231
    self extent:(aNumber @ height)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2232
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2233
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2234
widthIncludingBorder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2235
    "return my width including border
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2236
     (this is my width as seen from the outside view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2237
      while #width returns the width as seen by myself)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2238
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2239
    ^ width + (2*borderWidth)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2240
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2241
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2242
!SimpleView methodsFor:'accessing-hierarchy'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2243
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2244
lower
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2245
    "bring to back"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2246
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2247
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2248
    device lowerWindow:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2249
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2250
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2251
     Transcript topView lower
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2252
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2253
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2254
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2255
raise
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2256
    "bring to front"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2257
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2258
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2259
    device raiseWindow:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2260
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2261
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2262
     Transcript topView raise
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2263
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2264
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2265
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2266
subViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2267
    "return the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2268
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2269
    ^ subViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2270
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2271
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2272
subViews:aListOfViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2273
    "set the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2274
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2275
    subViews := aListOfViews.
135
claus
parents:
diff changeset
  2276
    subViews notNil ifTrue:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2277
	subViews do:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2278
	    view superView:self
135
claus
parents:
diff changeset
  2279
	]
claus
parents:
diff changeset
  2280
    ]
claus
parents:
diff changeset
  2281
!
claus
parents:
diff changeset
  2282
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2283
superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2284
    "return my superView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2285
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2286
    ^ superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2287
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2288
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2289
superView:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2290
    "set my superView to be aView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2291
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2292
    superView := aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2293
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2294
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2295
topView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2296
    "return the topView - thats the one with no superview"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2297
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2298
    |v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2299
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2300
    v := self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2301
    [v notNil] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2302
	v superView isNil ifTrue:[^ v].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2303
	v := v superView
135
claus
parents:
diff changeset
  2304
    ].
claus
parents:
diff changeset
  2305
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2306
    ^ nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2307
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2308
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2309
!SimpleView methodsFor:'accessing-menus'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2310
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2311
menuHolder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2312
    "who has the menu ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2313
     By default, I have it."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2314
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2315
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2316
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2317
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2318
menuMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2319
    "Return the symbol sent to myself to aquire the menu"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2320
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2321
    ^ #middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2322
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2323
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2324
menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2325
    "who should perform the menu actions ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2326
     By default, I do it."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2327
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2328
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2329
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2330
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2331
yellowButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2332
    "actually, this should be called 'middleButtonMenu'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2333
     But for ST-80 compatibility ....
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2334
     This method will vanish, once all views have controllers
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2335
     associated with them; for now, duplicate some code also found in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2336
     controller."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2337
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2338
    |sym menuHolder|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2339
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2340
"/    middleButtonMenu notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2341
"/        "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2342
"/        "/ has been assigned a static middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2343
"/        "/ (or a cached menu)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2344
"/        "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2345
"/        ^ middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2346
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2347
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2348
    menuHolder := self menuHolder.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2349
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2350
    menuHolder notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2351
	sym := self menuMessage.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2352
	sym notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2353
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2354
	     mhmh - for backward compatibility, try to ask
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2355
	     the model first, then use the views menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2356
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2357
	    (menuHolder respondsTo:sym) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2358
		(self respondsTo:sym) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2359
		    menuHolder := self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2360
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2361
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2362
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2363
	     ask the menuHolder for the menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2364
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2365
	    ^ menuHolder perform:sym.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2366
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2367
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2368
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2369
    ^ nil
135
claus
parents:
diff changeset
  2370
! !
claus
parents:
diff changeset
  2371
claus
parents:
diff changeset
  2372
!SimpleView methodsFor:'accessing-misc'!
claus
parents:
diff changeset
  2373
claus
parents:
diff changeset
  2374
bitGravity
claus
parents:
diff changeset
  2375
    "return the bitGravity - thats the direction where the contents will move
claus
parents:
diff changeset
  2376
     when the the view is resized."
claus
parents:
diff changeset
  2377
claus
parents:
diff changeset
  2378
    ^ bitGravity
claus
parents:
diff changeset
  2379
!
claus
parents:
diff changeset
  2380
claus
parents:
diff changeset
  2381
bitGravity:gravity
claus
parents:
diff changeset
  2382
    "set the bitGravity - thats the direction where the contents will move
claus
parents:
diff changeset
  2383
     when the view is resized."
claus
parents:
diff changeset
  2384
claus
parents:
diff changeset
  2385
    bitGravity ~~ gravity ifTrue:[
claus
parents:
diff changeset
  2386
	bitGravity := gravity.
claus
parents:
diff changeset
  2387
	drawableId notNil ifTrue:[
claus
parents:
diff changeset
  2388
	    device setBitGravity:gravity in:drawableId
claus
parents:
diff changeset
  2389
	]
claus
parents:
diff changeset
  2390
    ]
claus
parents:
diff changeset
  2391
!
claus
parents:
diff changeset
  2392
153
claus
parents: 151
diff changeset
  2393
clipRect:aRectangle
claus
parents: 151
diff changeset
  2394
    "set the clipping rectangle for drawing (in logical coordinates);
claus
parents: 151
diff changeset
  2395
     a nil argument turn off clipping (i.e. whole view is drawable).
claus
parents: 151
diff changeset
  2396
     Redefined to care for any margin."
claus
parents: 151
diff changeset
  2397
claus
parents: 151
diff changeset
  2398
    |x y w h|
claus
parents: 151
diff changeset
  2399
claus
parents: 151
diff changeset
  2400
    aRectangle isNil ifTrue:[
claus
parents: 151
diff changeset
  2401
	clipRect isNil ifTrue:[^ self].
claus
parents: 151
diff changeset
  2402
	gcId notNil ifTrue:[
claus
parents: 151
diff changeset
  2403
	    device noClipIn:gcId
claus
parents: 151
diff changeset
  2404
	]
claus
parents: 151
diff changeset
  2405
    ] ifFalse:[
claus
parents: 151
diff changeset
  2406
	clipRect notNil ifTrue:[
claus
parents: 151
diff changeset
  2407
	    (clipRect = aRectangle) ifTrue:[^ self]
claus
parents: 151
diff changeset
  2408
	].
claus
parents: 151
diff changeset
  2409
	gcId notNil ifTrue:[
claus
parents: 151
diff changeset
  2410
	    x := aRectangle left.
claus
parents: 151
diff changeset
  2411
	    y := aRectangle top.
claus
parents: 151
diff changeset
  2412
	    w := aRectangle width.
claus
parents: 151
diff changeset
  2413
	    h := aRectangle height.
claus
parents: 151
diff changeset
  2414
	    transformation notNil ifTrue:[
claus
parents: 151
diff changeset
  2415
		x := transformation applyToX:x.
claus
parents: 151
diff changeset
  2416
		y := transformation applyToY:y.
claus
parents: 151
diff changeset
  2417
		w := transformation applyScaleX:w.
claus
parents: 151
diff changeset
  2418
		h := transformation applyScaleY:h.
claus
parents: 151
diff changeset
  2419
	    ].
claus
parents: 151
diff changeset
  2420
	    (x isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2421
		w := w + (x - x truncated).
claus
parents: 151
diff changeset
  2422
		x := x truncated
claus
parents: 151
diff changeset
  2423
	    ].
claus
parents: 151
diff changeset
  2424
	    (y isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2425
		h := h + (y - y truncated).
claus
parents: 151
diff changeset
  2426
		y := y truncated
claus
parents: 151
diff changeset
  2427
	    ].
claus
parents: 151
diff changeset
  2428
	    (w isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2429
		w := w truncated + 1
claus
parents: 151
diff changeset
  2430
	    ].
claus
parents: 151
diff changeset
  2431
	    (h isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2432
		h := h truncated + 1
claus
parents: 151
diff changeset
  2433
	    ].
claus
parents: 151
diff changeset
  2434
	    x < margin ifTrue:[
claus
parents: 151
diff changeset
  2435
		x := margin.
claus
parents: 151
diff changeset
  2436
	    ].
claus
parents: 151
diff changeset
  2437
	    y < margin ifTrue:[
claus
parents: 151
diff changeset
  2438
		y := margin.
claus
parents: 151
diff changeset
  2439
	    ].
claus
parents: 151
diff changeset
  2440
	    x + w - 1 >= (width-margin) ifTrue:[
claus
parents: 151
diff changeset
  2441
		w := width - margin - x
claus
parents: 151
diff changeset
  2442
	    ].
claus
parents: 151
diff changeset
  2443
	    y + h - 1 >= (height-margin) ifTrue:[
claus
parents: 151
diff changeset
  2444
		h := height - margin - y
claus
parents: 151
diff changeset
  2445
	    ].
claus
parents: 151
diff changeset
  2446
	    device setClipX:x y:y width:w height:h in:gcId
claus
parents: 151
diff changeset
  2447
	]
claus
parents: 151
diff changeset
  2448
    ].
claus
parents: 151
diff changeset
  2449
    clipRect := aRectangle
claus
parents: 151
diff changeset
  2450
!
claus
parents: 151
diff changeset
  2451
claus
parents: 151
diff changeset
  2452
fullName
claus
parents: 151
diff changeset
  2453
    "return my full name to be used for resource-access"
claus
parents: 151
diff changeset
  2454
claus
parents: 151
diff changeset
  2455
    superView notNil ifTrue:[
claus
parents: 151
diff changeset
  2456
	^ superView fullName , '.' , name
claus
parents: 151
diff changeset
  2457
    ].
claus
parents: 151
diff changeset
  2458
    ^ name
claus
parents: 151
diff changeset
  2459
!
claus
parents: 151
diff changeset
  2460
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2461
inputOnly
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2462
    "return true, if this view is an input-only view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2463
     input only views are transparent and can be layed on top of a view to
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2464
     catch its input"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2465
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2466
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2467
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2468
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2469
name
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2470
    "return my name component to be used for resource-access"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2471
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2472
    ^ name
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2473
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2474
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2475
name:aString
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2476
    "set my name component to be used for resource-access"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2477
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2478
    name := aString
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2479
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2480
153
claus
parents: 151
diff changeset
  2481
processName
claus
parents: 151
diff changeset
  2482
    "return a string to be shown in the process monitor"
claus
parents: 151
diff changeset
  2483
claus
parents: 151
diff changeset
  2484
    ^ self name
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2485
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2486
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2487
styleSheet 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2488
    "return the styleSheet. This is set at early view-creation time,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2489
     from the defaultStyleSheet which is valid at that time.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2490
     It is not affected by later defaultStyle changes"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2491
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2492
    ^ styleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2493
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2494
    "Created: 10.9.1995 / 11:02:20 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2495
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2496
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2497
viewGravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2498
    "return the viewGravity - thats the direction where the view will move
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2499
     when the superView is resized."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2500
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2501
    ^ viewGravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2502
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2503
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2504
viewGravity:gravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2505
    "set the viewGravity - thats the direction where the view will move
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2506
     when the superView is resized."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2507
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2508
    viewGravity ~~ gravity ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2509
	viewGravity := gravity.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2510
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2511
	    device setWindowGravity:gravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2512
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2513
    ]
140
claus
parents: 138
diff changeset
  2514
! !
claus
parents: 138
diff changeset
  2515
claus
parents: 138
diff changeset
  2516
!SimpleView methodsFor:'accessing-mvc'!
claus
parents: 138
diff changeset
  2517
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2518
aspect:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2519
    "ST-80 style updating: If a views aspectSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2520
     it will respond to changes of this aspect from the model.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2521
     Alias for aspectMessage: for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2522
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2523
    self aspectMessage:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2524
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2525
140
claus
parents: 138
diff changeset
  2526
controller
claus
parents: 138
diff changeset
  2527
    "return the controller. For non MVC views, return nil"
claus
parents: 138
diff changeset
  2528
claus
parents: 138
diff changeset
  2529
    ^ controller
claus
parents: 138
diff changeset
  2530
!
claus
parents: 138
diff changeset
  2531
claus
parents: 138
diff changeset
  2532
controller:aController
claus
parents: 138
diff changeset
  2533
    "set the controller"
claus
parents: 138
diff changeset
  2534
claus
parents: 138
diff changeset
  2535
    controller := aController.
claus
parents: 138
diff changeset
  2536
    controller notNil ifTrue:[
claus
parents: 138
diff changeset
  2537
	controller view:self.
135
claus
parents:
diff changeset
  2538
    ]
claus
parents:
diff changeset
  2539
!
claus
parents:
diff changeset
  2540
140
claus
parents: 138
diff changeset
  2541
model
135
claus
parents:
diff changeset
  2542
    ^ nil
claus
parents:
diff changeset
  2543
!
claus
parents:
diff changeset
  2544
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2545
windowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2546
    "return the window group. For old style views, return nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2547
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2548
    ^ windowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2549
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2550
140
claus
parents: 138
diff changeset
  2551
windowGroup:aGroup
claus
parents: 138
diff changeset
  2552
    "set the window group."
claus
parents: 138
diff changeset
  2553
claus
parents: 138
diff changeset
  2554
    windowGroup := aGroup
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2555
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2556
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2557
!SimpleView methodsFor:'accessing-transformation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2558
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2559
maxSubViewBottom 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2560
"/    subViews isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2561
"/    ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2562
      ^ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2563
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2564
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2565
maxSubViewRight 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2566
"/    subViews isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2567
"/    ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2568
    ^ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2569
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2570
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2571
scale:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2572
    "set the scale factor of the transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2573
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2574
    super scale:aPoint.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2575
    self computeInnerClip
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2576
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2577
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2578
setViewOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2579
    "set the viewOrigin - i.e. virtually scroll without redrawing"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2580
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2581
    |p|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2582
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2583
    p := aPoint negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2584
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2585
	transformation := WindowingTransformation scale:1 translation:p 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2586
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2587
	transformation translation:p 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2588
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2589
    clipRect notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2590
	self setInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2591
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2592
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2593
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2594
transformation 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2595
    "return the transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2596
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2597
    |vP org|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2598
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2599
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2600
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2601
	 fake a transformation, if I have a non-nil window
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2602
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2603
	window notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2604
	    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2605
		org := 0 @ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2606
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2607
		org := self origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2608
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2609
	    vP := org extent:(self extent).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2610
	    ^ WindowingTransformation window:window viewport:vP
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2611
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2612
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2613
    ^ transformation
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2614
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2615
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2616
viewOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2617
    "return the viewOrigin; thats the coordinate of the contents 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2618
     which is shown topLeft in the view 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2619
     (i.e. the origin of the visible part of the contents)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2620
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2621
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2622
	^ 0@0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2623
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2624
    ^ transformation translation negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2625
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2626
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2627
xOriginOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2628
    "return the x coordinate of the viewOrigin in pixels; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2629
     used by scrollBars to compute thumb position within the document."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2630
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2631
    ^ self viewOrigin x
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2632
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2633
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2634
yOriginOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2635
    "return the y coordinate of the viewOrigin in pixels; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2636
     used by scrollBars to compute thumb position within the document."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2637
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2638
    ^ self viewOrigin y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2639
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2640
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2641
!SimpleView methodsFor:'accessing-visibility'!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2642
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2643
beInvisible
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2644
    self hiddenOnRealize:true.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2645
    realized ifTrue:[
574
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2646
        (superView isNil                "/ I am a topView
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2647
        or:[superView realized])      "/ superview already shown
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2648
        ifTrue:[
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2649
            self unrealize
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2650
        ]
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2651
    ]
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2652
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2653
    "Created: 22.9.1995 / 15:29:01 / claus"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2654
    "Modified: 17.1.1996 / 11:41:25 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2655
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2656
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2657
beVisible
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2658
    self hiddenOnRealize:false.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2659
    realized ifFalse:[
574
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2660
        (superView isNil                "/ I am a topView
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2661
        or:[superView realized])      "/ superview already shown
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2662
        ifTrue:[
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2663
            self realize
41257c050cf4 beVisible
ca
parents: 573
diff changeset
  2664
        ]
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2665
    ]
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2666
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2667
    "
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2668
     |top topFrame check list|
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2669
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2670
     top := StandardSystemView new.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2671
     top extent:150@400.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2672
     topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2673
     topFrame horizontalLayout:#leftSpace.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2674
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2675
     topFrame add:(check := CheckBox label:'hidden').
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2676
     check pressAction:[list beInvisible].
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2677
     check releaseAction:[list beVisible].
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2678
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2679
     list := ScrollableView for:SelectionInListView.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2680
     list origin:0.0@0.4 corner:1.0@1.0.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2681
     list list:#('foo' 'bar' 'baz').
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2682
     top add:list.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2683
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2684
     check turnOn.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2685
     list beInvisible.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2686
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2687
     top open
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2688
    "
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2689
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2690
    "Created: 22.9.1995 / 15:50:33 / claus"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2691
    "Modified: 17.1.1996 / 11:41:16 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2692
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2693
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2694
hidden
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2695
    "return true, if the view does not want to be realized
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2696
     automatically when superview is realized"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2697
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2698
    self obsoleteMethodWarning:'use #isHiddenOnRealize'.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2699
    ^ hiddenOnRealize
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2700
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2701
    "Modified: 17.1.1996 / 11:44:47 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2702
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2703
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2704
hidden:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2705
    "if the argument is true, the receiver view will not
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2706
     be realized automatically when superview is realized"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2707
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2708
    self obsoleteMethodWarning:'use #beVisible / #beInvisible'.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2709
    hiddenOnRealize := aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2710
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2711
    "Modified: 17.1.1996 / 11:45:06 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2712
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2713
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2714
hiddenOnRealize:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2715
    "if the argument is true, the receiver view will not
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2716
     be mapped automatically when the superview is realized.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2717
     The hiddenOnRealize flag is useful to create views which are
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2718
     to be made visible conditionally or later."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2719
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2720
    hiddenOnRealize := aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2721
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2722
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2723
isHiddenOnRealize:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2724
    "return true, if the receiver will NOT be mapped when
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2725
     realized. False otherwise.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2726
     The hiddenOnRealize flag is useful to create views which are
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2727
     to be made visible conditionally or later."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2728
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2729
    ^ hiddenOnRealize
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2730
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2731
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2732
shown
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2733
    "return true if the view is shown; false if not.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2734
     Shown means: the view is mapped and is not completely covered."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2735
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2736
    ^ shown
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2737
! !
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2738
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2739
!SimpleView methodsFor:'adding & removing components'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2740
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2741
add:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2742
    "add a component (either a view or gadget) to the collection of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2743
     subComponents."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2744
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2745
    self addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2746
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2747
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2748
add:aComponent in:aRectangleOrLayoutFrame 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2749
    "for ST-80 compatibility.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2750
     add a component in some frame; the argument may be either a rectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2751
     with relative coordinates, or an instance of LayoutFrame, specifying
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2752
     both relative coordinates and the insets."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2753
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2754
"/ old code:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2755
"/    |origin corner l|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2756
"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2757
"/    origin := aRectangleOrLayoutFrame origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2758
"/    origin := origin x asFloat @ origin y asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2759
"/    corner := aRectangleOrLayoutFrame corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2760
"/    corner := corner x asFloat @ corner y asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2761
"/    aComponent origin:origin corner:corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2762
"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2763
"/    (aRectangleOrLayoutFrame isMemberOf:Rectangle) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2764
"/        aComponent leftInset:aRectangleOrLayoutFrame leftOffset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2765
"/        aComponent rightInset:aRectangleOrLayoutFrame rightOffset negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2766
"/        aComponent topInset:aRectangleOrLayoutFrame topOffset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2767
"/        aComponent bottomInset:aRectangleOrLayoutFrame bottomOffset negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2768
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2769
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2770
"/ new (being validated):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2771
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2772
    |l|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2773
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2774
    (aRectangleOrLayoutFrame isMemberOf:Rectangle) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2775
	l := aRectangleOrLayoutFrame asLayout.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2776
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2777
	l := aRectangleOrLayoutFrame
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2778
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2779
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2780
"/  will soon be replaced by:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2781
"/    aComponent layout:l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2782
    aComponent geometryLayout:l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2783
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2784
    self addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2785
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2786
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2787
addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2788
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2789
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2790
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2791
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2792
	self addSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2793
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2794
	components isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2795
	    components := OrderedCollection new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2796
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2797
	components add:aComponent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2798
	aComponent setParentViewIn:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2799
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2800
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2801
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2802
addSubView:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2803
    "add a view to the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2804
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2805
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2806
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2807
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2808
	subViews add:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2809
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2810
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2811
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2812
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2813
addSubView:newView after:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2814
    "add a view to the collection of subviews after another view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2815
     This makes sense, in Panels and other layout views, to enter a new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2816
     element at some defined place."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2817
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2818
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2819
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2820
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2821
	aView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2822
	    subViews add:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2823
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2824
	    subViews add:newView after:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2825
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2826
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2827
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2828
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2829
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2830
addSubView:newView before:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2831
    "add a view to the collection of subviews before another view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2832
     This makes sense, in Panels and other layout views, to enter a new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2833
     element at some defined place."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2834
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2835
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2836
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2837
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2838
	aView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2839
	    subViews addFirst:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2840
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2841
	    subViews add:newView before:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2842
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2843
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2844
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2845
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2846
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2847
addSubView:aView in:bounds borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2848
    "for ST-80 V2.x compatibility"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2849
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2850
    aView borderWidth:bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2851
    self add:aView in:bounds.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2852
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2853
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2854
addSubView:aView viewport:aRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2855
    "ST-80 V2.x compatibility:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2856
     Adds aView to the views list of subviews and uses the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2857
     existing subviews window and the new viewport to position it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2858
     This method may be removed in future versions."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2859
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2860
    self addSubView:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2861
    aView viewport:aRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2862
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2863
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2864
addSubView:aView window:aWindowRectangle viewport:aViewportRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2865
    "ST-80 V2.x compatibility:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2866
     Adds aView to the views list of subviews and uses 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2867
     aWindowRectangle and aViewportRectangle to position it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2868
     This method may be removed in future versions."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2869
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2870
    self addSubView:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2871
    aView window:aWindowRectangle viewport:aViewportRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2872
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2873
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2874
component:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2875
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2876
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2877
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2878
    aComponent origin:0.0@0.0 corner:1.0@1.0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2879
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2880
	self addSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2881
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2882
	components := OrderedCollection with:aComponent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2883
	aComponent setParentViewIn:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2884
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2885
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2886
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2887
destroySubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2888
    "remove all subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2889
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2890
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2891
	subViews copy do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2892
	    aSubView destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2893
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2894
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2895
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2896
    "Modified: 5.9.1995 / 22:35:36 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2897
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2898
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2899
removeComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2900
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2901
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2902
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2903
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2904
	self removeSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2905
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2906
	components isNil ifTrue:[^self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2907
	components remove:aComponent ifAbsent:[].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2908
	aComponent parent:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2909
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2910
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2911
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2912
removeSubView:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2913
    "remove a view from the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2914
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2915
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2916
	subViews remove:aView ifAbsent:[nil].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2917
	(subViews size == 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2918
	    subViews := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2919
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2920
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2921
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2922
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2923
setParentViewIn:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2924
    "common code for addSubView* methods"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2925
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2926
    aView superView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2927
    (aView device ~~ device) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2928
	'VIEW: warning subview (' errorPrint. aView class name errorPrint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2929
	') has different device than me (' errorPrint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2930
	self class name errorPrint. ').' errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2931
	aView device:device
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2932
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2933
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2934
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2935
!SimpleView methodsFor:'change & update'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2937
update:aspect with:aParameter from:changedObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2938
    "an update request"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2939
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2940
    aspect == #sizeOfView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2941
	"one of the views we depend on changed its size"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2942
	^ self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2943
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2944
    ^super update:aspect with:aParameter from:changedObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2945
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2946
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2947
!SimpleView methodsFor:'copying'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2948
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2949
shallowCopyForFinalization
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2950
    "redefined for faster creation of finalization copies
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2951
     (only device, gcId and drawableId are needed)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2952
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2953
    |aCopy|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2954
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2955
    aCopy := DeviceViewHandle basicNew.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2956
    aCopy setDevice:device id:drawableId gcId:gcId.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2957
    ^ aCopy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2958
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2959
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2960
!SimpleView methodsFor:'cursor animation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2961
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2962
showBusyWhile:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2963
    "evaluate some time consuming block, while doing this,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2964
     show a spinning wheel cursor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2965
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2966
    |ok bitmaps cursors mask process oldCursor|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2967
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2968
    oldCursor := cursor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2969
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2970
    ok := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2971
    bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2972
	       collect:[:name |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2973
		   |f|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2974
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2975
		   f := Form fromFile:(name , '.xbm').
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2976
		   f isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2977
			('no bitmap file: ' , name , '.xbm') errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2978
			ok := false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2979
		   ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2980
		   f
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2981
	       ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2982
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2983
    mask := Form fromFile:'wheelm.xbm'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2984
    mask isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2985
	('no bitmap file: ' , mask , '.xbm') errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2986
	ok := false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2987
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2988
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2989
    ok ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2990
	self cursor:Cursor wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2991
	aBlock valueNowOrOnUnwindDo:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2992
	    self cursor:oldCursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2993
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2994
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2995
	cursors := bitmaps collect:[:form | (Cursor sourceForm:form
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2996
						      maskForm:mask
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2997
							  hotX:8
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2998
							  hotY:8) on:device].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2999
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3000
	process := [
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  3001
		    Delay waitForSeconds:0.25.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3002
		    [true] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3003
			cursors do:[:curs |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3004
			    self cursor:curs.
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  3005
			    Delay waitForSeconds:0.05
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3006
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3007
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3008
		   ] fork.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3009
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3010
	Processor activeProcess priority:7.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3011
	aBlock valueNowOrOnUnwindDo:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3012
	    Processor activeProcess priority:8.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3013
	    process terminate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3014
	    self cursor:oldCursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3015
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3016
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3017
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3018
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3019
     View new realize showBusyWhile:[10 timesRepeat:[3000 factorial]]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3020
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3021
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3022
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3023
!SimpleView methodsFor:'edge drawing'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3024
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3025
drawBottomEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3026
    "draw bottom 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3027
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3028
    self drawBottomEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3029
		      shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3030
		      light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3031
		      halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3032
		      halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3033
		      style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3034
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3035
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3036
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3037
    |botFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3038
     count "{ Class: SmallInteger }" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3039
     b r|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3040
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3041
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3042
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3043
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3044
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3045
	botFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3046
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3047
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3048
	((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3049
	    botFg := halfShadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3050
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3051
	    botFg := shadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3052
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3053
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3054
    super paint:botFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3055
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3056
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3057
    r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3058
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3059
	b := height - 1 - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3060
	super displayDeviceLineFromX:i y:b toX:(r - i) y:b
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3061
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3062
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3063
    ((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3064
	b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3065
	super paint:shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3066
	super displayDeviceLineFromX:1 y:b toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3067
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3068
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3069
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3070
drawEdges
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3071
    "draw all of my 3D edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3072
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3073
    self drawEdgesForX:0 y:0 width:width height:height level:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3074
		shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3075
		light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3076
		halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3077
		halfLight:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3078
		style:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3079
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3080
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3081
drawEdgesForX:x y:y width:w height:h level:l
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3082
    "draw 3D edges into a rectangle"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3083
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3084
    self drawEdgesForX:x y:y width:w height:h level:l 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3085
		shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3086
		light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3087
		halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3088
		halfLight:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3089
		style:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3090
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3091
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3092
drawEdgesForX:x y:y width:w height:h level:l 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3093
		shadow:shadowColor light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3094
		halfShadow:halfShadowColor halfLight:halfLightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3095
		style:edgeStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3096
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3097
    "draw 3D edges into a rectangle"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3098
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3099
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3100
     count "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3101
     r     "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3102
     b     "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3103
     xi    "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3104
     yi    "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3105
     run paint|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3106
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3107
    count := l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3108
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3109
	topLeftFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3110
	botRightFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3111
	topLeftHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3112
	botRightHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3113
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3114
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3115
	topLeftFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3116
	botRightFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3117
	topLeftHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3118
	botRightHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3119
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3120
    topLeftHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3121
	topLeftHalfFg := topLeftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3122
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3123
    botRightHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3124
	botRightHalfFg := botRightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3125
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3126
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3127
    r := x + w - 1. "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3128
    b := y + h - 1. "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3129
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3130
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3131
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3132
    "top and left edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3133
    ((edgeStyle == #soft) and:["l" count > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3134
	paint := topLeftHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3135
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3136
	paint := topLeftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3137
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3138
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3139
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3140
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3141
	run := y + i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3142
	super displayDeviceLineFromX:x y:run toX:r y:run. "top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3143
	run := x + i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3144
	super displayDeviceLineFromX:run y:y toX:run y:b  "left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3145
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3146
    (edgeStyle == #soft) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3147
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3148
	super paint:topLeftFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3149
	super displayDeviceLineFromX:x y:y toX:r y:y. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3150
	super displayDeviceLineFromX:x y:y toX:x y:b        
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3151
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3152
	(l > 2) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3153
	    super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3154
	    super displayDeviceLineFromX:x y:y toX:r y:y. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3155
	    super displayDeviceLineFromX:x y:y toX:x y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3156
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3157
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3158
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3159
    xi := x + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3160
    yi := y + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3161
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3162
"/ does not look good
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3163
"/ style == #st80 iftrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3164
"/  yi := yi + 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3165
"/ ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3166
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3167
    "bottom and right edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3168
    (edgeStyle == #soft "new:" and:[count > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3169
	paint := botRightHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3170
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3171
	paint := botRightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3172
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3173
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3174
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3175
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3176
	run := b - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3177
	super displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3178
	run := r - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3179
	super displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3180
	xi := xi + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3181
	yi := yi + 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3182
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3183
    ((edgeStyle == #soft) and:[l > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3184
	super paint:Black "shadowColor".
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3185
	super displayDeviceLineFromX:(x + (1 - 1)) y:b toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3186
	super displayDeviceLineFromX:r y:(y + (1 - 1)) toX:r y:b        
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3187
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3188
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3189
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3190
drawLeftEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3191
    "draw left 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3192
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3193
    self drawLeftEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3194
		    shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3195
		     light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3196
		     halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3197
		     halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3198
		     style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3199
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3200
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3201
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3202
    |leftFg leftHalfFg paint b
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3203
     count "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3204
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3205
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3206
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3207
    
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3208
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3209
	leftFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3210
	leftHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3211
	count := count negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3212
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3213
	leftFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3214
	leftHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3215
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3216
    leftHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3217
	leftHalfFg := leftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3218
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3219
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3220
    ((edgeStyle == #soft) and:[level > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3221
	paint := leftHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3222
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3223
	paint := leftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3224
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3225
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3226
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3227
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3228
    b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3229
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3230
	super displayDeviceLineFromX:i y:i toX:i y:(b - i)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3231
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3232
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3233
    ((edgeStyle == #soft) and:[level > 2]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3234
	super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3235
	super displayDeviceLineFromX:0 y:0 toX:0 y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3236
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3237
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3238
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3239
drawRightEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3240
    "draw right 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3241
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3242
    self drawRightEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3243
		     shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3244
		      light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3245
		      halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3246
		      halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3247
		      style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3248
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3249
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3250
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3251
    |rightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3252
     count "{ Class: SmallInteger }" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3253
     r b|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3254
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3255
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3256
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3257
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3258
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3259
	rightFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3260
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3261
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3262
	((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3263
	    rightFg := halfShadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3264
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3265
	    rightFg := shadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3266
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3267
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3268
    super paint:rightFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3269
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3270
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3271
    b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3272
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3273
	r := width - 1 - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3274
	super displayDeviceLineFromX:r y:i toX:r y:(b - i)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3275
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3276
    ((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3277
	r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3278
	super paint:shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3279
	super displayDeviceLineFromX:r y:1 toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3280
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3281
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3282
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3283
drawTopEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3284
    "draw top 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3285
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3286
    self drawTopEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3287
		   shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3288
		    light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3289
		    halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3290
		    halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3291
		    style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3292
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3293
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3294
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3295
    |topFg topHalfFg paint r
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3296
     count "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3297
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3298
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3299
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3300
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3301
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3302
	topFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3303
	topHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3304
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3305
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3306
	topFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3307
	topHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3308
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3309
    topHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3310
	topHalfFg := topFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3311
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3312
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3313
    ((edgeStyle == #soft) and:[level > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3314
	paint := topHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3315
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3316
	paint := topFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3317
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3318
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3319
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3320
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3321
    r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3322
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3323
	super displayDeviceLineFromX:i y:i toX:(r - i) y:i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3324
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3325
    ((edgeStyle == #soft) and:[level > 2]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3326
	super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3327
	super displayDeviceLineFromX:0 y:0 toX:r y:0. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3328
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3329
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3330
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3331
redrawEdges
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3332
    "redraw my edges (if any)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3333
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3334
    (level ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3335
	shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3336
	    self clipRect:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3337
	    self drawEdges.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3338
	    self clipRect:innerClipRect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3339
	]                  
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3340
    ]                  
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3341
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3342
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3343
!SimpleView methodsFor:'enumerating subviews'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3344
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3345
allSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3346
    "evaluate aBlock for all subviews (recursively)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3347
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3348
    (subViews isNil or:[subViews isEmpty]) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3349
	subViews do:[:aSubview |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3350
	    aSubview withAllSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3351
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3352
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3353
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3354
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3355
withAllSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3356
    "evaluate aBlock for the receiver and all subviews (recursively)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3357
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3358
    aBlock value:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3359
    self allSubViewsDo:aBlock
135
claus
parents:
diff changeset
  3360
! !
claus
parents:
diff changeset
  3361
claus
parents:
diff changeset
  3362
!SimpleView methodsFor:'event handling'!
claus
parents:
diff changeset
  3363
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3364
activateMenu
520
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3365
    "activate my menu.
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3366
     If there is a static middleButtonMenu, that one is taken,
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3367
     and handled in the superClass (static menus are a historic leftOver).
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3368
     Otherwise, the follwing steps are performed:
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3369
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3370
        - ask the receiver for the menu (via #yellowButtonMenu)
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3371
        - ask the receiver for the menuPerformer.
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3372
        - startUp the menu - it is supposed to return an actionSelector
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3373
        - if the menuPerformer responds to the selector,
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3374
          send it to the performer;
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3375
          otherwise send it to the view (the receiver)
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3376
          This is funny, it allows additional menuItems to be added
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3377
          AND still get the views copy/cut/paste functionality.
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3378
          Without this, you had to redefine and forward all of those
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3379
          messages in the performer."
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3380
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3381
    |menu menuPerformer actionSelector actionArg haveArg|
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3382
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3383
    middleButtonMenu isNil ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3384
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3385
        haveArg := false.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3386
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3387
        "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3388
         try ST-80 style menus first:
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3389
         if there is a model, and a menuMessage is defined,
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3390
         ask model for the menu and launch that if non-nil.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3391
        "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3392
        menu := self yellowButtonMenu.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3393
        menu notNil ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3394
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3395
             got one, launch the menu. It is supposed
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3396
             to return an actionSelector.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3397
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3398
            menuPerformer := self menuPerformer.
520
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3399
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3400
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3401
             a temporary kludge: subMenus dont know about 
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3402
             actionSelectors yet ...
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3403
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3404
            menu receiver isNil ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3405
                menu receiver:menuPerformer
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3406
            ].
520
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3407
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3408
            "/
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3409
            "/ startup the menu - this returns a selector
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3410
            "/
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3411
            actionSelector := menu startUp.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3412
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3413
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3414
             mhmh - kludge for selectors with argument
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3415
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3416
            (actionSelector isMemberOf:Array) ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3417
                actionArg := actionSelector at:2.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3418
                actionSelector := actionSelector at:1.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3419
                haveArg := true.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3420
            ].
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3421
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3422
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3423
             mhmh - ST-80 seems to send some to the model and
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3424
             others (copy/cut/paste) to the controller/view
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3425
             Simulate this behavior, by looking what the model responds to.
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3426
            "
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3427
            (actionSelector notNil
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3428
            and:[actionSelector isSymbol]) ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3429
                (menuPerformer respondsTo:actionSelector) ifFalse:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3430
                    (self respondsTo:actionSelector) ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3431
                        menuPerformer := self
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3432
                    ]
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3433
                ].
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3434
                actionSelector numArgs ~~ 0 ifTrue:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3435
                    menuPerformer perform:actionSelector with:actionArg
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3436
                ] ifFalse:[
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3437
                    menuPerformer perform:actionSelector
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3438
                ]
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3439
            ].
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3440
            ^ self
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3441
        ].
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3442
    ].
520
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3443
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3444
    "/
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3445
    "/ old style static menu
3e947f34a2af describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents: 517
diff changeset
  3446
    "/
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3447
    super activateMenu
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3448
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3449
    "Created: 1.3.1996 / 13:24:18 / cg"
584
6106ad13708d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
  3450
    "Modified: 22.4.1996 / 19:41:41 / cg"
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3451
!
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3452
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3453
buttonPress:button x:x y:y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3454
    "button was pressed - if its the middle button 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3455
     and there is a middleButtonMenu, show it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3456
     If both a model and a menuSelector is is defined, ask the model for
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3457
     the menu and launch it. The menu is supposed to return an actionSelector
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3458
     which in turn is sent to the model."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3459
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3460
    components notNil ifTrue:[
472
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3461
        components do:[:aComponent |
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3462
            |thisFrame|
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3463
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3464
            thisFrame := aComponent frame.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3465
            (thisFrame containsPointX:x y:y) ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3466
                aComponent buttonPress:button x:x - thisFrame left
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3467
                                              y:y - thisFrame top.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3468
                ^ self
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3469
            ]
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
  3470
        ]
140
claus
parents: 138
diff changeset
  3471
    ].
claus
parents: 138
diff changeset
  3472
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3473
    super buttonPress:button x:x y:y
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3474
489
97c51a9ec661 moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents: 484
diff changeset
  3475
    "Modified: 1.3.1996 / 13:25:34 / cg"
193
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
  3476
!
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
  3477
140
claus
parents: 138
diff changeset
  3478
configureX:x y:y width:newWidth height:newHeight
claus
parents: 138
diff changeset
  3479
    "my size has changed by window manager action"
claus
parents: 138
diff changeset
  3480
180
claus
parents: 176
diff changeset
  3481
    |how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p|
claus
parents: 176
diff changeset
  3482
claus
parents: 176
diff changeset
  3483
    (superView isNil 
claus
parents: 176
diff changeset
  3484
    and:[drawableId notNil]) ifTrue:[
claus
parents: 176
diff changeset
  3485
	"/ have to be careful - some window managers (motif) wrap another
claus
parents: 176
diff changeset
  3486
	"/ view around and the reported origin is relative to that.
claus
parents: 176
diff changeset
  3487
	"/ not relative to the screen.
claus
parents: 176
diff changeset
  3488
	p := device translatePoint:0@0 from:drawableId to:device rootWindowId.
claus
parents: 176
diff changeset
  3489
	left := p x.
claus
parents: 176
diff changeset
  3490
	top := p y.
claus
parents: 176
diff changeset
  3491
    ] ifFalse:[
claus
parents: 176
diff changeset
  3492
	left := x.
claus
parents: 176
diff changeset
  3493
	top := y.
claus
parents: 176
diff changeset
  3494
    ].
140
claus
parents: 138
diff changeset
  3495
    ((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[
claus
parents: 138
diff changeset
  3496
	realized ifFalse:[
claus
parents: 138
diff changeset
  3497
	    width := newWidth.
claus
parents: 138
diff changeset
  3498
	    height := newHeight.
claus
parents: 138
diff changeset
  3499
	    extentChanged := true.
claus
parents: 138
diff changeset
  3500
	    ^ self
claus
parents: 138
diff changeset
  3501
	].
claus
parents: 138
diff changeset
  3502
claus
parents: 138
diff changeset
  3503
	((newWidth <= width) and:[newHeight <= height]) ifTrue:[
claus
parents: 138
diff changeset
  3504
	    how := #smaller
claus
parents: 138
diff changeset
  3505
	].
claus
parents: 138
diff changeset
  3506
claus
parents: 138
diff changeset
  3507
	level ~~ 0 ifTrue:[
claus
parents: 138
diff changeset
  3508
	    mustRedrawBottomEdge := newHeight < height.
claus
parents: 138
diff changeset
  3509
	    mustRedrawRightEdge := newWidth < width.
claus
parents: 138
diff changeset
  3510
	    anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge]
claus
parents: 138
diff changeset
  3511
	] ifFalse:[
claus
parents: 138
diff changeset
  3512
	    anyEdge := false
claus
parents: 138
diff changeset
  3513
	].
claus
parents: 138
diff changeset
  3514
claus
parents: 138
diff changeset
  3515
	width := newWidth.
claus
parents: 138
diff changeset
  3516
	height := newHeight.
claus
parents: 138
diff changeset
  3517
claus
parents: 138
diff changeset
  3518
	"recompute inner-clip if needed"
claus
parents: 138
diff changeset
  3519
	self setInnerClip.
claus
parents: 138
diff changeset
  3520
claus
parents: 138
diff changeset
  3521
	"
claus
parents: 138
diff changeset
  3522
	 must first process pending exposes;
claus
parents: 138
diff changeset
  3523
	 otherwise, those may be drawn at a wrong position
claus
parents: 138
diff changeset
  3524
	"
claus
parents: 138
diff changeset
  3525
	windowGroup notNil ifTrue:[
claus
parents: 138
diff changeset
  3526
	    windowGroup processExposeEvents
claus
parents: 138
diff changeset
  3527
	].
claus
parents: 138
diff changeset
  3528
	self sizeChanged:how.
claus
parents: 138
diff changeset
  3529
claus
parents: 138
diff changeset
  3530
	(anyEdge and:[shown]) ifTrue:[
claus
parents: 138
diff changeset
  3531
	    self clipRect:nil.
claus
parents: 138
diff changeset
  3532
	    mustRedrawBottomEdge ifTrue:[
claus
parents: 138
diff changeset
  3533
		self drawBottomEdge
claus
parents: 138
diff changeset
  3534
	    ].
claus
parents: 138
diff changeset
  3535
	    mustRedrawRightEdge ifTrue:[
claus
parents: 138
diff changeset
  3536
		self drawRightEdge
claus
parents: 138
diff changeset
  3537
	    ].
claus
parents: 138
diff changeset
  3538
	    self clipRect:innerClipRect
claus
parents: 138
diff changeset
  3539
	]
claus
parents: 138
diff changeset
  3540
    ]
138
claus
parents: 137
diff changeset
  3541
!
claus
parents: 137
diff changeset
  3542
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3543
coveredBy:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3544
    "the receiver has been covered by another view;
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3545
     we are not interested in that here (but see modalBox for more)."
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3546
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3547
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3548
destroyed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3549
    "view has been destroyed by someone else (usually window system)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3550
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3551
    shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3552
    super destroyed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3553
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3554
135
claus
parents:
diff changeset
  3555
exposeX:x y:y width:w height:h
claus
parents:
diff changeset
  3556
    "a low level redraw event from device
claus
parents:
diff changeset
  3557
      - let subclass handle the redraw and take care of edges here"
claus
parents:
diff changeset
  3558
claus
parents:
diff changeset
  3559
    |leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh old|
claus
parents:
diff changeset
  3560
claus
parents:
diff changeset
  3561
    nw := w.
claus
parents:
diff changeset
  3562
    nh := h.
claus
parents:
diff changeset
  3563
    nx := x.
claus
parents:
diff changeset
  3564
    ny := y.
claus
parents:
diff changeset
  3565
claus
parents:
diff changeset
  3566
    anyEdge := false.
claus
parents:
diff changeset
  3567
claus
parents:
diff changeset
  3568
    "
claus
parents:
diff changeset
  3569
     check if there is a need to draw an edge (i.e. if margin is hit)
claus
parents:
diff changeset
  3570
    "
claus
parents:
diff changeset
  3571
    (margin ~~ 0) ifTrue:[
claus
parents:
diff changeset
  3572
	leftEdge := false.
claus
parents:
diff changeset
  3573
	topEdge := false.
claus
parents:
diff changeset
  3574
	rightEdge := false.
claus
parents:
diff changeset
  3575
	botEdge := false.
claus
parents:
diff changeset
  3576
	transformation notNil ifTrue:[
claus
parents:
diff changeset
  3577
	    "
claus
parents:
diff changeset
  3578
	     need device coordinates for this test
claus
parents:
diff changeset
  3579
	    "
claus
parents:
diff changeset
  3580
	    nx := transformation applyToX:nx.
claus
parents:
diff changeset
  3581
	    ny := transformation applyToY:ny.
claus
parents:
diff changeset
  3582
	    nw := transformation applyScaleX:nw.
claus
parents:
diff changeset
  3583
	    nh := transformation applyScaleY:nh.
claus
parents:
diff changeset
  3584
	].
claus
parents:
diff changeset
  3585
	"
claus
parents:
diff changeset
  3586
	 adjust expose rectangle, to exclude the margin.
claus
parents:
diff changeset
  3587
	 Care for rounding errors ...
claus
parents:
diff changeset
  3588
	"
claus
parents:
diff changeset
  3589
	(nx isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3590
	    old := nx.
claus
parents:
diff changeset
  3591
	    nx := nx truncated.
claus
parents:
diff changeset
  3592
	    nw := nw + (nx - old).
claus
parents:
diff changeset
  3593
	].
claus
parents:
diff changeset
  3594
	(ny isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3595
	    old := ny.
claus
parents:
diff changeset
  3596
	    ny := ny truncated.
claus
parents:
diff changeset
  3597
	    nh := nh + (ny - old).
claus
parents:
diff changeset
  3598
	].
claus
parents:
diff changeset
  3599
	(nw isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3600
	    nw := nw truncated + 1
claus
parents:
diff changeset
  3601
	].
claus
parents:
diff changeset
  3602
	(nh isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3603
	    nh := nh truncated + 1
claus
parents:
diff changeset
  3604
	].
claus
parents:
diff changeset
  3605
	(nx < margin) ifTrue:[
claus
parents:
diff changeset
  3606
	    old := nx.
claus
parents:
diff changeset
  3607
	    nx := margin.
claus
parents:
diff changeset
  3608
	    nw := nw - (nx - old).
claus
parents:
diff changeset
  3609
	    leftEdge := anyEdge := true.
claus
parents:
diff changeset
  3610
	].
claus
parents:
diff changeset
  3611
	((nx + nw - 1) >= (width - margin)) ifTrue:[
claus
parents:
diff changeset
  3612
	    nw := (width - margin - nx).
claus
parents:
diff changeset
  3613
	    rightEdge := anyEdge := true.
claus
parents:
diff changeset
  3614
	].
claus
parents:
diff changeset
  3615
	(ny < margin) ifTrue:[
claus
parents:
diff changeset
  3616
	    old := ny.
claus
parents:
diff changeset
  3617
	    ny := margin.
claus
parents:
diff changeset
  3618
	    nh := nh - (ny - old).
claus
parents:
diff changeset
  3619
	    topEdge := anyEdge := true.
claus
parents:
diff changeset
  3620
	].
claus
parents:
diff changeset
  3621
	((ny + nh - 1) >= (height - margin)) ifTrue:[
claus
parents:
diff changeset
  3622
	    nh := (height - margin - ny).
claus
parents:
diff changeset
  3623
	    botEdge := anyEdge := true.
claus
parents:
diff changeset
  3624
	].
claus
parents:
diff changeset
  3625
	transformation notNil ifTrue:[
claus
parents:
diff changeset
  3626
	    "
claus
parents:
diff changeset
  3627
	     need logical coordinates for redraw
claus
parents:
diff changeset
  3628
	    "
claus
parents:
diff changeset
  3629
	    nx := transformation applyInverseToX:nx.
claus
parents:
diff changeset
  3630
	    ny := transformation applyInverseToY:ny.
claus
parents:
diff changeset
  3631
	    nw := transformation applyInverseScaleX:nw.
claus
parents:
diff changeset
  3632
	    nh := transformation applyInverseScaleY:nh.
claus
parents:
diff changeset
  3633
	].
claus
parents:
diff changeset
  3634
    ].
claus
parents:
diff changeset
  3635
claus
parents:
diff changeset
  3636
    "
claus
parents:
diff changeset
  3637
     redraw inside area
claus
parents:
diff changeset
  3638
    "
claus
parents:
diff changeset
  3639
    self redrawX:nx y:ny width:nw height:nh.
claus
parents:
diff changeset
  3640
claus
parents:
diff changeset
  3641
    "
claus
parents:
diff changeset
  3642
     redraw edge(s)
claus
parents:
diff changeset
  3643
    "
claus
parents:
diff changeset
  3644
    anyEdge ifTrue:[
claus
parents:
diff changeset
  3645
	self clipRect:nil.
claus
parents:
diff changeset
  3646
	(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
claus
parents:
diff changeset
  3647
	    self drawEdges
claus
parents:
diff changeset
  3648
	] ifFalse:[
claus
parents:
diff changeset
  3649
	    topEdge ifTrue:[
claus
parents:
diff changeset
  3650
		self drawTopEdge
claus
parents:
diff changeset
  3651
	    ].
claus
parents:
diff changeset
  3652
	    leftEdge ifTrue:[
claus
parents:
diff changeset
  3653
		self drawLeftEdge
claus
parents:
diff changeset
  3654
	    ].
claus
parents:
diff changeset
  3655
	    botEdge ifTrue:[
claus
parents:
diff changeset
  3656
		self drawBottomEdge
claus
parents:
diff changeset
  3657
	    ].
claus
parents:
diff changeset
  3658
	    rightEdge ifTrue:[
claus
parents:
diff changeset
  3659
		self drawRightEdge
claus
parents:
diff changeset
  3660
	    ]
claus
parents:
diff changeset
  3661
	].
claus
parents:
diff changeset
  3662
	self clipRect:innerClipRect
claus
parents:
diff changeset
  3663
    ]
claus
parents:
diff changeset
  3664
!
claus
parents:
diff changeset
  3665
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3666
focusIn
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3667
    "got keyboard focus (via the window manager)"
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3668
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3669
    self showFocus:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3670
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3671
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3672
focusOut
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3673
    "lost keyboard focus (via the window manager)"
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3674
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3675
    self showNoFocus:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3676
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3677
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3678
hasKeyboardFocus:aBoolean
140
claus
parents: 138
diff changeset
  3679
    ^ self
claus
parents: 138
diff changeset
  3680
!
claus
parents: 138
diff changeset
  3681
claus
parents: 138
diff changeset
  3682
keyPress:key x:x y:y
claus
parents: 138
diff changeset
  3683
    "a key has been pressed. If there are components,
claus
parents: 138
diff changeset
  3684
     pass it to the corresponding one. 
claus
parents: 138
diff changeset
  3685
     Otherwise, forward it to the superview, if there is any."
claus
parents: 138
diff changeset
  3686
510
c0c7a04317a9 resources
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3687
    <resource: #keyboard ( #Menu ) >
c0c7a04317a9 resources
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3688
140
claus
parents: 138
diff changeset
  3689
    components notNil ifTrue:[
490
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3690
        components do:[:aComponent |
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3691
            |thisFrame|
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3692
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3693
            thisFrame := aComponent frame.
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3694
            (thisFrame containsPointX:x y:y) ifTrue:[
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3695
                aComponent keyPress:key x:x - thisFrame left
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3696
                                        y:y - thisFrame top.
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3697
                ^ self
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3698
            ]
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3699
        ]
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3700
    ].
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3701
494
cc7765901744 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  3702
    key == #Menu ifTrue:[
490
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3703
        ^ self activateMenu.
135
claus
parents:
diff changeset
  3704
    ].
claus
parents:
diff changeset
  3705
490
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3706
    x isNil ifTrue:[
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3707
        "/ already redelegated, but nowhere handled
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3708
        superView notNil ifTrue:[
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3709
            superView keyPress:key x:nil y:nil.
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3710
        ].
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3711
        ^ self
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3712
    ].
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3713
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3714
    superView notNil ifTrue:[
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3715
        WindowEvent
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3716
            sendEvent:#keyPress:x:y:
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3717
            arguments:(Array with:key with:0 with:0)
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3718
            view:superView
411
2d5deb02d8f8 if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
  3719
    ] ifFalse:[
490
1d2ed059a063 delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3720
        super keyPress:key x:x y:y
135
claus
parents:
diff changeset
  3721
    ]
411
2d5deb02d8f8 if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
  3722
510
c0c7a04317a9 resources
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3723
    "Modified: 7.3.1996 / 13:18:59 / cg"
135
claus
parents:
diff changeset
  3724
!
claus
parents:
diff changeset
  3725
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3726
mapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3727
    "the view has been mapped (by some outside
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3728
     action - i.e. window manager de-iconified me)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3729
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3730
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3731
     the old code was:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3732
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3733
	realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3734
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3735
	...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3736
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3737
     this created a race condition, if the view was
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3738
     realized and shortly after unrealized - before the mapped event
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3739
     arrived. This lead to shown being set to true even thought the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3740
     view was not. Boy - that was a bad one (hard to reproduce and hard to find).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3741
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3742
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3743
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3744
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3745
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3746
	 backed views will not get expose events - have
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3747
	 to force a redraw here to get things drawn into
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3748
	 backing store.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3749
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3750
	backed ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3751
	    self redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3752
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3753
	subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3754
	    subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3755
		v superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3756
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3757
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3758
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3759
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3760
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3761
reparented
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3762
    "the view has changed its parent by some outside
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3763
     action - i.e. window manager has added a frame.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3764
     nothing done here"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3765
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3766
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3767
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3768
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3769
saveAndTerminate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3770
    "window manager wants me to save and go away; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3771
     - notice, that not all window managers are nice enough to 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3772
       send this event, but simply destroy the view instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3773
     Can be redefined in subclasses to do whatever is required
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3774
     to prepare for restart."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3775
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3776
    ^ self destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3777
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3778
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3779
sizeChanged:how
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3780
    "tell subviews if I change size.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3781
     How is either #smaller, #larger or nil, and is used to control the order,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3782
     in which subviews are notified (possibly reducing redraw activity)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3783
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3784
    window notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3785
	"compute new transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3786
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3787
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3788
	(how isNil "false" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3789
	or:[how == #smaller]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3790
	    subViews do:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3791
		view superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3792
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3793
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3794
	    "doing it reverse speeds up resizing - usually subviews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3795
	     are created from top-left to bottom-right; therefore
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3796
	     bottom-right views will be moved/resized first, then top-left ones;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3797
	     this avoids multiple redraws of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3798
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3799
	    subViews reverseDo:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3800
		view superViewChangedSize
135
claus
parents:
diff changeset
  3801
	    ]
claus
parents:
diff changeset
  3802
	]
claus
parents:
diff changeset
  3803
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3804
    self changed:#sizeOfView with:how.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3805
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3806
	superView subViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3807
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3808
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3809
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3810
subViewChangedSize
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3811
    "some subview has changed its size; we are not interested
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3812
     in that here, but some geometry managers redefine this, to reorganize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3813
     components if that happens."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3814
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3815
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3816
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3817
    "Created: 22.9.1995 / 14:44:59 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3818
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3819
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3820
superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3821
    "my superView has changed size; if I have relative
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3822
     origin/extent or blocks to evaluate, do it now .."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3823
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3824
    |oldWidth oldHeight oldTop oldLeft newExt newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3825
     winSuper newWidth newHeight newLeft newTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3826
     superWidth superHeight superWinWidth superWinHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3827
     r|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3828
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3829
    oldWidth := width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3830
    oldHeight := height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3831
    oldTop := top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3832
    oldLeft := left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3833
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3834
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3835
     if this view has a viewPort, resize a la ST-80 V2.x
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3836
     this will vanish - dont use it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3837
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3838
    viewport notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3839
	superView isNil ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3840
	winSuper := superView window.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3841
	winSuper isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3842
	    "take pixel size as window"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3843
	    winSuper := 0@0 extent:(superView width@superView height)
135
claus
parents:
diff changeset
  3844
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3845
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3846
	superWidth := superView width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3847
	superHeight := superView height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3848
	superWinWidth := winSuper width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3849
	superWinHeight := winSuper height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3850
	newLeft := (viewport left - winSuper left) * superWidth // superWinWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3851
	newTop := (viewport top - winSuper top) * superHeight // superWinHeight.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3852
	newWidth := superWidth * viewport width // superWinWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3853
	newHeight := superHeight * viewport height // superWinHeight.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3854
	self pixelOrigin:(newLeft @ newTop).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3855
	self pixelExtent:(newWidth @ newHeight).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3856
	^ self
135
claus
parents:
diff changeset
  3857
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3858
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3859
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3860
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3861
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3862
    layout isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3863
	newOrg := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3864
	newExt := self computeExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3865
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3866
	r := (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3867
			       preferred:(self preferredBounds)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3868
	newOrg := r origin rounded.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3869
	newExt := r extent rounded.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3870
"/ newOrg printNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3871
"/ newExt printNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3872
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3873
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3874
    newOrg notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3875
	((newOrg x == oldLeft) and:[newOrg y == oldTop]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3876
	    newOrg := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3877
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3878
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3879
    newExt notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3880
	((newExt x == width) and:[newExt y == height]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3881
	    newExt := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3882
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3883
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3884
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3885
    newExt isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3886
	newOrg notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3887
	    self pixelOrigin:newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3888
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3889
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3890
	newOrg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3891
	    self pixelExtent:newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3892
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3893
	    self pixelOrigin:newOrg extent:newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3894
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3895
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3896
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3897
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3898
superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3899
    "my superview was mapped (became visible)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3900
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3901
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3902
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3903
	subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3904
	    subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3905
		v superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3906
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3907
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3908
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3909
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3910
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3911
superViewUnmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3912
    "my superView was unmapped"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3913
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3914
    self unmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3915
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3916
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3917
terminate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3918
    "window manager wants me to go away;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3919
     - notice, that not all window managers are nice enough to 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3920
       send this event, but simply destroy the view instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3921
     Can be redefined in subclasses to do whatever cleanup is 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3922
     required."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3923
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3924
    ^ self destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3925
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3926
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3927
unmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3928
    "the view has been unmapped 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3929
     (either by some outside action - i.e. window manager iconified me,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3930
     or due to unmapping of my parentView)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3931
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3932
    shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3933
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3934
	subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3935
	    v superViewUnmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3936
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3937
    ]
135
claus
parents:
diff changeset
  3938
!
claus
parents:
diff changeset
  3939
claus
parents:
diff changeset
  3940
visibilityChange:how
claus
parents:
diff changeset
  3941
    "the visibility of the view has changed (by some outside
claus
parents:
diff changeset
  3942
     action - i.e. window manager rearranged things).
claus
parents:
diff changeset
  3943
     Using this knowledge avoids useless redraw in obsucred views."
claus
parents:
diff changeset
  3944
claus
parents:
diff changeset
  3945
    how == #fullyObscured ifTrue:[
claus
parents:
diff changeset
  3946
	shown := false
claus
parents:
diff changeset
  3947
    ] ifFalse:[
claus
parents:
diff changeset
  3948
	shown := true.
claus
parents:
diff changeset
  3949
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3950
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3951
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3952
!SimpleView methodsFor:'informing others of changes'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3953
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3954
contentsChanged
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3955
    "this one is sent, whenever contents changes size -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3956
     tell dependents about the change (i.e. scrollers)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3957
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3958
    self changed:#sizeOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3959
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3960
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3961
originChanged:delta
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3962
    "this one is sent, after the origin of my contents has changed -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3963
     tell dependents (i.e. scrollers) about this"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3964
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3965
    self changed:#originOfContents with:delta.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3966
"/   subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3967
"/        subViews do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3968
"/            aSubView pixelOrigin:((aSubView left @ aSubView top) - delta)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3969
"/        ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3970
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3971
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3972
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3973
originWillChange
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3974
    "this one is sent, just before viewOrigin changes -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3975
     gives subclasses a chance to catch scrolls easily
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3976
     (for example to hide cursor before scroll)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3977
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3978
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3979
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3980
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3981
!SimpleView methodsFor:'initialization'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3982
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3983
defaultControllerClass
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3984
    ^ nil "/ Controller
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3985
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3986
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3987
defaultExtent
586
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3988
    "return the default extent of my instances."
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3989
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3990
    ^ self class defaultExtent
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3991
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3992
    "Created: 1.3.1996 / 19:20:46 / cg"
586
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3993
    "Modified: 22.4.1996 / 23:38:27 / cg"
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3994
!
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  3995
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3996
initEvents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3997
    "will be sent by create - can be redefined by subclasses to enable
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3998
     view events"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3999
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4000
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4001
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4002
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4003
initStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4004
    "this method sets up all style dependent things"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4005
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4006
    self initStyleSheet.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4007
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4008
    borderWidth := DefaultBorderWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4009
    borderWidth isNil ifTrue:[borderWidth := 1].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4010
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4011
    viewBackground := DefaultViewBackgroundColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4012
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4013
    DefaultLightColor notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4014
	lightColor := DefaultLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4015
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4016
	device hasGreyscales ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4017
	    DefaultLightColor := lightColor := viewBackground lightened.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4018
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4019
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4020
	     this seems strange: on B&W screens, we create the light color 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4021
	     darker than normal viewBackground (White) -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4022
	     to make the boundary of the view visible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4023
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4024
	    lightColor := Color grey:50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4025
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4026
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4027
    DefaultShadowColor notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4028
	shadowColor := DefaultShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4029
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4030
	shadowColor := Black
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4031
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4032
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4033
    lightColor := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4034
    shadowColor := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4035
    borderColor := DefaultBorderColor.
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  4036
    font := self class defaultFont.
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  4037
    font := font on:device.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4038
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4039
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4040
initStyleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4041
    "this method gets the styleSheet"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4042
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4043
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4044
     when coming here the first time, we read the styleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4045
     and keep the values in fast class variables
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4046
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4047
    StyleSheet isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4048
	self class updateStyleCache
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4049
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4050
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4051
    styleSheet := StyleSheet.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4052
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4053
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4054
initialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4055
    "initialize all state of the view - usually redefined in subclasses,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4056
     but always doing a 'super initialize'. Each class should setup its
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4057
     locals - and not forget the others.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4058
     View setup is separated into two parts, the general setup done here
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4059
     and the style specific setup in initStyle. Each view should be prepared
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4060
     for a stylechange by being sent another initStyle with a new style value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4061
     (in this case, it should set all of its style-dependent things, but
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4062
      leave the state and contents as-is)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4063
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4064
    |ext myClass controllerClass|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4065
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4066
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4067
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  4068
    font := self class defaultFont.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4069
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4070
    shown := hiddenOnRealize := realized := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4071
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4072
    "fill in some defaults - some of them are usually redefined in subclasses
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4073
     initialize methods"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4074
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4075
    myClass := self class.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4076
    name := myClass name "asString" asLowercaseFirst.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4077
    resources := myClass classResources.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4078
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4079
    level := margin := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4080
    margin := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4081
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4082
    self initStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4083
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  4084
    ext := self defaultExtent.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4085
    left := top := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4086
    width := ext x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4087
    height := ext y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4088
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4089
    originChanged := extentChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4090
    bitGravity := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4091
    viewGravity := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4092
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4093
    controllerClass := self defaultControllerClass.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4094
    controllerClass notNil ifTrue:[
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  4095
        controller := controllerClass new.
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  4096
        controller view:self.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4097
    ].
483
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  4098
32537786bca6 change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
  4099
    "Modified: 1.3.1996 / 19:21:24 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4100
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4101
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4102
initializeMiddleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4103
    "a place to initialize menu - this one is sent once when the view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4104
     first created; usually redefined in subclasses; default here is no menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4105
     Notice, that static middleButtonmenus are a historic thing in ST/X;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4106
     you may prefer to create the menu dynamically (i.e. the ST-80 way)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4107
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4108
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4109
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4110
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4111
prepareForReinit
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4112
    super prepareForReinit.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4113
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4114
	windowGroup reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4115
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4116
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4117
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4118
reinitStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4119
    "this method is called for a style change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4120
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4121
    |t|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4122
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4123
    self initStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4124
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4125
	"force a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4126
	t := borderWidth. borderWidth := nil. self borderWidth:t.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4127
	t := viewBackground. viewBackground := nil. self viewBackground:t.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4128
	self clear.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4129
	self redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4130
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4131
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4132
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4133
reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4134
    "this is called right snapIn"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4135
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4136
    |myController|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4137
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4138
    "if I have already been reinited - return"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4139
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4140
	^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4141
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4142
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4143
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4144
     superView must be there, first
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4145
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4146
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4147
	superView id isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4148
	    superView reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4149
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4150
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4151
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4152
    myController := controller.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4153
    controller := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4154
    self recreate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4155
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4156
    "if I was mapped, do it again"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4157
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4158
	"only remap if I have a superview - otherwise, I might be
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4159
	 a hidden iconView or menu ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4160
	superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4161
"/            shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4162
		device mapView:self id:drawableId iconified:false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4163
			   atX:left y:top width:width height:height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4164
"/            ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4165
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4166
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4167
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4168
    "restore controller"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4169
    controller := myController
135
claus
parents:
diff changeset
  4170
! !
claus
parents:
diff changeset
  4171
140
claus
parents: 138
diff changeset
  4172
!SimpleView methodsFor:'private'!
claus
parents: 138
diff changeset
  4173
claus
parents: 138
diff changeset
  4174
computeInnerClip
claus
parents: 138
diff changeset
  4175
    "compute, but do not set the inside clip-area"
claus
parents: 138
diff changeset
  4176
claus
parents: 138
diff changeset
  4177
    |m2 nX nY nW nH|
claus
parents: 138
diff changeset
  4178
claus
parents: 138
diff changeset
  4179
    (margin ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4180
	m2 := margin + margin.
claus
parents: 138
diff changeset
  4181
	nX := nY := margin.
claus
parents: 138
diff changeset
  4182
	nW := width - m2.
claus
parents: 138
diff changeset
  4183
	nH := height - m2.
claus
parents: 138
diff changeset
  4184
	transformation notNil ifTrue:[
claus
parents: 138
diff changeset
  4185
	    nX := transformation applyInverseToX:nX.
claus
parents: 138
diff changeset
  4186
	    nY := transformation applyInverseToY:nY.
claus
parents: 138
diff changeset
  4187
	    nW := transformation applyInverseScaleX:nW.
claus
parents: 138
diff changeset
  4188
	    nH := transformation applyInverseScaleY:nH.
claus
parents: 138
diff changeset
  4189
	].
claus
parents: 138
diff changeset
  4190
	innerClipRect := Rectangle 
claus
parents: 138
diff changeset
  4191
				 left:nX 
claus
parents: 138
diff changeset
  4192
				 top:nY 
claus
parents: 138
diff changeset
  4193
				 width:nW 
claus
parents: 138
diff changeset
  4194
				 height:nH
claus
parents: 138
diff changeset
  4195
    ] ifFalse:[
claus
parents: 138
diff changeset
  4196
	"no clipping"
claus
parents: 138
diff changeset
  4197
	innerClipRect := nil
claus
parents: 138
diff changeset
  4198
    ]
claus
parents: 138
diff changeset
  4199
!
claus
parents: 138
diff changeset
  4200
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4201
cornerFromRelativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4202
    "compute & return pixel corner from relativeCorner"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4203
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4204
    ^ self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4205
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4206
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4207
cornerFromRelativeCorner:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4208
    "compute & return pixel corner from a relativeCorner, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4209
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4210
    |p r b bw|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4211
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4212
    p := self pointFromRelative:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4213
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4214
    bw := borderWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4215
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4216
	bw == 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4217
	    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4218
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4219
	^ (p x - bw) @ (p y - bw)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4220
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4221
    r := (insets at:3) + bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4222
    b := (insets at:4) + bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4223
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4224
"/    r := b := bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4225
"/    rightInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4226
"/        r := rightInset + bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4227
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4228
"/    bottomInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4229
"/        b := bottomInset + bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4230
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4231
    ((r ~~ 0) or:[b ~~ 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4232
	^ (p x - r) @ (p y - b)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4233
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4234
    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4235
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4236
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4237
dimensionFromViewport
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4238
    "define my origin/extend from viewport"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4239
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4240
    |relW relH relX relY winW winH org ext|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4241
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4242
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4243
	superView window isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4244
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4245
	    v := superView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4246
	    (v notNil and:[v window isNil]) whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4247
		v := v superview
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4248
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4249
	    v notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4250
		w := v window
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4251
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4252
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4253
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4254
	    winW := 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4255
	    winH := 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4256
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4257
	    winW := superView width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4258
	    winH := superView height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4259
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4260
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4261
	    winW := superView window width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4262
	    winH := superView window height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4263
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4264
	relW := (viewport width / winW) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4265
	relH := (viewport height / winH) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4266
	relX := (viewport left / winW) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4267
	relY := (viewport top / winH) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4268
	"bad coding style ... misuse other method"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4269
	relativeOrigin := (relX @ relY).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4270
	org := self originFromRelativeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4271
	relativeOrigin := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4272
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4273
	"bad coding style ...misuse other method"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4274
	relativeExtent := (relW @ relH).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4275
	ext := self extentFromRelativeExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4276
	relativeExtent := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4277
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4278
	self pixelOrigin:org extent:ext.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4279
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4280
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4281
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4282
extentFromRelativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4283
    "compute & return pixel extent from relativeExtent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4284
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4285
    ^ self extentFromRelativeExtent:relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4286
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4287
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4288
extentFromRelativeExtent:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4289
    "compute & return pixel extent from relativeExtent, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4290
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4291
    |rel newX newY inRect bw2 i|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4292
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4293
    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4294
	inRect := 0@0 extent:device extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4295
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4296
	inRect := superView viewRectangle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4297
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4298
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4299
    bw2 := borderWidth * 2.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4300
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4301
    rel := aPoint x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4302
    rel isInteger ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4303
	newX := (rel * (inRect width + bw2)) asInteger + inRect left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4304
	(borderWidth ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4305
	    newX := newX - borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4306
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4307
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4308
	newX := rel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4309
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4310
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4311
    rel := aPoint y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4312
    rel isInteger ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4313
	newY := (rel * (inRect height + bw2)) asInteger + inRect top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4314
	(borderWidth ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4315
	    newY := newY - borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4316
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4317
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4318
	newY := rel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4319
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4320
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4321
    insets notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4322
	i := insets at:1.   "top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4323
	(i  ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4324
	    newX := newX - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4325
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4326
	i := insets at:3.   "left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4327
	(i  ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4328
	    newX := newX - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4329
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4330
	i := insets at:2.   "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4331
	(i ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4332
	    newY := newY - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4333
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4334
	i := insets at:4.   "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4335
	(i ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4336
	    newY := newY - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4337
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4338
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4339
    ^ newX @ newY
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4340
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4341
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4342
originFromRelativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4343
    "compute & return pixel origin from relativeOrigin"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4344
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4345
    ^ self originFromRelativeOrigin:relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4346
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4347
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4348
originFromRelativeOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4349
    "compute & return pixel origin from relativeOrigin, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4350
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4351
    |p l t|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4352
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4353
    p := self pointFromRelative:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4354
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4355
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4356
	^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4357
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4358
    l := insets at:1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4359
    t := insets at:2.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4360
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4361
"/  l := t := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4362
"/    leftInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4363
"/        l := leftInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4364
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4365
"/    topInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4366
"/        t := topInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4367
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4368
    ((l ~~ 0) or:[t ~~ 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4369
	^ (p x + l) @ (p y + t)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4370
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4371
    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4372
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4373
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4374
pixelCorner:corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4375
    "set the views corner in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4376
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4377
    |w h|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4378
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4379
    w := corner x - left + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4380
    h := corner y - top + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4381
    self pixelOrigin:(left @ top) extent:(w @ h)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4382
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4383
    "Modified: 31.8.1995 / 18:20:22 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4384
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4385
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4386
pixelExtent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4387
    "set the views extent in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4388
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4389
    self pixelOrigin:(left @ top) extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4390
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4391
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4392
pixelOrigin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4393
    "set the views origin in pixels. For subviews. the origin is relative
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4394
     to the superviews top-left. For topViews, its the screen origin."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4395
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4396
    |newLeft newTop|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4397
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4398
    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4399
    newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4400
    ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4401
	top := newTop.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4402
	left := newLeft.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4403
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4404
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4405
	 if the receiver is visible, or is a topView, perform the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4406
	 operation right away - otherwise, simply remember that the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4407
	 origin has changed - will tell the display once we get realized
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4408
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4409
"/        (shown 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4410
"/        or:[superView isNil and:[drawableId notNil]]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4411
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4412
	"/ no, have to do it if drawableId is there
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4413
	"/ (otherwise, we could not move unmapped views around ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4414
	"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4415
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4416
	    device moveWindow:drawableId x:left y:top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4417
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4418
	    originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4419
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4420
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4421
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4422
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4423
pixelOrigin:origin corner:corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4424
    "set the views origin and corner in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4425
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4426
    |w h|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4427
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4428
    w := corner x - origin x + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4429
    h := corner y - origin y + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4430
    self pixelOrigin:origin extent:(w @ h)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4431
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4432
    "Modified: 31.8.1995 / 18:24:16 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4433
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4434
140
claus
parents: 138
diff changeset
  4435
pixelOrigin:origin extent:extent
claus
parents: 138
diff changeset
  4436
    "set the views origin and extent in pixels"
claus
parents: 138
diff changeset
  4437
claus
parents: 138
diff changeset
  4438
    |newLeft newTop newWidth newHeight how 
claus
parents: 138
diff changeset
  4439
     mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom
claus
parents: 138
diff changeset
  4440
     mustRepaintRight sameOrigin oldWidth oldHeight|
claus
parents: 138
diff changeset
  4441
claus
parents: 138
diff changeset
  4442
    newLeft := origin x.
claus
parents: 138
diff changeset
  4443
    newTop := origin y.
claus
parents: 138
diff changeset
  4444
    sameOrigin := ((newTop == top) and:[newLeft == left]).
claus
parents: 138
diff changeset
  4445
claus
parents: 138
diff changeset
  4446
    newWidth := extent x.
claus
parents: 138
diff changeset
  4447
    newHeight := extent y.
claus
parents: 138
diff changeset
  4448
claus
parents: 138
diff changeset
  4449
    "
claus
parents: 138
diff changeset
  4450
     X complains badly if you try to create/resize a view with
claus
parents: 138
diff changeset
  4451
     a dimension <= 0 ... (although I think that 0 maks sense ...)
claus
parents: 138
diff changeset
  4452
    "
claus
parents: 138
diff changeset
  4453
    newWidth < 1 ifTrue:[
claus
parents: 138
diff changeset
  4454
	newWidth := 1.
claus
parents: 138
diff changeset
  4455
    ].
claus
parents: 138
diff changeset
  4456
    newHeight < 1 ifTrue:[
claus
parents: 138
diff changeset
  4457
	newHeight := 1
claus
parents: 138
diff changeset
  4458
    ].
claus
parents: 138
diff changeset
  4459
claus
parents: 138
diff changeset
  4460
    ((newWidth == width) and:[newHeight == height]) ifTrue:[
claus
parents: 138
diff changeset
  4461
	sameOrigin ifTrue:[^ self].
claus
parents: 138
diff changeset
  4462
	^ self pixelOrigin:origin
claus
parents: 138
diff changeset
  4463
    ].
claus
parents: 138
diff changeset
  4464
    top := newTop.
claus
parents: 138
diff changeset
  4465
    left := newLeft.
claus
parents: 138
diff changeset
  4466
claus
parents: 138
diff changeset
  4467
"/    shown ifTrue:[                  "4-nov-94 actually correct,"
claus
parents: 138
diff changeset
  4468
    drawableId notNil ifTrue:[        "but theres a bug in menus when resized while hidden"
151
claus
parents: 145
diff changeset
  4469
	mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height].
claus
parents: 145
diff changeset
  4470
	mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width].
claus
parents: 145
diff changeset
  4471
claus
parents: 145
diff changeset
  4472
	((newHeight <= height) and:[newWidth <= width]) ifTrue:[
claus
parents: 145
diff changeset
  4473
	    how := #smaller
claus
parents: 145
diff changeset
  4474
	].
claus
parents: 145
diff changeset
  4475
140
claus
parents: 138
diff changeset
  4476
	mustRepaintRight := false.
claus
parents: 138
diff changeset
  4477
	mustRepaintBottom := false.
claus
parents: 138
diff changeset
  4478
	(level ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4479
	    "clear the old edges"
claus
parents: 138
diff changeset
  4480
claus
parents: 138
diff changeset
  4481
	    newWidth > width ifTrue:[
claus
parents: 138
diff changeset
  4482
		self clipRect:nil.
claus
parents: 138
diff changeset
  4483
		self paint:viewBackground.
claus
parents: 138
diff changeset
  4484
		self fillDeviceRectangleX:(width - margin)
claus
parents: 138
diff changeset
  4485
					y:0
claus
parents: 138
diff changeset
  4486
				    width:margin
claus
parents: 138
diff changeset
  4487
				   height:height.
claus
parents: 138
diff changeset
  4488
		mustRepaintRight := true.
claus
parents: 138
diff changeset
  4489
		oldWidth := width
claus
parents: 138
diff changeset
  4490
	    ].
claus
parents: 138
diff changeset
  4491
	    newHeight > height ifTrue:[
claus
parents: 138
diff changeset
  4492
		self clipRect:nil.
claus
parents: 138
diff changeset
  4493
		self paint:viewBackground.
claus
parents: 138
diff changeset
  4494
		self fillDeviceRectangleX:0
claus
parents: 138
diff changeset
  4495
					y:(height - margin)
claus
parents: 138
diff changeset
  4496
				    width:width
claus
parents: 138
diff changeset
  4497
				   height:margin.
claus
parents: 138
diff changeset
  4498
		mustRepaintBottom := true.
claus
parents: 138
diff changeset
  4499
		oldHeight := height
claus
parents: 138
diff changeset
  4500
	    ]
claus
parents: 138
diff changeset
  4501
	].
claus
parents: 138
diff changeset
  4502
claus
parents: 138
diff changeset
  4503
	width := newWidth.
claus
parents: 138
diff changeset
  4504
	height := newHeight.
claus
parents: 138
diff changeset
  4505
claus
parents: 138
diff changeset
  4506
	self setInnerClip.
claus
parents: 138
diff changeset
  4507
claus
parents: 138
diff changeset
  4508
	"if view becomes smaller, send sizeChanged first"
claus
parents: 138
diff changeset
  4509
	(how == #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4510
	    self sizeChanged:how
claus
parents: 138
diff changeset
  4511
	].
claus
parents: 138
diff changeset
  4512
claus
parents: 138
diff changeset
  4513
	"have to tell X, when extent of view is changed"
claus
parents: 138
diff changeset
  4514
	sameOrigin ifTrue:[
claus
parents: 138
diff changeset
  4515
	    device resizeWindow:drawableId width:width height:height.
claus
parents: 138
diff changeset
  4516
	] ifFalse:[
claus
parents: 138
diff changeset
  4517
	    "claus: some xservers seem to do better when resizing
claus
parents: 138
diff changeset
  4518
	     first ...."
claus
parents: 138
diff changeset
  4519
" 
claus
parents: 138
diff changeset
  4520
	    (how == #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4521
		device resizeWindow:drawableId width:width height:height.
claus
parents: 138
diff changeset
  4522
		device moveWindow:drawableId x:left y:top
claus
parents: 138
diff changeset
  4523
	    ] ifFalse:[
claus
parents: 138
diff changeset
  4524
		device moveResizeWindow:drawableId x:left y:top width:width height:height
claus
parents: 138
diff changeset
  4525
	    ].
claus
parents: 138
diff changeset
  4526
" 
claus
parents: 138
diff changeset
  4527
	    device moveResizeWindow:drawableId x:left y:top
claus
parents: 138
diff changeset
  4528
					   width:width height:height.
claus
parents: 138
diff changeset
  4529
" "
claus
parents: 138
diff changeset
  4530
	].
claus
parents: 138
diff changeset
  4531
claus
parents: 138
diff changeset
  4532
	"if view becomes bigger, send sizeChanged after"
claus
parents: 138
diff changeset
  4533
	(how ~~ #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4534
	    self sizeChanged:how
claus
parents: 138
diff changeset
  4535
	].
claus
parents: 138
diff changeset
  4536
claus
parents: 138
diff changeset
  4537
	(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[
claus
parents: 138
diff changeset
  4538
	    self clipRect:nil.
claus
parents: 138
diff changeset
  4539
	    mustRedrawBottomEdge ifTrue:[
claus
parents: 138
diff changeset
  4540
		self drawBottomEdge
claus
parents: 138
diff changeset
  4541
	    ].
claus
parents: 138
diff changeset
  4542
	    mustRedrawRightEdge ifTrue:[
claus
parents: 138
diff changeset
  4543
		self drawRightEdge
claus
parents: 138
diff changeset
  4544
	    ].
claus
parents: 138
diff changeset
  4545
	    self clipRect:innerClipRect
claus
parents: 138
diff changeset
  4546
	].
claus
parents: 138
diff changeset
  4547
claus
parents: 138
diff changeset
  4548
	mustRepaintRight ifTrue:[
claus
parents: 138
diff changeset
  4549
	    self redrawDeviceX:(oldWidth - margin)
claus
parents: 138
diff changeset
  4550
			     y:0
claus
parents: 138
diff changeset
  4551
			 width:margin
claus
parents: 138
diff changeset
  4552
			height:height.
claus
parents: 138
diff changeset
  4553
	].
claus
parents: 138
diff changeset
  4554
	mustRepaintBottom ifTrue:[
claus
parents: 138
diff changeset
  4555
	    self redrawDeviceX:0
claus
parents: 138
diff changeset
  4556
			     y:(oldHeight - margin)
claus
parents: 138
diff changeset
  4557
			 width:width
claus
parents: 138
diff changeset
  4558
			height:margin.
claus
parents: 138
diff changeset
  4559
	].
claus
parents: 138
diff changeset
  4560
    ] ifFalse:[
claus
parents: 138
diff changeset
  4561
	"otherwise memorize the need for a sizeChanged message"
claus
parents: 138
diff changeset
  4562
claus
parents: 138
diff changeset
  4563
	width := newWidth.
claus
parents: 138
diff changeset
  4564
	height := newHeight.
claus
parents: 138
diff changeset
  4565
	sameOrigin ifFalse:[
claus
parents: 138
diff changeset
  4566
	    originChanged := true.
claus
parents: 138
diff changeset
  4567
	].
claus
parents: 138
diff changeset
  4568
	extentChanged := true
claus
parents: 138
diff changeset
  4569
    ]
claus
parents: 138
diff changeset
  4570
!
claus
parents: 138
diff changeset
  4571
claus
parents: 138
diff changeset
  4572
pointFromRelative:p
claus
parents: 138
diff changeset
  4573
    "compute absolute coordinate from p"
claus
parents: 138
diff changeset
  4574
claus
parents: 138
diff changeset
  4575
    |newX newY rel inRect bw superWidth superHeight superLeft superTop |
claus
parents: 138
diff changeset
  4576
claus
parents: 138
diff changeset
  4577
    bw := borderWidth.
claus
parents: 138
diff changeset
  4578
claus
parents: 138
diff changeset
  4579
    superView isNil ifTrue:[
claus
parents: 138
diff changeset
  4580
	superWidth := device width + bw.      
claus
parents: 138
diff changeset
  4581
	superHeight := device height + bw.
claus
parents: 138
diff changeset
  4582
	superLeft := superTop := 0.
claus
parents: 138
diff changeset
  4583
    ] ifFalse:[
claus
parents: 138
diff changeset
  4584
	inRect := superView viewRectangle.
claus
parents: 138
diff changeset
  4585
	superWidth := inRect width.
claus
parents: 138
diff changeset
  4586
	superHeight := inRect height.
claus
parents: 138
diff changeset
  4587
	superLeft := inRect left.
claus
parents: 138
diff changeset
  4588
	superTop := inRect top.
claus
parents: 138
diff changeset
  4589
    ].
claus
parents: 138
diff changeset
  4590
claus
parents: 138
diff changeset
  4591
    rel := p x.
claus
parents: 138
diff changeset
  4592
    rel isInteger ifTrue:[
claus
parents: 138
diff changeset
  4593
	newX := rel
claus
parents: 138
diff changeset
  4594
    ] ifFalse:[
claus
parents: 138
diff changeset
  4595
	newX := (rel * superWidth) asInteger + superLeft.
claus
parents: 138
diff changeset
  4596
	(bw ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4597
	    rel ~= 1.0 ifTrue:[
claus
parents: 138
diff changeset
  4598
		newX := newX - bw
claus
parents: 138
diff changeset
  4599
	    ]
claus
parents: 138
diff changeset
  4600
	]
claus
parents: 138
diff changeset
  4601
    ].
claus
parents: 138
diff changeset
  4602
claus
parents: 138
diff changeset
  4603
    rel := p y.
claus
parents: 138
diff changeset
  4604
    rel isInteger ifTrue:[
claus
parents: 138
diff changeset
  4605
	newY := rel
claus
parents: 138
diff changeset
  4606
    ] ifFalse:[
claus
parents: 138
diff changeset
  4607
	newY := (rel * superHeight) asInteger + superTop.
claus
parents: 138
diff changeset
  4608
	(bw ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4609
	    rel ~= 1.0 ifTrue:[
claus
parents: 138
diff changeset
  4610
		newY := newY - bw
claus
parents: 138
diff changeset
  4611
	    ]
claus
parents: 138
diff changeset
  4612
	]
claus
parents: 138
diff changeset
  4613
    ].
claus
parents: 138
diff changeset
  4614
    ^ newX @ newY
claus
parents: 138
diff changeset
  4615
!
claus
parents: 138
diff changeset
  4616
claus
parents: 138
diff changeset
  4617
setBorderColor
claus
parents: 138
diff changeset
  4618
    "set my borderColor"
claus
parents: 138
diff changeset
  4619
claus
parents: 138
diff changeset
  4620
    |id dither|
claus
parents: 138
diff changeset
  4621
claus
parents: 138
diff changeset
  4622
    drawableId notNil ifTrue:[
claus
parents: 138
diff changeset
  4623
	borderColor := borderColor on:device.
claus
parents: 138
diff changeset
  4624
	id := borderColor colorId.
claus
parents: 138
diff changeset
  4625
	id notNil ifTrue:[
claus
parents: 138
diff changeset
  4626
	    device setWindowBorderColor:id in:drawableId
claus
parents: 138
diff changeset
  4627
	] ifFalse:[
claus
parents: 138
diff changeset
  4628
	    dither := borderColor ditherForm.
claus
parents: 138
diff changeset
  4629
	    dither notNil ifTrue:[
claus
parents: 138
diff changeset
  4630
		device setWindowBorderPixmap:(dither id) in:drawableId
claus
parents: 138
diff changeset
  4631
	    ] ifFalse:[
145
claus
parents: 144
diff changeset
  4632
		'VIEW: bad borderColor' errorPrintNL
135
claus
parents:
diff changeset
  4633
	    ]
claus
parents:
diff changeset
  4634
	]
claus
parents:
diff changeset
  4635
    ]
claus
parents:
diff changeset
  4636
!
claus
parents:
diff changeset
  4637
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4638
setInnerClip
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4639
    "compute, and set the inside clip-area"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4640
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4641
    self computeInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4642
    self clipRect:innerClipRect
140
claus
parents: 138
diff changeset
  4643
! !
claus
parents: 138
diff changeset
  4644
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4645
!SimpleView methodsFor:'queries'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4646
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4647
buttonMotionEventPending
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4648
    "return true, if a button motion event is pending.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4649
     Normally, you dont want to use this, since no polling is needed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4650
     (not even for mouse-tracking).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4651
     Dont use it, since it does not honor the windowGroup, but
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4652
     goes directly to the device instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4653
     Actually, its a historical leftover"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4654
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4655
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4656
	^ windowGroup sensor hasButtonMotionEventsFor:self
140
claus
parents: 138
diff changeset
  4657
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4658
    ^ super buttonMotionEventPending
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4659
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4660
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4661
canDrop:anObjectOrCollection
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4662
    "return true, if anObjectOrCollection can be
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4663
     dropped in the receiver. This method should be
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4664
     redefined in views which can take objects"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4665
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4666
    ^ false
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4667
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4668
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4669
canHandle:aKey
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4670
    "return true, if I like to handle the key (from a keyPress event).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4671
     OBSOLETE: do not use & depend on this method, it is a historic
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4672
     leftOver and will be removed. Use the delegation mechanism for this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4673
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4674
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4675
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4676
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4677
canHandle:aKey from:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4678
    "return true, if I like to handle the key (from a keyPress event)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4679
     in aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4680
     OBSOLETE: do not use & depend on this method, it is a historic
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4681
     leftOver and will be removed. Use the delegation mechanism for this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4682
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4683
    ^ self canHandle:aKey
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4684
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4685
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4686
delegatesTo:someone
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4687
    "return true, if I delegate events to someone"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4688
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4689
    delegate isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4690
    ^ delegate delegatesTo:someone
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4691
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4692
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4693
hasFocus
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4694
    "return true, if the receiver has the keyboard focus
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4695
     (either via the focusView mechanism in the windowGroup,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4696
      or via delegation)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4697
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4698
    |focusView delegate|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4699
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4700
    windowGroup isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4701
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4702
    (focusView := windowGroup focusView) == self ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4703
    focusView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4704
	"mhmh - is there a delegation to me ?"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4705
	(delegate := focusView delegate) notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4706
	    delegate == self ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4707
	    ^ delegate delegatesTo:self
135
claus
parents:
diff changeset
  4708
	]
claus
parents:
diff changeset
  4709
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4710
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4711
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4712
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4713
is3D
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4714
    "return true, if my style is some kind of 3D style
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4715
     This is OBSOLETE and will be removed."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4716
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4717
    ^ styleSheet is3D
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4718
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4719
497
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4720
isInputField
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4721
    "return true, if the receiver is some kind of input view,
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4722
     i.e. it should (can) be part of an enterGroup.
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4723
     Return false here, this is redefined in EnterField."
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4724
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4725
    ^ false
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4726
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4727
    "Created: 4.3.1996 / 11:34:07 / cg"
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4728
!
5c2f58720c62 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 494
diff changeset
  4729
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4730
isPopUpView
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4731
    "return true, if this view should be put on top (raised) automatically.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4732
     usually this is true for alertBoxes etc."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4733
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4734
    ^ false
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4735
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4736
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4737
isSubViewOf:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4738
    "return true, if I am a subview of aView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4739
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4740
    aView == self isNil ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4741
    superView isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4742
    superView == aView ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4743
    ^ superView isSubViewOf:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4744
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4745
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4746
isView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4747
    "return true, if the receiver is some kind of view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4748
     true is returned here."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4749
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4750
    ^ true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4751
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4752
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4753
preferredBounds
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4754
    "ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4755
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4756
    ^ 0@0 corner:self preferredExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4757
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4758
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4759
preferredExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4760
    "return my preferred extent - this is the minimum size I would like to have.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4761
     The default here is the actual extent, the receiver currently has."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4762
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4763
    "mhmh - if I have components, collect their
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4764
     preferred bounds ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4765
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4766
    |maxX maxY|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4767
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4768
    subViews isNil ifTrue:[^ self extent].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4769
"/    ^ self extent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4770
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4771
    maxX := maxY := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4772
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4773
	subViews do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4774
	    |org corn|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4775
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4776
	    org := aSubView computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4777
	    corn := org + aSubView preferredExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4778
	    maxX := maxX max:corn x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4779
	    maxY := maxY max:corn y.
140
claus
parents: 138
diff changeset
  4780
	]
claus
parents: 138
diff changeset
  4781
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4782
    ^ maxX @ maxY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4783
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4784
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4785
sizeFixed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4786
    "return true, if this vew wants its size to remain unchanged.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4787
     Used by panels, to check if their components want to keep their size."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4788
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4789
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4790
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4791
    "Created: 17.9.1995 / 20:29:20 / claus"
140
claus
parents: 138
diff changeset
  4792
! !
claus
parents: 138
diff changeset
  4793
claus
parents: 138
diff changeset
  4794
!SimpleView methodsFor:'realization'!
claus
parents: 138
diff changeset
  4795
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4796
create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4797
    "create (i.e. tell my device about me) if not already created.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4798
     This does not make the view visible (needs a #map for that)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4799
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4800
    drawableId isNil ifTrue:[
151
claus
parents: 145
diff changeset
  4801
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4802
	 make certain that superview is created also
151
claus
parents: 145
diff changeset
  4803
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4804
	superView notNil ifTrue:[
355
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4805
	     superView create.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4806
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4807
"/            "and put my controller into the superviews controller list"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4808
"/            controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4809
"/                superView controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4810
"/                    controller manager:(superView controller manager)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4811
"/                ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4812
"/            ]
355
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4813
	] ifFalse:[
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4814
	    "/
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4815
	    "/ if the display is not already dispatching events,
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4816
	    "/ this starts the event process.
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4817
	    "/
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4818
	    device startDispatch
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4819
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4820
343
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4821
	cursor notNil ifTrue:[
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4822
	    cursor := cursor on:device.
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4823
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4824
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4825
	self physicalCreate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4826
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4827
	viewBackground notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4828
	   self setViewBackground
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4829
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4830
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4831
	self initializeMiddleButtonMenu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4832
	self initEvents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4833
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4834
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4835
	 this is the first create,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4836
	 force sizechange messages to be sent to the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4837
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4838
	extentChanged := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4839
	originChanged := true
151
claus
parents: 145
diff changeset
  4840
    ]
claus
parents: 145
diff changeset
  4841
!
claus
parents: 145
diff changeset
  4842
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4843
createWithAllSubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4844
    "create, then create all subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4845
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4846
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4847
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4848
	subViews do:[:subView | subView createWithAllSubViews]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4849
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4850
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4851
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4852
destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4853
    "unrealize & destroy - make me invisible, destroy subviews then
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4854
     make me unknown to the device"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4855
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4856
    |subs|
140
claus
parents: 138
diff changeset
  4857
claus
parents: 138
diff changeset
  4858
    realized ifTrue:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4859
	self unrealize.            
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4860
	"make it go away immediately
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4861
	 - also, this hides the subview killing"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4862
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4863
	device synchronizeOutput. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4864
"
151
claus
parents: 145
diff changeset
  4865
    ].
claus
parents: 145
diff changeset
  4866
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4867
"/    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4868
"/      controller release.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4869
"/      controller := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4870
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4871
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4872
    subs := subViews.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4873
    subs notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4874
	"stupid: destroy removes itself from the subview list
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4875
	 - therefore we have to loop over a copy here"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4876
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4877
	subViews := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4878
	subs do:[:aView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4879
	    aView notNil ifTrue:[aView destroy]             
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4880
	]
140
claus
parents: 138
diff changeset
  4881
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4882
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4883
	superView removeSubView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4884
	superView := nil
140
claus
parents: 138
diff changeset
  4885
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4886
    super destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4887
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4888
    superView isNil ifTrue:[
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4889
	device flush
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4890
    ].
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4891
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4892
    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4893
	controller release.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4894
	controller := nil.
140
claus
parents: 138
diff changeset
  4895
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4896
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4897
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4898
	windowGroup removeView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4899
	windowGroup := nil
140
claus
parents: 138
diff changeset
  4900
    ].
claus
parents: 138
diff changeset
  4901
!
claus
parents: 138
diff changeset
  4902
claus
parents: 138
diff changeset
  4903
fixSize
claus
parents: 138
diff changeset
  4904
    "This is called right before the view is made visible.
claus
parents: 138
diff changeset
  4905
     Adjust the size of the view according to either relative/abs or
claus
parents: 138
diff changeset
  4906
     block extent; also set origin. Also, subclasses may redefine this
claus
parents: 138
diff changeset
  4907
     method to adjust the size based on some extent (for example, PopUpMenus
claus
parents: 138
diff changeset
  4908
     do so to take care of changed number of menu entries)."
claus
parents: 138
diff changeset
  4909
151
claus
parents: 145
diff changeset
  4910
    |org ext r|
claus
parents: 145
diff changeset
  4911
claus
parents: 145
diff changeset
  4912
    "please: no longer use window/viewport - they will vanish"
140
claus
parents: 138
diff changeset
  4913
    window notNil ifTrue:[
claus
parents: 138
diff changeset
  4914
	^ self superViewChangedSize
claus
parents: 138
diff changeset
  4915
    ].
claus
parents: 138
diff changeset
  4916
151
claus
parents: 145
diff changeset
  4917
    "
claus
parents: 145
diff changeset
  4918
     slowly migrating to use layoutObjects ...
claus
parents: 145
diff changeset
  4919
    "
claus
parents: 145
diff changeset
  4920
    layout notNil ifTrue:[
claus
parents: 145
diff changeset
  4921
	(originChanged or:[extentChanged or:[cornerChanged]]) ifTrue:[
claus
parents: 145
diff changeset
  4922
	    r := (layout rectangleRelativeTo:(superView viewRectangle)
claus
parents: 145
diff changeset
  4923
				   preferred:(self preferredBounds)).
claus
parents: 145
diff changeset
  4924
	    org := r origin rounded.
claus
parents: 145
diff changeset
  4925
	    ext := r extent rounded.
claus
parents: 145
diff changeset
  4926
	    self pixelOrigin:org extent:ext.
claus
parents: 145
diff changeset
  4927
	].
claus
parents: 145
diff changeset
  4928
	^ self.
claus
parents: 145
diff changeset
  4929
    ].
claus
parents: 145
diff changeset
  4930
140
claus
parents: 138
diff changeset
  4931
    "if the extent is not the one we created the window with ..."
claus
parents: 138
diff changeset
  4932
    extentChanged ifTrue:[
claus
parents: 138
diff changeset
  4933
	self sizeChanged:nil.
claus
parents: 138
diff changeset
  4934
	extentChanged := false
claus
parents: 138
diff changeset
  4935
    ].
claus
parents: 138
diff changeset
  4936
claus
parents: 138
diff changeset
  4937
    originChanged ifTrue:[
claus
parents: 138
diff changeset
  4938
"/        org := self computeOrigin.
claus
parents: 138
diff changeset
  4939
"/        self pixelOrigin:org.    
claus
parents: 138
diff changeset
  4940
	originRule notNil ifTrue:[
claus
parents: 138
diff changeset
  4941
	    self pixelOrigin:self computeOrigin
claus
parents: 138
diff changeset
  4942
	] ifFalse:[
claus
parents: 138
diff changeset
  4943
	    relativeOrigin notNil ifTrue:[
claus
parents: 138
diff changeset
  4944
		self originFromRelativeOrigin:relativeOrigin
claus
parents: 138
diff changeset
  4945
	    ] ifFalse:[
151
claus
parents: 145
diff changeset
  4946
		shown ifTrue:[
claus
parents: 145
diff changeset
  4947
		    device moveWindow:drawableId x:left y:top.
claus
parents: 145
diff changeset
  4948
		] ifFalse:[
claus
parents: 145
diff changeset
  4949
		    self pixelOrigin:left@top
claus
parents: 145
diff changeset
  4950
		].
140
claus
parents: 138
diff changeset
  4951
	    ].
claus
parents: 138
diff changeset
  4952
	].
claus
parents: 138
diff changeset
  4953
	originChanged := false
claus
parents: 138
diff changeset
  4954
    ]
claus
parents: 138
diff changeset
  4955
!
claus
parents: 138
diff changeset
  4956
393
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4957
hide
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4958
    "for protocol compatibility with modal dialogs;
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4959
     ignored here."
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4960
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4961
    ^ self
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4962
!
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4963
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4964
hideRequest
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4965
    "for protocol compatibility with modal dialogs;
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4966
     ignored here."
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4967
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4968
    ^ self
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4969
!
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4970
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4971
map
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4972
    "make the view visible on the screen"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4973
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4974
    realized ifFalse:[
140
claus
parents: 138
diff changeset
  4975
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4976
	 now, make the view visible
140
claus
parents: 138
diff changeset
  4977
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4978
	device mapWindow:drawableId.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4979
	realized := true.
140
claus
parents: 138
diff changeset
  4980
    ]
claus
parents: 138
diff changeset
  4981
!
claus
parents: 138
diff changeset
  4982
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4983
physicalCreate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4984
    "common code for create & recreate: 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4985
     physically create (but do not map) the view on the device."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4986
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4987
    "associate colors to device"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4988
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4989
    drawableId := device 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4990
		      createWindowFor:self 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4991
			  origin:(left @ top)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4992
			  extent:(width @ height)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4993
			  minExtent:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4994
			  maxExtent:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4995
			  borderWidth:borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4996
			  subViewOf:superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4997
			  onTop:(self isPopUpView)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4998
			  inputOnly:(self inputOnly)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4999
			  label:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5000
			  cursor:cursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5001
			  icon:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5002
			  iconView:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5003
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5004
    Lobby registerChange:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5005
    extentChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5006
    originChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5007
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5008
    (borderColor notNil and:[borderColor ~~ Black]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5009
"/        borderColor := borderColor on:device.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5010
	self setBorderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5011
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5012
    (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5013
	device setWindowGravity:viewGravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5014
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5015
    (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5016
	device setBitGravity:bitGravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5017
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5018
    borderShape notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5019
	device setWindowBorderShape:(borderShape id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5020
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5021
    viewShape notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5022
	device setWindowShape:(viewShape id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5023
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5024
    (backed notNil and:[backed ~~ false]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5025
	device setBackingStore:backed in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5026
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5027
    saveUnder ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5028
	device setSaveUnder:true in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5029
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5030
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5031
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5032
realize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5033
    "realize - make visible;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5034
     realizing is done very late (after layout is fixed) to avoid
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5035
     visible rearranging of windows on the screen"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5036
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5037
    self realizeKeepingGroup:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5038
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5039
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5040
realizeAllSubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5041
    "realize all my subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5042
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5043
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5044
	subViews do:[:subView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5045
	    subView realize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5046
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5047
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5048
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5049
    "Modified: 5.9.1995 / 23:30:47 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5050
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5051
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5052
realizeInGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5053
    "special realize - leave windowgroup as is; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5054
     This allows a view to be realized in any windowgroup; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5055
     for special applications, like the kill button in the Filebrowser which has
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5056
     a windowGroup different from its superview's and is handled as a separate process."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5057
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5058
    windowGroup isForModalSubview:true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5059
    self realize.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5060
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5061
"/    self realizeKeepingGroup:true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5062
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5063
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5064
realizeKeepingGroup:keepGroupAsIs 
151
claus
parents: 145
diff changeset
  5065
    "common helper for realize and realizeInGroup.
claus
parents: 145
diff changeset
  5066
     Create the view, if the argument is not true, assign my windowGroup,
claus
parents: 145
diff changeset
  5067
     if hiddenOnRealize is not true, map it."
140
claus
parents: 138
diff changeset
  5068
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5069
    |superGroup groupChange keep|
140
claus
parents: 138
diff changeset
  5070
claus
parents: 138
diff changeset
  5071
    drawableId isNil ifTrue:[
claus
parents: 138
diff changeset
  5072
	self create.
claus
parents: 138
diff changeset
  5073
    ].
claus
parents: 138
diff changeset
  5074
372
78e5b6e96649 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
  5075
    groupChange := false.
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5076
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5077
    (windowGroup notNil and:[windowGroup isForModalSubview]) ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5078
	keep := true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5079
    ] ifFalse:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5080
	keep := keepGroupAsIs
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5081
    ].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5082
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5083
    keep ifFalse:[
140
claus
parents: 138
diff changeset
  5084
	"
claus
parents: 138
diff changeset
  5085
	 put myself into superviews windowgroup if there is a superview
claus
parents: 138
diff changeset
  5086
	"
claus
parents: 138
diff changeset
  5087
	superView notNil ifTrue:[
claus
parents: 138
diff changeset
  5088
	    superGroup := superView windowGroup.
claus
parents: 138
diff changeset
  5089
	    (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[
claus
parents: 138
diff changeset
  5090
		"
claus
parents: 138
diff changeset
  5091
		 mhmh - seems that the windowgroup has changed ....
claus
parents: 138
diff changeset
  5092
		"
145
claus
parents: 144
diff changeset
  5093
"/                'oops - wgroup change on realize' printNL.
140
claus
parents: 138
diff changeset
  5094
		windowGroup removeView:self.
claus
parents: 138
diff changeset
  5095
		windowGroup := nil
claus
parents: 138
diff changeset
  5096
	    ].
claus
parents: 138
diff changeset
  5097
	    superGroup ~~ windowGroup ifTrue:[
claus
parents: 138
diff changeset
  5098
		groupChange := true.
claus
parents: 138
diff changeset
  5099
		windowGroup := superGroup.
claus
parents: 138
diff changeset
  5100
		windowGroup notNil ifTrue:[
claus
parents: 138
diff changeset
  5101
		    windowGroup addView:self.
claus
parents: 138
diff changeset
  5102
		]
claus
parents: 138
diff changeset
  5103
	    ]
claus
parents: 138
diff changeset
  5104
	].
claus
parents: 138
diff changeset
  5105
    ].
claus
parents: 138
diff changeset
  5106
151
claus
parents: 145
diff changeset
  5107
    hiddenOnRealize ifFalse:[
175
claus
parents: 173
diff changeset
  5108
	(originChanged or:[extentChanged]) ifTrue:[
claus
parents: 173
diff changeset
  5109
	    self fixSize.
claus
parents: 173
diff changeset
  5110
	    self sizeChanged:nil.   "/ new 29-aug-1995
claus
parents: 173
diff changeset
  5111
	].
140
claus
parents: 138
diff changeset
  5112
claus
parents: 138
diff changeset
  5113
	(realized not or:[groupChange]) ifTrue:[
claus
parents: 138
diff changeset
  5114
	    subViews notNil ifTrue:[
180
claus
parents: 176
diff changeset
  5115
		self realizeAllSubViews.
140
claus
parents: 138
diff changeset
  5116
	    ].
claus
parents: 138
diff changeset
  5117
	].
claus
parents: 138
diff changeset
  5118
	self setInnerClip.
claus
parents: 138
diff changeset
  5119
claus
parents: 138
diff changeset
  5120
	realized ifFalse:[
claus
parents: 138
diff changeset
  5121
	    "
claus
parents: 138
diff changeset
  5122
	     now, make the view visible
claus
parents: 138
diff changeset
  5123
	    "
151
claus
parents: 145
diff changeset
  5124
	    self map
140
claus
parents: 138
diff changeset
  5125
	]
claus
parents: 138
diff changeset
  5126
    ].
claus
parents: 138
diff changeset
  5127
claus
parents: 138
diff changeset
  5128
    controller notNil ifTrue:[
claus
parents: 138
diff changeset
  5129
	controller startUp
claus
parents: 138
diff changeset
  5130
    ]
claus
parents: 138
diff changeset
  5131
!
claus
parents: 138
diff changeset
  5132
claus
parents: 138
diff changeset
  5133
recreate
claus
parents: 138
diff changeset
  5134
    "recreate (i.e. tell X about me) after a snapin"
claus
parents: 138
diff changeset
  5135
claus
parents: 138
diff changeset
  5136
    drawableId isNil ifTrue:[
claus
parents: 138
diff changeset
  5137
	super recreate.
claus
parents: 138
diff changeset
  5138
	self physicalCreate.
claus
parents: 138
diff changeset
  5139
claus
parents: 138
diff changeset
  5140
	viewBackground notNil ifTrue:[
claus
parents: 138
diff changeset
  5141
	    self setViewBackground 
claus
parents: 138
diff changeset
  5142
	].
claus
parents: 138
diff changeset
  5143
claus
parents: 138
diff changeset
  5144
	"
claus
parents: 138
diff changeset
  5145
	 XXX has to be changed: eventmasks are device specific -
claus
parents: 138
diff changeset
  5146
	 XXX will not allow restart on another Workstation-type.
claus
parents: 138
diff changeset
  5147
	 XXX event masks must become symbolic
claus
parents: 138
diff changeset
  5148
	"
claus
parents: 138
diff changeset
  5149
	device setEventMask:eventMask in:drawableId
claus
parents: 138
diff changeset
  5150
    ]
claus
parents: 138
diff changeset
  5151
!
claus
parents: 138
diff changeset
  5152
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5153
rerealize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5154
    "rerealize at old position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5155
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5156
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5157
	realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5158
	device mapView:self id:drawableId iconified:false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5159
		   atX:left y:top width:width height:height
140
claus
parents: 138
diff changeset
  5160
    ]
claus
parents: 138
diff changeset
  5161
!
claus
parents: 138
diff changeset
  5162
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5163
rerealizeInGroup:aWindowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5164
    "rerealize at old position in (a possibly different) windowGroup."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5165
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5166
    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5167
	self create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5168
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5169
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5170
	aWindowGroup ~~ windowGroup ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5171
	    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5172
		windowGroup removeView:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5173
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5174
	    windowGroup := aWindowGroup.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5175
	    aWindowGroup addTopView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5176
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5177
	self rerealize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5178
    ]
140
claus
parents: 138
diff changeset
  5179
!
claus
parents: 138
diff changeset
  5180
claus
parents: 138
diff changeset
  5181
rerealizeWithAllSubViews
claus
parents: 138
diff changeset
  5182
    "rerealize myself with all subviews"
claus
parents: 138
diff changeset
  5183
claus
parents: 138
diff changeset
  5184
    drawableId notNil ifTrue:[
claus
parents: 138
diff changeset
  5185
	realized := true.
claus
parents: 138
diff changeset
  5186
	subViews notNil ifTrue:[
180
claus
parents: 176
diff changeset
  5187
	    self realizeAllSubViews.
140
claus
parents: 138
diff changeset
  5188
	].
claus
parents: 138
diff changeset
  5189
	device mapView:self id:drawableId iconified:false
claus
parents: 138
diff changeset
  5190
		   atX:left y:top width:width height:height
claus
parents: 138
diff changeset
  5191
    ]
180
claus
parents: 176
diff changeset
  5192
!
claus
parents: 176
diff changeset
  5193
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5194
resize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5195
    "resize myself to make everything fit into me.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5196
     Nothing special done here, but redefined in some subclasses"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5197
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5198
    self extent:(self preferredExtent)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5199
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5200
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5201
unmap
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5202
    "hide me - the view stays created, and can be mapped again later."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5203
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5204
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5205
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5206
	    device unmapWindow:drawableId
151
claus
parents: 145
diff changeset
  5207
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5208
	realized := shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5209
    ].
190
claus
parents: 189
diff changeset
  5210
claus
parents: 189
diff changeset
  5211
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5212
     |top sub|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5213
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5214
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5215
     top extent:200@200.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5216
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5217
     sub := View
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5218
		origin:0.2@0.2
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5219
		corner:0.8@0.8
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5220
		in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5221
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5222
     sub viewBackground:Color red.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5223
     sub hiddenOnRealize:true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5224
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5225
     top open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5226
     (Delay forSeconds:5) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5227
     sub map.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5228
     (Delay forSeconds:3) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5229
     sub unmap.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5230
     sub viewBackground:(Color green).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5231
     (Delay forSeconds:3) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5232
     sub map.
151
claus
parents: 145
diff changeset
  5233
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5234
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5235
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5236
unrealize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5237
    "alias for unmap, for historic reasons"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5238
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5239
    self unmap.
151
claus
parents: 145
diff changeset
  5240
! !
claus
parents: 145
diff changeset
  5241
claus
parents: 145
diff changeset
  5242
!SimpleView methodsFor:'redrawing'!
claus
parents: 145
diff changeset
  5243
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5244
redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5245
    "redraw myself
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5246
     cannot do much here - has to be redefined in subclasses"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5247
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5248
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5249
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5250
redrawDeviceX:x y:y width:w height:h
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5251
    "have to redraw part of the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5252
     The coordinates are in device space - if there is a transformation,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5253
     must inverse-transform back to logical coordinates. (since the view thinks
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5254
     in its coordinate space)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5255
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5256
    |lx ly lw lh|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5257
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5258
    lx := x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5259
    ly := y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5260
    lw := w.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5261
    lh := h.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5262
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5263
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5264
	lx := transformation applyInverseToX:lx.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5265
	ly := transformation applyInverseToY:ly.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5266
	lw := transformation applyInverseScaleX:lw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5267
	lh := transformation applyInverseScaleY:lh.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5268
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5269
    self redrawX:lx y:ly width:lw height:lh
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5270
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5271
151
claus
parents: 145
diff changeset
  5272
redrawX:x y:y width:w height:h
claus
parents: 145
diff changeset
  5273
    "have to redraw part of myself, given logical coordinates (if trans is nonNil)
claus
parents: 145
diff changeset
  5274
     default is to redraw everything - subclasses should add intelligence"
claus
parents: 145
diff changeset
  5275
claus
parents: 145
diff changeset
  5276
    |area|
claus
parents: 145
diff changeset
  5277
claus
parents: 145
diff changeset
  5278
    shown ifFalse:[^ self].
claus
parents: 145
diff changeset
  5279
claus
parents: 145
diff changeset
  5280
    area := Rectangle left:x top:y width:w height:h.      
claus
parents: 145
diff changeset
  5281
    self clippedTo:area do:[
claus
parents: 145
diff changeset
  5282
"/        controller notNil ifTrue:[
claus
parents: 145
diff changeset
  5283
"/            "ST-80 updating"
claus
parents: 145
diff changeset
  5284
"/            self update:#rectangle with:area
claus
parents: 145
diff changeset
  5285
"/        ] ifFalse:[
claus
parents: 145
diff changeset
  5286
	    components notNil ifTrue:[
claus
parents: 145
diff changeset
  5287
		components do:[:aComponent |
claus
parents: 145
diff changeset
  5288
		    |thisFrame is|
claus
parents: 145
diff changeset
  5289
claus
parents: 145
diff changeset
  5290
		    thisFrame := aComponent frame.
claus
parents: 145
diff changeset
  5291
		    (thisFrame intersects:area) ifTrue:[
claus
parents: 145
diff changeset
  5292
			is := thisFrame intersect:(x@y extent:w@h).
claus
parents: 145
diff changeset
  5293
			is = thisFrame ifTrue:[
claus
parents: 145
diff changeset
  5294
			    aComponent redraw
claus
parents: 145
diff changeset
  5295
			] ifFalse:[
claus
parents: 145
diff changeset
  5296
			    aComponent redrawX:is left
claus
parents: 145
diff changeset
  5297
					     y:is top
claus
parents: 145
diff changeset
  5298
					 width:is width
claus
parents: 145
diff changeset
  5299
					height:is height.
claus
parents: 145
diff changeset
  5300
			].        
claus
parents: 145
diff changeset
  5301
			"/ aComponent drawIn:self offset:0@0
claus
parents: 145
diff changeset
  5302
		    ]
claus
parents: 145
diff changeset
  5303
		]
claus
parents: 145
diff changeset
  5304
	    ] ifFalse:[
claus
parents: 145
diff changeset
  5305
		self redraw
claus
parents: 145
diff changeset
  5306
	    ]
claus
parents: 145
diff changeset
  5307
"/        ]
claus
parents: 145
diff changeset
  5308
    ]                                                              
claus
parents: 145
diff changeset
  5309
!
claus
parents: 145
diff changeset
  5310
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5311
showActive
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5312
    "redraw myself as active (i.e. busy).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5313
     Nothing done here, but redefined in some classes."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5314
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5315
    ^ self
135
claus
parents:
diff changeset
  5316
!
claus
parents:
diff changeset
  5317
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5318
showFocus:explicit
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5319
    "highlight myself somehow to tell user that I have the focus.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5320
     Explicit tells if the focus came via focusStepping (i.e. tabbing)
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5321
     or via the window manager (i.e. pointer entering).
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5322
     Only change my border, if this is an explicit focusChange."
135
claus
parents:
diff changeset
  5323
claus
parents:
diff changeset
  5324
    |delta|
claus
parents:
diff changeset
  5325
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5326
    explicit ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5327
	drawableId notNil ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5328
	    delta := DefaultFocusBorderWidth - borderWidth.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5329
	    delta ~~ 0 ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5330
		device moveWindow:drawableId x:left-delta y:top-delta
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5331
	    ].
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5332
	    device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5333
	    device setWindowBorderColor:(DefaultFocusColor on:device) colorId in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5334
	]
135
claus
parents:
diff changeset
  5335
    ]
claus
parents:
diff changeset
  5336
!
claus
parents:
diff changeset
  5337
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5338
showNoFocus:explicit
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5339
    "undo the effect of showFocus.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5340
     Explicit tells if the focus came via focusStepping (i.e. tabbing)
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5341
     or via the window manager (i.e. pointer entering).
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5342
     Only change my border, if this is an explicit focusChange."
135
claus
parents:
diff changeset
  5343
claus
parents:
diff changeset
  5344
    |delta|
claus
parents:
diff changeset
  5345
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5346
    explicit ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5347
	drawableId notNil ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5348
	    (windowGroup notNil
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5349
	    and:[windowGroup focusView == self]) ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5350
		delta := DefaultFocusBorderWidth - borderWidth.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5351
		delta ~~ 0 ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5352
		    device moveWindow:drawableId x:left+delta y:top+delta
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5353
		].
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5354
		device setWindowBorderWidth:borderWidth in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5355
		self setBorderColor.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5356
	    ]
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
  5357
	]
135
claus
parents:
diff changeset
  5358
    ]
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  5359
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  5360
    "Modified: 9.1.1996 / 16:02:32 / cg"
135
claus
parents:
diff changeset
  5361
!
claus
parents:
diff changeset
  5362
claus
parents:
diff changeset
  5363
showPassive
claus
parents:
diff changeset
  5364
    "redraw myself as inactive (i.e. nonbusy).
151
claus
parents: 145
diff changeset
  5365
     Nothing done here, but redefined in some classes."
135
claus
parents:
diff changeset
  5366
claus
parents:
diff changeset
  5367
    ^ self
claus
parents:
diff changeset
  5368
! !
claus
parents:
diff changeset
  5369
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5370
!SimpleView methodsFor:'scrolling'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5371
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5372
horizontalScrollStep
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5373
    "return the amount to scroll when stepping left/right.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5374
     Subclasses may want to redefine this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5375
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5376
    ^ (device horizontalPixelPerMillimeter * 20) asInteger
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5377
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5378
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5379
scrollDown
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5380
    "scroll down by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5381
     scroll-step down button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5382
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5383
    self scrollDown:(self verticalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5384
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5385
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5386
scrollHorizontalTo:aPixelOffset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5387
    "change origin to make aPixelOffset be the left col"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5388
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5389
    |orgX|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5390
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5391
    orgX := self viewOrigin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5392
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5393
    (aPixelOffset < orgX) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5394
	self scrollLeft:(orgX - aPixelOffset)
140
claus
parents: 138
diff changeset
  5395
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5396
	(aPixelOffset > orgX) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5397
	    self scrollRight:(aPixelOffset - orgX)
140
claus
parents: 138
diff changeset
  5398
	]
claus
parents: 138
diff changeset
  5399
    ]
claus
parents: 138
diff changeset
  5400
!
claus
parents: 138
diff changeset
  5401
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5402
scrollHorizontalToPercent:percent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5403
    "scroll to a position given in percent of total"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5404
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5405
    |wCont|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5406
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5407
    wCont := self widthOfContents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5408
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5409
	wCont := transformation applyScaleX:wCont.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5410
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5411
    self scrollHorizontalTo:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5412
	    ((((wCont * percent) / 100.0) + 0.5) asInteger)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5413
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5414
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5415
scrollLeft
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5416
    "scroll left by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5417
     scroll-step left button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5418
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5419
    self scrollLeft:(self horizontalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5420
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5421
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5422
scrollRight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5423
    "scroll right by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5424
     scroll-step right button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5425
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5426
    self scrollRight:(self horizontalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5427
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5428
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5429
scrollToTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5430
    "move viewOrigin to top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5431
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5432
    self scrollVerticalTo:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5433
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5434
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5435
scrollToTopLeft
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5436
    "move viewOrigin to top/left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5437
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5438
    self scrollTo:(0 @ 0).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5439
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5440
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5441
scrollUp
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5442
    "scroll up by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5443
     scroll-step up button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5444
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5445
    self scrollUp:(self verticalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5446
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5447
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5448
scrollVerticalTo:aPixelOffset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5449
    "change origin to make aPixelOffset be the top line"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5450
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5451
    |orgY|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5452
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5453
    orgY := self viewOrigin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5454
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5455
    (aPixelOffset < orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5456
	self scrollUp:(orgY - aPixelOffset)
140
claus
parents: 138
diff changeset
  5457
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5458
	(aPixelOffset > orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5459
	    self scrollDown:(aPixelOffset - orgY)
135
claus
parents:
diff changeset
  5460
	]
claus
parents:
diff changeset
  5461
    ]
claus
parents:
diff changeset
  5462
!
claus
parents:
diff changeset
  5463
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5464
scrollVerticalToPercent:percent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5465
    "scroll to a position given in percent of total"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5466
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5467
    |hCont|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5468
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5469
    hCont := self heightOfContents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5470
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5471
	hCont := transformation applyScaleY:hCont.
140
claus
parents: 138
diff changeset
  5472
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5473
    self scrollVerticalTo:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5474
	    ((((hCont * percent) / 100.0) + 0.5) asInteger)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5475
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5476
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5477
verticalScrollStep
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5478
    "return the amount to scroll when stepping up/down.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5479
     Subclasses may want to redefine this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5480
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5481
    ^ (device verticalPixelPerMillimeter * 20) asInteger
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5482
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5483
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5484
widthForScrollBetween:yStart and:yEnd 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5485
    "return the width in pixels for a scroll between yStart and yEnd
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5486
     - return full width here since we do not know how wide contents is.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5487
     Views which only use part of their space (short lists, text) may redefine
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5488
     this method and return the number of pixels that have to be scrolled.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5489
     On slow displays, this may make a difference; on fast ones you will probably
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5490
     not notice any difference."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5491
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5492
    ^ (width - margin - margin)
135
claus
parents:
diff changeset
  5493
! !
claus
parents:
diff changeset
  5494
claus
parents:
diff changeset
  5495
!SimpleView methodsFor:'scrolling-basic'!
claus
parents:
diff changeset
  5496
claus
parents:
diff changeset
  5497
scrollDown:nPixels
claus
parents:
diff changeset
  5498
    "change origin to scroll down some pixels"
claus
parents:
diff changeset
  5499
claus
parents:
diff changeset
  5500
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5501
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5502
     w     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5503
     h     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5504
     hCont 
claus
parents:
diff changeset
  5505
     ih    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5506
     orgX  
claus
parents:
diff changeset
  5507
     orgY  "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5508
     newOrigin|
claus
parents:
diff changeset
  5509
claus
parents:
diff changeset
  5510
    hCont := self heightOfContents.
claus
parents:
diff changeset
  5511
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5512
	orgY := orgX := 0
claus
parents:
diff changeset
  5513
    ] ifFalse:[
claus
parents:
diff changeset
  5514
	hCont := (transformation applyScaleY:hCont) rounded.
claus
parents:
diff changeset
  5515
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5516
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5517
    ].
claus
parents:
diff changeset
  5518
claus
parents:
diff changeset
  5519
    count := nPixels.
claus
parents:
diff changeset
  5520
    ih := self innerHeight.
claus
parents:
diff changeset
  5521
claus
parents:
diff changeset
  5522
    ((orgY + nPixels + ih) > hCont) ifTrue:[
claus
parents:
diff changeset
  5523
	count := hCont - orgY - ih
claus
parents:
diff changeset
  5524
    ].
claus
parents:
diff changeset
  5525
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5526
claus
parents:
diff changeset
  5527
    self originWillChange.
claus
parents:
diff changeset
  5528
    newOrigin := orgX @ (orgY + count).
claus
parents:
diff changeset
  5529
    shown ifFalse:[
claus
parents:
diff changeset
  5530
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5531
    ] ifTrue:[
claus
parents:
diff changeset
  5532
	m2 := margin * 2.
claus
parents:
diff changeset
  5533
	(count >= ih) ifTrue:[
claus
parents:
diff changeset
  5534
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5535
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5536
			 width:(width - m2)
claus
parents:
diff changeset
  5537
			height:(height - m2).
claus
parents:
diff changeset
  5538
	] ifFalse:[
claus
parents:
diff changeset
  5539
	    h := height - m2 - count.
claus
parents:
diff changeset
  5540
	    w := self width.
claus
parents:
diff changeset
  5541
	    self catchExpose.
claus
parents:
diff changeset
  5542
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5543
	    self copyFrom:self x:margin y:(count + margin)
claus
parents:
diff changeset
  5544
			     toX:margin y:margin
claus
parents:
diff changeset
  5545
			   width:w 
claus
parents:
diff changeset
  5546
			  height:h.
claus
parents:
diff changeset
  5547
claus
parents:
diff changeset
  5548
	    self setInnerClip.
claus
parents:
diff changeset
  5549
	    self redrawDeviceX:margin y:(h + margin) 
claus
parents:
diff changeset
  5550
			 width:(width - m2) height:count.
claus
parents:
diff changeset
  5551
claus
parents:
diff changeset
  5552
	    self waitForExpose.
claus
parents:
diff changeset
  5553
	]
claus
parents:
diff changeset
  5554
    ].
claus
parents:
diff changeset
  5555
    self originChanged:(0 @ count).
claus
parents:
diff changeset
  5556
!
claus
parents:
diff changeset
  5557
claus
parents:
diff changeset
  5558
scrollLeft:nPixels
claus
parents:
diff changeset
  5559
    "change origin to scroll left some pixels"
claus
parents:
diff changeset
  5560
claus
parents:
diff changeset
  5561
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5562
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5563
     h     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5564
     orgX orgY newOrigin|
claus
parents:
diff changeset
  5565
claus
parents:
diff changeset
  5566
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5567
	orgY := orgX := 0
claus
parents:
diff changeset
  5568
    ] ifFalse:[
claus
parents:
diff changeset
  5569
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5570
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5571
    ].
claus
parents:
diff changeset
  5572
claus
parents:
diff changeset
  5573
    count := nPixels.
claus
parents:
diff changeset
  5574
    (count > orgX) ifTrue:[
claus
parents:
diff changeset
  5575
	count := orgX
claus
parents:
diff changeset
  5576
    ].
claus
parents:
diff changeset
  5577
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5578
claus
parents:
diff changeset
  5579
    self originWillChange.
claus
parents:
diff changeset
  5580
    newOrigin := (orgX - count) @ orgY.
claus
parents:
diff changeset
  5581
claus
parents:
diff changeset
  5582
    shown ifFalse:[
claus
parents:
diff changeset
  5583
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5584
    ] ifTrue:[
claus
parents:
diff changeset
  5585
	m2 := margin * 2.
claus
parents:
diff changeset
  5586
	(count >= self innerWidth) ifTrue:[
claus
parents:
diff changeset
  5587
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5588
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5589
			 width:(width - m2)
claus
parents:
diff changeset
  5590
			height:(height - m2).
claus
parents:
diff changeset
  5591
	] ifFalse:[
claus
parents:
diff changeset
  5592
	    h := (height - m2).
claus
parents:
diff changeset
  5593
claus
parents:
diff changeset
  5594
	    self catchExpose.
claus
parents:
diff changeset
  5595
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5596
	    self copyFrom:self x:margin y:margin
claus
parents:
diff changeset
  5597
			     toX:(count + margin) y:margin
claus
parents:
diff changeset
  5598
			   width:(width - m2 - count) 
claus
parents:
diff changeset
  5599
			  height:h.
claus
parents:
diff changeset
  5600
claus
parents:
diff changeset
  5601
	    self setInnerClip.
claus
parents:
diff changeset
  5602
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5603
			 width:count height:(height - m2).
claus
parents:
diff changeset
  5604
claus
parents:
diff changeset
  5605
	    self waitForExpose.
claus
parents:
diff changeset
  5606
	]
claus
parents:
diff changeset
  5607
    ].
claus
parents:
diff changeset
  5608
    self originChanged:(count negated @ 0).
claus
parents:
diff changeset
  5609
!
claus
parents:
diff changeset
  5610
claus
parents:
diff changeset
  5611
scrollRight:nPixels
claus
parents:
diff changeset
  5612
    "change origin to scroll right some pixels"
claus
parents:
diff changeset
  5613
claus
parents:
diff changeset
  5614
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5615
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5616
     h     "{ Class:SmallInteger }" 
claus
parents:
diff changeset
  5617
     wCont 
claus
parents:
diff changeset
  5618
     iw    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5619
     orgX orgY newOrigin|
claus
parents:
diff changeset
  5620
claus
parents:
diff changeset
  5621
    wCont := self widthOfContents.
claus
parents:
diff changeset
  5622
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5623
	orgY := orgX := 0
claus
parents:
diff changeset
  5624
    ] ifFalse:[
claus
parents:
diff changeset
  5625
	wCont := (transformation applyScaleX:wCont) rounded.
claus
parents:
diff changeset
  5626
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5627
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5628
    ].
claus
parents:
diff changeset
  5629
claus
parents:
diff changeset
  5630
    count := nPixels.
claus
parents:
diff changeset
  5631
    iw := self innerWidth.
claus
parents:
diff changeset
  5632
claus
parents:
diff changeset
  5633
    ((orgX + nPixels + iw) > wCont) ifTrue:[
claus
parents:
diff changeset
  5634
	count := wCont - orgX - iw
claus
parents:
diff changeset
  5635
    ].
claus
parents:
diff changeset
  5636
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5637
claus
parents:
diff changeset
  5638
    self originWillChange.
claus
parents:
diff changeset
  5639
    newOrigin := (orgX + count) @ orgY.
claus
parents:
diff changeset
  5640
claus
parents:
diff changeset
  5641
    shown ifFalse:[
claus
parents:
diff changeset
  5642
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5643
    ] ifTrue:[
claus
parents:
diff changeset
  5644
	m2 := margin * 2.
claus
parents:
diff changeset
  5645
	(count >= iw) ifTrue:[
claus
parents:
diff changeset
  5646
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5647
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5648
			 width:(width - m2)
claus
parents:
diff changeset
  5649
			height:(height - m2).
claus
parents:
diff changeset
  5650
	] ifFalse:[
claus
parents:
diff changeset
  5651
	    m2 := margin * 2.
claus
parents:
diff changeset
  5652
	    h := (height - m2).
claus
parents:
diff changeset
  5653
claus
parents:
diff changeset
  5654
	    self catchExpose.
claus
parents:
diff changeset
  5655
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5656
	    self copyFrom:self x:(count + margin) y:margin
claus
parents:
diff changeset
  5657
			     toX:margin y:margin
claus
parents:
diff changeset
  5658
			   width:(width - m2 - count) 
claus
parents:
diff changeset
  5659
			  height:h.
claus
parents:
diff changeset
  5660
claus
parents:
diff changeset
  5661
	    self setInnerClip.
claus
parents:
diff changeset
  5662
	    self redrawDeviceX:(width - margin - count) y:margin 
claus
parents:
diff changeset
  5663
			 width:count height:(height - m2).
claus
parents:
diff changeset
  5664
claus
parents:
diff changeset
  5665
	    self waitForExpose.
claus
parents:
diff changeset
  5666
	].
claus
parents:
diff changeset
  5667
    ].
claus
parents:
diff changeset
  5668
    self originChanged:(count @ 0).
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5669
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5670
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5671
scrollTo:newOrigin 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5672
    "change origin to have newOrigin be visible at the top-left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5673
     The argument defines the integer device coordinates of the new top-left 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5674
     point."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5675
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5676
    "due to historic reasons, the work is actually done by scrollUp/Down
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5677
     scrollLeft/Right (those where implemented first).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5678
     This will be changed to do all work here, and call it from
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5679
     the other scrolling methods."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5680
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5681
    |dX   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5682
     dY   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5683
     m2   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5684
     orgX "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5685
     orgY "{ Class:SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5686
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5687
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5688
	orgY := orgX := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5689
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5690
	orgY := transformation translation y negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5691
	orgX := transformation translation x negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5692
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5693
    dX := newOrigin x - orgX.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5694
    dY := newOrigin y - orgY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5695
    dX = 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5696
	dY < 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5697
	    ^ self scrollUp:(dY negated).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5698
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5699
	dY > 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5700
	    ^ self scrollDown:dY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5701
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5702
	^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5703
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5704
    dY = 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5705
	dX < 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5706
	    ^ self scrollLeft:dX negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5707
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5708
	dX > 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5709
	    ^ self scrollRight:dX
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5710
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5711
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5712
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5713
    self originWillChange.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5714
    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5715
    shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5716
	m2 := margin * 2. "top & bottom margins"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5717
	self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5718
		     width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5719
		    height:(height - m2).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5720
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5721
    self originChanged:(dX @ dY).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5722
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5723
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5724
scrollUp:nPixels
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5725
    "change origin to scroll up (towards the origin) by some pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5726
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5727
    |count "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5728
     m2    "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5729
     w     "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5730
     h     "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5731
     orgX
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5732
     orgY  "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5733
     newOrigin|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5734
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5735
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5736
	orgY := orgX := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5737
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5738
	orgY := transformation translation y negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5739
	orgX := transformation translation x negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5740
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5741
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5742
    count := nPixels.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5743
    (count > orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5744
	count := orgY
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5745
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5746
    (count <= 0) ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5747
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5748
    self originWillChange.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5749
    newOrigin := orgX @ (orgY - count).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5750
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5751
    shown ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5752
	self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5753
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5754
	m2 := margin * 2. "top & bottom margins"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5755
	(count >= self innerHeight) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5756
	    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5757
	    self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5758
			 width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5759
			height:(height - m2).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5760
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5761
	    h := height - m2 - count.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5762
	    w := width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5763
	    self catchExpose.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5764
	    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5765
	    self copyFrom:self x:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5766
			     toX:margin y:(count + margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5767
			   width:w height:h.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5768
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5769
	    self setInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5770
	    self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5771
			 width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5772
			height:count.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5773
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5774
	    self waitForExpose.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5775
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5776
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5777
    self originChanged:(0 @ count negated).
135
claus
parents:
diff changeset
  5778
! !
claus
parents:
diff changeset
  5779
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5780
!SimpleView methodsFor:'startup'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5781
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5782
open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5783
    "open up the view - for normal views, this is a modeless open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5784
     (i.e. the new view comes up as independent process).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5785
     Although #open is only to be sent to topviews (i.e. it could have been
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5786
     implemented in TopView), it is implemented here - therefore, every view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5787
     can be opened as a topView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5788
     This is redefined in ModalBox, which comes up modal (i.e. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5789
     control is under the current process, so that interaction with the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5790
     current group is blocked while the modalBox is active)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5791
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5792
    ^ self openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5793
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5794
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5795
     View new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5796
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5797
     (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5798
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5799
     |top|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5800
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5801
     top extent:200@200.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5802
     Button label:'hello' in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5803
     top open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5804
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5805
     YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5806
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5807
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5808
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5809
openAndWait
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5810
    "open up the view - wait until it is visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5811
     In normal applications, you do not need to wait till the view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5812
     open - it should do all of its drawing itself when it gets the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5813
     first expose event.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5814
     However, if you want to 'manually' draw into the view (for example,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5815
     in doIt expressions) the view must be visible (realized) before doing so.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5816
     Use this open in those situations."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5817
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5818
    self open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5819
    self waitUntilVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5820
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5821
    "does not work:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5822
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5823
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5824
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5825
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5826
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5827
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5828
     does work:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5829
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5830
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5831
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5832
	v := View new openAndWait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5833
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5834
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5835
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5836
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5837
openAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5838
    "open up the view modeless - positions the view"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5839
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5840
    ^self openModelessAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5841
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5842
    "Created: 18.9.1995 / 23:30:43 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5843
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5844
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5845
openAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5846
    "open up the view modeless - positions the view"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5847
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5848
    ^self openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5849
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5850
    "Created: 18.9.1995 / 23:30:56 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5851
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5852
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5853
openAutonomous
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5854
    "create and schedule a new windowgroup for me and open the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5855
     The view will be handled by its own process, effectively running in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5856
     parallel. This entry is for non-topviews, which want to be served
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5857
     autonomous from the topview. (see the fileBrowsers kill-button
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5858
     when executing unix commands as an example)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5859
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5860
    |wg|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5861
566
530567d2984f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  5862
    Processor isPureEventDriven ifFalse:[
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5863
        wg := WindowGroup new.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5864
        self windowGroup:wg.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5865
        wg addView:self.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5866
        wg startup:false.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5867
        wg isForModalSubview:true.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5868
        self realizeInGroup.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5869
    ] ifTrue:[
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5870
        self realize
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5871
    ]
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5872
566
530567d2984f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  5873
    "Modified: 13.4.1996 / 20:34:41 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5874
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5875
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5876
openInGroup:aGroup
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5877
    "special open within another windowGroup.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5878
     This allows a view to be realized in any windowgroup; 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5879
     for applications where multiple views act as a group
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5880
     (i.e. close and iconify together)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5881
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5882
    self windowGroup:aGroup.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5883
    aGroup addTopView:self.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5884
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5885
"/    self realizeKeepingGroup:true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5886
    aGroup isForModalSubview:true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5887
    self realize.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5888
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5889
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5890
openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5891
    "create a new windowgroup, but start processing in the current process
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5892
     actually suspending event processing for the currently active group.
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5893
     Stay in the modalLoop while the view is visible.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5894
     (i.e. control is returned to the sender when the receiver is closed)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5895
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5896
    self openModal:[true]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5897
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5898
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5899
     the same:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5900
	 YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5901
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5902
	 YesNoBox new openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5903
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5904
     different:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5905
	 (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5906
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5907
	 (Button label:'hello') openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5908
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5909
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5910
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5911
openModal:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5912
    "create a new windowgroup, but start processing in the current process -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5913
     actually suspending event processing for the currently active group.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5914
     Stay in this modal loop while aBlock evaluates to true AND the receiver is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5915
     visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5916
     (i.e. control is returned to the sender when the receiver is closed)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5917
     This makes any interaction with the current window impossible - 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5918
     however, other views (in other windowgroups) still work."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5919
299
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5920
    ^ self openModal:aBlock inGroup:WindowGroup activeGroup.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5921
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5922
    "Created: 10.12.1995 / 14:06:45 / cg"
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5923
    "Modified: 10.12.1995 / 14:08:48 / cg"
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5924
!
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5925
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5926
openModal:aBlock inGroup:mainGroup
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5927
    "create a new windowgroup, but start processing in the current process -
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5928
     actually suspending event processing for the main group.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5929
     Stay in this modal loop while aBlock evaluates to true AND the receiver is
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5930
     visible.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5931
     (i.e. control is returned to the sender when the receiver is closed)
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5932
     This makes any interaction with the current window impossible - 
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5933
     however, other views (in other windowgroups) still work."
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5934
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5935
    |tops|
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5936
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5937
    Processor activeProcessIsSystemProcess ifTrue:[
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5938
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5939
         put myself into the modal group, let it handle events for
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5940
         me as well. This is only a half way solution, since the view
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5941
         is not modal at all ... however, the only situation
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5942
         where this happens is with modal boxes popped while in a
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5943
         modal browser. You will forgive me for that inconvenience.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5944
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5945
        windowGroup := mainGroup.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5946
        mainGroup notNil ifTrue:[mainGroup addTopView:self].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5947
        self realize
135
claus
parents:
diff changeset
  5948
    ] ifFalse:[
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5949
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5950
         show a stop-cursor in the main group
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5951
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5952
        mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5953
            self isPopUpView ifFalse:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5954
                mainGroup showCursor:(Cursor stop).
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5955
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5956
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5957
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5958
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5959
         create a new window group and put myself into it
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5960
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5961
        windowGroup := WindowGroup new.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5962
        windowGroup addTopView:self.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5963
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5964
        superView notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5965
            "/
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5966
            "/ special: this is a modal subview,
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5967
            "/ prevent the view to reassign its windowGroup when realized
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5968
            "/ (subviews normally place themself into the superviews group)
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5969
            "/        
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5970
            windowGroup isForModalSubview:true.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5971
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5972
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5973
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5974
         go dispatch events in this new group
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5975
         (thus current windowgroup is blocked from interaction)
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5976
        "
426
7f0f723980e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 424
diff changeset
  5977
        AbortSignal handle:[:ex |
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5978
            self hide.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5979
            ex return.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5980
        ] do:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5981
            [
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5982
                windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5983
            ] valueOnUnwindDo:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5984
                mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5985
                    self isPopUpView ifFalse:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5986
                        mainGroup restoreCursors.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5987
                    ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5988
                    mainGroup sensor flushUserEvents.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5989
                ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5990
                self hide.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5991
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5992
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5993
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5994
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5995
         restore cursors in the main group & flush its buffered events
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5996
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5997
        mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5998
            mainGroup restoreCursors.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5999
            mainGroup sensor flushUserEvents.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6000
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6001
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6002
        ReturnFocusWhenClosingModalBoxes ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6003
            "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6004
             return input focus to previously active groups top.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6005
             This helps with windowmanagers which need an explicit click
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6006
             on the view for the focus.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6007
            "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6008
            mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6009
                tops := mainGroup topViews.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6010
                (tops notNil and:[tops notEmpty]) ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6011
                    tops first getKeyboardFocus
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6012
                ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6013
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6014
        ]
135
claus
parents:
diff changeset
  6015
    ]
299
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  6016
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  6017
    "Created: 10.12.1995 / 14:06:14 / cg"
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  6018
    "Modified: 11.2.1996 / 14:38:24 / cg"
135
claus
parents:
diff changeset
  6019
!
claus
parents:
diff changeset
  6020
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6021
openModalAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6022
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6023
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6024
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6025
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6026
    self create.
560
968d062c79cb oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
  6027
"/    device setTransient:drawableId for:0.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6028
    ^ self openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6029
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6030
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6031
     View new openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6032
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6033
     View new openModalAt:100@100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6034
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6035
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6036
    "Created: 18.9.1995 / 23:21:42 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6037
    "Modified: 18.9.1995 / 23:32:26 / claus"
560
968d062c79cb oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
  6038
    "Modified: 12.4.1996 / 19:02:29 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6039
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6040
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6041
openModalAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6042
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6043
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6044
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6045
    ^ self openModalAt:(device center - (self extent//2)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6046
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6047
    "Created: 18.9.1995 / 23:31:47 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6048
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6049
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6050
openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6051
    "create and schedule a new windowgroup for me and open the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6052
     The view will be handled by its own process, effectively running in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6053
     parallel (i.e. control is returned to the sender immediately)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6054
566
530567d2984f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  6055
    Processor isPureEventDriven ifFalse:[
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6056
        windowGroup isNil ifTrue:[
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6057
            windowGroup := WindowGroup new.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6058
            windowGroup addTopView:self.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6059
            windowGroup startup:false.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6060
        ] ifFalse:[
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6061
            windowGroup addTopView:self.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6062
            windowGroup startup:false.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6063
            self realizeInGroup.
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6064
        ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6065
    ] ifTrue:[
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6066
        self realize
135
claus
parents:
diff changeset
  6067
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6068
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6069
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6070
     the same:
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6071
         (Button label:'hello') open
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6072
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6073
         (Button label:'hello') openModeless
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6074
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6075
     different:
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6076
         YesNoBox new open
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6077
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6078
         YesNoBox new openModeless
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6079
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6080
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6081
     (almost) the same:
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6082
         YesNoBox new open
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6083
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6084
         YesNoBox new openModal
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6085
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6086
     different:
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6087
         (Button label:'hello') open
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6088
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6089
         (Button label:'hello') openModal
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6090
    "
503
c2b27766bb0a dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents: 497
diff changeset
  6091
566
530567d2984f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 560
diff changeset
  6092
    "Modified: 13.4.1996 / 20:34:45 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6093
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6094
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6095
openModelessAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6096
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6097
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6098
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6099
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6100
    self create.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6101
    ^ self openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6102
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6103
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6104
     View new openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6105
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6106
     View new openModelessAt:100@100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6107
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6108
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6109
    "Created: 18.9.1995 / 23:21:42 / claus"
560
968d062c79cb oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
  6110
    "Modified: 12.4.1996 / 19:02:28 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6111
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6112
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6113
openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6114
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6115
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6116
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6117
    ^ self openModelessAt:(device center - (self extent//2)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6118
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6119
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6120
     View new openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6121
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6122
     View new openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6123
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6124
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6125
    "Created: 18.9.1995 / 23:21:42 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6126
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6127
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6128
waitUntilVisible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6129
    "wait until the receiver visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6130
     In normal applications, you do not need to wait till a view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6131
     open - it should do all of its drawing itself when it gets the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6132
     first expose event.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6133
     However, if you want to 'manually' draw into the view (for example,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6134
     in doIt expressions), or subsequent views depend on some state of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6135
     another view (which is only available once visible), 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6136
     use this to suspend the current process until the receiver is shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6137
     Caveat:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6138
	we poll here for the view to be shown - we need a semaphore
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6139
	which is raised by the view in order to do it right."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6140
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6141
    [self shown] whileFalse:[
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  6142
	Delay waitForSeconds:0.05.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6143
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6144
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6145
    "does not work (the view is in its opening phase,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6146
     when we attempt to draw a line - this gives an error, since
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6147
     its internals are not yet correctly setup):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6148
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6149
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6150
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6151
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6152
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6153
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6154
     does work (since we wait until the view has completely finished
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6155
     its startup phase):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6156
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6157
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6158
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6159
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6160
	v waitUntilVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6161
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6162
    "
135
claus
parents:
diff changeset
  6163
! !
claus
parents:
diff changeset
  6164
claus
parents:
diff changeset
  6165
!SimpleView methodsFor:'user notification'!
claus
parents:
diff changeset
  6166
claus
parents:
diff changeset
  6167
warn:aString
claus
parents:
diff changeset
  6168
    "like Objects warn, but translates the string via the
claus
parents:
diff changeset
  6169
     resourcePack, thus giving a translated string automatically"
claus
parents:
diff changeset
  6170
151
claus
parents: 145
diff changeset
  6171
    super warn:(resources string:aString) withCRs
135
claus
parents:
diff changeset
  6172
!
claus
parents:
diff changeset
  6173
claus
parents:
diff changeset
  6174
warn:aString with:argument
claus
parents:
diff changeset
  6175
    "like Objects warn, but translates the string via the
claus
parents:
diff changeset
  6176
     resourcePack, thus giving a translated string automatically"
claus
parents:
diff changeset
  6177
151
claus
parents: 145
diff changeset
  6178
    super warn:(resources string:aString with:argument) withCRs
claus
parents: 145
diff changeset
  6179
!
claus
parents: 145
diff changeset
  6180
claus
parents: 145
diff changeset
  6181
warn:aString with:arg1 with:arg2
claus
parents: 145
diff changeset
  6182
    "like Objects warn, but translates the string via the
claus
parents: 145
diff changeset
  6183
     resourcePack, thus giving a translated string automatically"
claus
parents: 145
diff changeset
  6184
claus
parents: 145
diff changeset
  6185
    super warn:(resources string:aString with:arg1 with:arg2) withCRs
135
claus
parents:
diff changeset
  6186
! !
claus
parents:
diff changeset
  6187
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6188
!SimpleView class methodsFor:'documentation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6189
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  6190
version
586
b91f10f632d5 commentary
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  6191
    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.79 1996-04-22 21:39:59 cg Exp $'
135
claus
parents:
diff changeset
  6192
! !
claus
parents:
diff changeset
  6193
SimpleView initialize!