PullDownMenu.st
changeset 21 9ef599238fea
parent 5 7b4fb1b170e5
child 38 4b9b70b2cc87
equal deleted inserted replaced
20:0d9c61aacaa4 21:9ef599238fea
    23 PullDownMenu comment:'
    23 PullDownMenu comment:'
    24 
    24 
    25 COPYRIGHT (c) 1989 by Claus Gittinger
    25 COPYRIGHT (c) 1989 by Claus Gittinger
    26              All Rights Reserved
    26              All Rights Reserved
    27 
    27 
    28 $Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.3 1993-10-13 02:48:49 claus Exp $
    28 $Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.4 1994-01-08 17:27:45 claus Exp $
    29 
    29 
    30 written summer 89 by claus
    30 written summer 89 by claus
    31 '!
    31 '!
    32 
    32 
    33 !PullDownMenu class methodsFor:'documentation'!
    33 !PullDownMenu class methodsFor:'documentation'!
    34 
    34 
    35 documentation
    35 documentation
    36 "
    36 "
    37 PullDown menu provides the top (always visible) part of these menus. It controls
    37 PullDown menu provides the top (always visible) part of these menus. It controls
    38 display of its menus, which become visible when one of the PullDownMenus entries is pressed.
    38 display of its menus, which become visible when one of the PullDownMenus entries 
       
    39 is pressed.
    39 
    40 
    40 Instance variables:
    41 Instance variables:
    41 
    42 
    42 menus                   <aCollection>   the sub menus
    43 menus                   <aCollection>   the sub menus
    43 titles                  <aCollection>   the strings in the menu
    44 titles                  <aCollection>   the strings in the menu
    46 topMargin               <Number>        number of pixels at top
    47 topMargin               <Number>        number of pixels at top
    47 fgColor                 <Color>         color to draw passive menu-titles
    48 fgColor                 <Color>         color to draw passive menu-titles
    48 bgColor                 <Color>         color to draw passive menu-titles
    49 bgColor                 <Color>         color to draw passive menu-titles
    49 activeFgColor           <Color>         color to draw activated menu-titles
    50 activeFgColor           <Color>         color to draw activated menu-titles
    50 activeBgColor           <Color>         color to draw activated menu-titles
    51 activeBgColor           <Color>         color to draw activated menu-titles
       
    52 onLevel                 <Integer>       level of entry-buttons when pressed
       
    53 offLevel                <Integer>       level of entry-buttons when released
    51 "
    54 "
    52 ! !
    55 ! !
    53 
    56 
    54 !PullDownMenu class methodsFor:'instance creation'!
    57 !PullDownMenu class methodsFor:'instance creation'!
    55 
    58 
    73     super initStyle.
    76     super initStyle.
    74 
    77 
    75     showSeparatingLines := false.
    78     showSeparatingLines := false.
    76     fgColor := Black.
    79     fgColor := Black.
    77     bgColor := viewBackground.
    80     bgColor := viewBackground.
       
    81     onLevel := -1.
       
    82     offLevel := 1.
       
    83 
    78     self is3D ifTrue:[
    84     self is3D ifTrue:[
    79         device hasColors ifTrue:[
    85         device hasColors ifTrue:[
    80             activeFgColor := Color name:'yellow'
    86             activeFgColor := Color name:'yellow'
    81         ] ifFalse:[
    87         ] ifFalse:[
    82             activeFgColor := White
    88             activeFgColor := White
    84         device hasGreyscales ifTrue:[
    90         device hasGreyscales ifTrue:[
    85             activeBgColor := bgColor.
    91             activeBgColor := bgColor.
    86         ] ifFalse:[
    92         ] ifFalse:[
    87             activeBgColor := fgColor.
    93             activeBgColor := fgColor.
    88         ].
    94         ].
    89         topMargin := 2
    95         topMargin := 2.
       
    96 
       
    97         style == #iris ifTrue:[
       
    98             self level:2.
       
    99             softEdge := true.
       
   100             onLevel := 2.
       
   101             offLevel := 0.
       
   102             activeFgColor := fgColor
       
   103         ]
    90     ] ifFalse:[
   104     ] ifFalse:[
    91         activeFgColor := bgColor.
   105         activeFgColor := bgColor.
    92         activeBgColor := fgColor.
   106         activeBgColor := fgColor.
    93         topMargin := 0
   107         topMargin := 0
    94     ].
   108     ].
    95     onLevel := -1.
       
    96     offLevel := 1
       
    97 !
   109 !
    98 
   110 
    99 initEvents
   111 initEvents
   100     self enableButtonMotionEvents.
   112     self enableButtonMotionEvents.
   101     self enableButtonEvents
   113     self enableButtonEvents