AbstractBackground.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 08 Dec 2017 09:10:33 +0000
branchjv
changeset 8232 ddbaa22b9352
parent 6955 fc29f17aeb4c
child 7862 e63a53d30a96
child 8595 7f9b84978a2e
permissions -rw-r--r--
Issue #186: Win32: use inline C in `#setForegroundWindow:` ...rather than FFI. It's much faster and uses lot less stack. The latter is also important since `#setForegroundWindow:` is called when opening debugger. In case a debugger is opened due to a recursion interrupt, stack space is very limited so better save every byte. https://swing.fit.cvut.cz/projects/stx-jv/ticket/186
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
     1
"{ Encoding: utf8 }"
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
     2
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     3
"
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     4
 COPYRIGHT (c) 2009 by eXept Software AG
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     5
              All Rights Reserved
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     6
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     7
 This software is furnished under a license and may be used
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     8
 only in accordance with the terms of that license and with the
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    10
 be provided or otherwise made available to, or used by, any
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    11
 other person.  No title to or ownership of the software is
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    12
 hereby transferred.
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    13
"
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libview' }"
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    16
"{ NameSpace: Smalltalk }"
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    17
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
Object subclass:#AbstractBackground
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Graphics-Support'
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!AbstractBackground class methodsFor:'documentation'!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
5459
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    27
copyright
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    28
"
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    29
 COPYRIGHT (c) 2009 by eXept Software AG
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    30
              All Rights Reserved
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    31
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    32
 This software is furnished under a license and may be used
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    33
 only in accordance with the terms of that license and with the
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    35
 be provided or otherwise made available to, or used by, any
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    36
 other person.  No title to or ownership of the software is
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    37
 hereby transferred.
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    38
"
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    39
!
7adaeea72491 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
    40
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    This will replace the viewBackground color.
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    44
    Instances of me (and subclasses) can be set as a widget's
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    45
    viewBackground, and will get 
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    46
        fillRectangleX:x y:y width:w height:h in:aView
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    47
    messages whenever the widget wants to redraw (parts of) its background.
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    48
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    49
    See the example in GradientBackground.
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    [author:]
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
        Claus Gittinger
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    53
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    54
    [see also:]
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
    55
        GradientBackground
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    57
!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    58
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    59
examples
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    60
"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    61
    |v|
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    62
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    63
    v := View new.
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    64
    v viewBackground:(SolidBackground new color:Color red).
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    65
    v open.
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    66
"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    67
! !
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    68
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    69
!AbstractBackground methodsFor:'drawing'!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    70
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    71
fillRectangleX:x y:y width:w height:h in:aView
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    72
    self subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    73
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    74
    "Created: / 23-01-2011 / 01:59:29 / cg"
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    75
! !
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    76
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    77
!AbstractBackground methodsFor:'ignored conversion'!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    78
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    79
asFormOn:aDevice
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    80
    self subclassResponsibility
5683
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:45:35 / cg"
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    83
    "Modified: / 03-02-2011 / 19:55:49 / cg"
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    84
!
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    85
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    86
onDevice:aDevice
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    87
    self subclassResponsibility
5683
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    88
Claus Gittinger <cg@exept.de>
parents: 5459
diff changeset
    89
    "Created: / 23-01-2011 / 01:46:11 / cg"
5704
d7c401801223 comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
    90
    "Modified: / 03-02-2011 / 19:55:40 / cg"
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
! !
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
    93
!AbstractBackground methodsFor:'testing'!
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
    94
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
    95
isViewBackground
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
    96
    ^ true
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    97
!
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    98
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
    99
needsFullRedrawOnChangeOfHeight
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   100
    ^ false
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   101
!
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   102
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   103
needsFullRedrawOnChangeOfWidth
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   104
    ^ false
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   105
! !
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   106
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!AbstractBackground class methodsFor:'documentation'!
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   109
version
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   110
    ^ '$Header$'
6239
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   111
!
6566276ba3dc class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 6238
diff changeset
   112
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
version_CVS
6955
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   114
    ^ '$Header$'
5398
9f94824ab735 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
6238
d62bf03b097c class: AbstractBackground
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   116