home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / RB3641.ZIP / EX2 / CUATOPP.CLS < prev    next >
Text File  |  1991-12-16  |  3KB  |  102 lines

  1.  
  2. TopPane subclass: #CUATopPane
  3.   instanceVariableNames: ''
  4.   classVariableNames: ''
  5.   poolDictionaries: 
  6.     'CharacterConstants PMConstants ' !
  7.  
  8.  
  9. !CUATopPane class methods !
  10.   
  11. fileMenu
  12.         "Private - Answer the File menu."
  13.     ^Menu new
  14.         appendItem: '~Open as ToDo List' selector: #openToDoList;
  15.         appendItem: 'Open as ~Settings' selector: #openAsSettings;
  16.         appendSeparator ;
  17.         appendItem: '~Save    ' selector: #accept  ;
  18.         appendSeparator ;
  19.         appendItem: '~Print    ' selector: #print  ;
  20.         appendItem: 'Print~All    ' selector: #printAll  ;
  21.         title: '~ThingsToDo'!
  22.  
  23. supportedEvents
  24.         "Answer the Set of events that SubPanes can notify
  25.          their owners about."
  26.     ^Set new
  27.         add: #close;
  28.         add: #opened;
  29.         add: #timer;
  30.         add: #menuBuilt;
  31.         add: #validated;
  32.         add: #activate;
  33.         add: #help;
  34.         add: #getMenu;
  35.         add: #getPopupMenu;
  36.         yourself! !
  37.  
  38.  
  39.  
  40. !CUATopPane methods !
  41.   
  42. buildMenuBar
  43.         "Private - Create the menus that make up the menu bar."
  44.     | textPane eachMenu |
  45.     menuWindow addMenu: self fileMenu owner: self.
  46.     (self class canUnderstand: #saveAs) ifFalse: [
  47.         (eachMenu := menuWindow menuTitled: '~File') notNil
  48.             ifTrue: [eachMenu disableItem: #saveAs]].
  49.     textPane := self searchForDefaultTextPane.
  50.     textPane notNil ifTrue: [
  51.         menuWindow addMenu: (textPane class editMenu allOwners: textPane).
  52.         menuWindow addMenu: (textPane class smalltalkMenu allOwners: textPane).
  53.         ].
  54.     children do: [ :subpane |
  55.         eachMenu := subpane menu.
  56.         eachMenu notNil ifTrue: [
  57.             menuWindow addMenu: eachMenu.
  58.             ]].
  59.     menuWindow systemMenu
  60.         insertItem: '~Zoom Text    Alt+Z'
  61.         selector: #zoom
  62.         accelKey: $z
  63.         accelBits: AfChar | AfAlt
  64.         after: 5.
  65.     menuWindow systemMenu
  66.         insertItem: 'Fonts...'
  67.         selector: #setFonts
  68.         accelKey: nil
  69.         accelBits: nil
  70.         after: 6.
  71.  
  72.     menuWindow addMenu: self editMenu.
  73.     menuWindow addMenu: self viewMenu.
  74.  
  75.     self helpManager notNil
  76.         ifTrue: [self helpManager buildMenuBar].!
  77.    
  78. controlKeyInput: aCharacter
  79.         "Private - A control key was pressed by the user,
  80.          e.g. Backspace, Enter, Tab.  aCharacter contains
  81.          the ascii code for the key."
  82.  
  83.     (aCharacter = Tab) ifTrue: [
  84.         owner tabToNextField ].
  85.     ^super controlKeyInput: aCharacter!
  86.   
  87. openWindow: aRect
  88.         "Open the receiver on a desired position and size
  89.  
  90.         Author: Jouko Ruuskanen
  91.         16.10.1991 "
  92.  
  93.     ^self openIn: aRect.!
  94.   
  95. virtualKeyInput: anInteger
  96.         "Private - The user pressed a virtual (i.e. non-alphanumeric) key.
  97.          anInteger is a VkConstant from the PMConstants pool
  98.          dictionary."
  99.  
  100.     (anInteger = 7) ifTrue: [ owner tabToPrevField ].
  101.     ^super virtualKeyInput: anInteger! !
  102.