RoundButtonBorder.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 06 Sep 2017 10:04:18 +0200
branchjv
changeset 8180 25149dfd68e0
parent 6530 b4c269c96b08
permissions -rw-r--r--
Build files: removed a bunch of make rules for long-dead unsupported systems ...in order to unify and simplify the build. If a need to support this ancient systems arose, these hacks may ni longer be needed (due to new versions of tools) or the hacks would have to be written again (better) or retrieved from SCM (worse). Time will show.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5464
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     1
"
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     2
 COPYRIGHT (c) 2009 by eXept Software AG
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     3
              All Rights Reserved
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     4
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     5
 This software is furnished under a license and may be used
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     6
 only in accordance with the terms of that license and with the
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
     9
 other person.  No title to or ownership of the software is
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    10
 hereby transferred.
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    11
"
5433
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libview' }"
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
AbstractBorder subclass:#RoundButtonBorder
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'color'
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Graphics-Support'
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!RoundButtonBorder class methodsFor:'documentation'!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
5464
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    23
copyright
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    24
"
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    25
 COPYRIGHT (c) 2009 by eXept Software AG
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    26
              All Rights Reserved
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    27
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    28
 This software is furnished under a license and may be used
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    29
 only in accordance with the terms of that license and with the
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    31
 be provided or otherwise made available to, or used by, any
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    32
 other person.  No title to or ownership of the software is
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    33
 hereby transferred.
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    34
"
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    35
!
a76eb3ed2aff added: #copyright
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
    36
5433
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    experimental
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
5468
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    41
    |v b|
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    42
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    43
    v := View new extent:100@100; openAndWait.
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    44
    b := RoundButtonBorder new.
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    45
    b width:1 color:(Color rgbValue:16r707070).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    46
    b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    47
    Delay waitForSeconds:3.
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    48
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    49
    b width:1 color:(Color rgbValue:16r2C628B).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    50
    b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    51
    Delay waitForSeconds:3.
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    52
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    53
    b width:1 color:(Color rgbValue:16r3C7FB1).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    54
    b displayOn:v forDisplayBox:((0@0 corner:v extent) insetBy:10).
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
    55
5433
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    [author:]
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
        Claus Gittinger
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
"
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
! !
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!RoundButtonBorder methodsFor:'accessing'!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
color
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "the color of the border"
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    ^ color
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
color:aColor
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "set the color of the border"
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    width ~~ 0 ifTrue:[
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
        self assert:aColor notNil.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    ].
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    color := aColor
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
width
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    ^ 2
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
! !
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
!RoundButtonBorder methodsFor:'displaying'!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
displayOn:aGC forDisplayBox:aRectangle
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    |oldPaint left top w h|
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    color isNil ifTrue:[ ^ self].
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    oldPaint := aGC paint.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    aGC paint:color.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    left := aRectangle left.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    top := aRectangle top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    w := aRectangle width.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    h := aRectangle height.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    aGC displayRectangleX:left y:top width:w height:h.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    aGC paint:color slightlyLightened.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    aGC displayPointX:left+2 y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    aGC displayPointX:left+1 y:top+1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    aGC displayPointX:left y:top+2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    aGC displayPointX:left+2 y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    aGC displayPointX:left+1 y:top+h-2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    aGC displayPointX:left y:top+h-3.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    aGC displayPointX:left+w-3 y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    aGC displayPointX:left+w-2 y:top+1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    aGC displayPointX:left+w-1 y:top+2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    aGC displayPointX:left+w-3 y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    aGC displayPointX:left+w-2 y:top+h-2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    aGC displayPointX:left+w-1 y:top+h-3.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    aGC paint:color lightened.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    aGC displayPointX:left+1 y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    aGC displayPointX:left y:top+1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    aGC displayPointX:left+1 y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    aGC displayPointX:left y:top+h-2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    aGC displayPointX:left+w-2 y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    aGC displayPointX:left+w-1 y:top+1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    aGC displayPointX:left+w-2 y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    aGC displayPointX:left+w-1 y:top+h-2.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    aGC paint:(aGC container ? aGC) viewBackground.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    aGC displayPointX:left y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    aGC displayPointX:left+w-1 y:top.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    aGC displayPointX:left y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    aGC displayPointX:left+w-1 y:top+h-1.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    aGC paint:oldPaint.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    "
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
     |v b|
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
     v := View new openAndWait.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
     b := RoundButtonBorder width:2 color:Color grey.
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
     b displayOn:v forDisplayBox:(0@0 corner:v extent).
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    "
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
! !
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!RoundButtonBorder class methodsFor:'documentation'!
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
version_CVS
5468
1ec468c66fa4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
   149
    ^ '$Header: /cvs/stx/stx/libview/RoundButtonBorder.st,v 1.4 2009-11-05 13:55:59 cg Exp $'
6530
b4c269c96b08 Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6528
diff changeset
   150
!
b4c269c96b08 Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6528
diff changeset
   151
b4c269c96b08 Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6528
diff changeset
   152
version_HG
b4c269c96b08 Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6528
diff changeset
   153
b4c269c96b08 Changes XftFontDescription to use per-view XftDrawId...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6528
diff changeset
   154
    ^ '$Changeset: <not expanded> $'
5433
1cb1b16f7bd2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
! !
6528
62c1dbef0b84 Class order in project definition fixed so it passes project checker checks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5468
diff changeset
   156