AbstractBackground.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 7949 eea2873e09b7
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     1
"
7949
eea2873e09b7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7862
diff changeset
     2
 COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     3
              All Rights Reserved
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     4
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     5
 This software is furnished under a license and may be used
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     6
 only in accordance with the terms of that license and with the
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     9
 other person.  No title to or ownership of the software is
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    10
 hereby transferred.
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    11
"
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview' }"
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    14
"{ NameSpace: Smalltalk }"
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    15
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Object subclass:#AbstractBackground
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Graphics-Support'
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!AbstractBackground class methodsFor:'documentation'!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    25
copyright
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    26
"
7949
eea2873e09b7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7862
diff changeset
    27
 COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    28
              All Rights Reserved
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    29
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    30
 This software is furnished under a license and may be used
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    31
 only in accordance with the terms of that license and with the
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    33
 be provided or otherwise made available to, or used by, any
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    34
 other person.  No title to or ownership of the software is
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    35
 hereby transferred.
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    36
"
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    37
!
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    38
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    This will replace the viewBackground color.
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    42
    Instances of me (and subclasses) can be set as a widget's
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    43
    viewBackground, and will get 
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    44
        fillRectangleX:x y:y width:w height:h in:aView
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    45
    messages whenever the widget wants to redraw (parts of) its background.
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    46
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    47
    See the example in GradientBackground.
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [author:]
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        Claus Gittinger
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    51
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    52
    [see also:]
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    53
        GradientBackground
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
"
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    55
!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    56
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    57
examples
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    58
"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    59
    |v|
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    60
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    61
    v := View new.
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    62
    v viewBackground:(SolidBackground new color:Color red).
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    63
    v open.
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    64
"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    65
! !
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    66
7862
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    67
!AbstractBackground class methodsFor:'queries'!
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    68
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    69
isAbstract
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    70
    "Return if this class is an abstract class.
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    71
     True is returned here for myself only; false for subclasses.
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    72
     Abstract subclasses must redefine this again."
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    73
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    74
    ^ self == AbstractBackground.
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    75
! !
e63a53d30a96 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6955
diff changeset
    76
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    77
!AbstractBackground methodsFor:'drawing'!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    78
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    79
fillRectangleX:x y:y width:w height:h in:aView
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    80
    self subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    81
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    82
    "Created: / 23-01-2011 / 01:59:29 / cg"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    83
! !
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    84
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    85
!AbstractBackground methodsFor:'ignored conversion'!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    86
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    87
asFormOn:aDevice
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    88
    self subclassResponsibility
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    89
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    90
    "Created: / 23-01-2011 / 01:45:35 / cg"
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    91
    "Modified: / 03-02-2011 / 19:55:49 / cg"
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    92
!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    93
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    94
onDevice:aDevice
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    95
    self subclassResponsibility
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    96
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    97
    "Created: / 23-01-2011 / 01:46:11 / cg"
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    98
    "Modified: / 03-02-2011 / 19:55:40 / cg"
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
! !
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   101
!AbstractBackground methodsFor:'testing'!
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   102
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   103
isViewBackground
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   104
    ^ true
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   105
!
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   106
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   107
needsFullRedrawOnChangeOfHeight
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   108
    ^ false
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   109
!
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   110
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   111
needsFullRedrawOnChangeOfWidth
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   112
    ^ false
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   113
! !
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   114
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
!AbstractBackground class methodsFor:'documentation'!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   117
version
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   118
    ^ '$Header$'
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   119
!
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   120
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
version_CVS
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   122
    ^ '$Header$'
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
! !
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   124