AbstractBorder.st
author Claus Gittinger <cg@exept.de>
Fri, 23 Oct 2009 17:23:50 +0200
changeset 5392 9cc77e8151a4
parent 5374 fa6ec7dc8508
child 5407 767945d3ad71
permissions -rw-r--r--
category
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5374
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
 COPYRIGHT (c) 2009 by eXept Software AG
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
              All Rights Reserved
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 This software is furnished under a license and may be used
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 only in accordance with the terms of that license and with the
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 be provided or otherwise made available to, or used by, any
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 other person.  No title to or ownership of the software is
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 hereby transferred.
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libview' }"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
Object subclass:#AbstractBorder
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:''
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
5392
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
    19
	category:'Graphics-Support'
5374
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!AbstractBorder class methodsFor:'documentation'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1997 by eXept Software AG
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 2009 by eXept Software AG
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
5392
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
    41
    Extracted from Border.
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
    42
    Common superclass for border-painters.
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
    43
    This will replace the mixture of window-system supported borders and manually
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
    44
    drawn 3D levels (which is ugly, but served me well for almost 20years now).
5374
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    [author:]
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        Claus Gittinger
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
! !
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!AbstractBorder class methodsFor:'instance creation'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
width:borderWidth
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    "create a new instance of the receiver with a border of the given width  
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
     (and default color)."
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    ^ self new width:borderWidth color:(Color black)
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Modified: 10.2.1997 / 15:19:57 / cg"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
width:borderWidth color:aColor
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "create a new instance of the receiver with a border of the given width  
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
     and color."
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    ^ self new setBorderWidth:borderWidth color:aColor
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    "Modified: 10.2.1997 / 15:20:32 / cg"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
! !
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
!AbstractBorder methodsFor:'accessing'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
setBorderWidth:aWidth color:aColor
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
     self setBorderWidth:aWidth.
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
     self setBorderColor:aColor
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    "Created: 10.2.1997 / 15:21:27 / cg"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
! !
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!AbstractBorder methodsFor:'displaying'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
displayOn:aGC forDisplayBox:aRectangle
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    "display the borders represented by the receiver in the specified rectangle.
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
     The gc is restored after the draw."
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    self displayOn:aGC forDisplayBox:aRectangle using:nil
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    "Modified: 10.2.1997 / 14:56:10 / cg"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
displayOn:aGC forDisplayBox:aRectangle using:colorSource
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    self subclassResponsibility
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
! !
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
!AbstractBorder methodsFor:'private accessing'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
setBorderColor:arg
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    "raise an error: must be redefined in concrete subclass(es)"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    ^ self subclassResponsibility
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
setBorderWidth:arg
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    "raise an error: must be redefined in concrete subclass(es)"
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    ^ self subclassResponsibility
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
! !
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
!AbstractBorder class methodsFor:'documentation'!
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
version_CVS
5392
9cc77e8151a4 category
Claus Gittinger <cg@exept.de>
parents: 5374
diff changeset
   112
    ^ '$Header: /cvs/stx/stx/libview/AbstractBorder.st,v 1.2 2009-10-23 15:23:50 cg Exp $'
5374
fa6ec7dc8508 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
! !