WindowBuilder.st
changeset 372 6d7718f3d298
parent 223 b65dc250db8d
child 374 5be095a54715
equal deleted inserted replaced
371:ce94ec6a38ee 372:6d7718f3d298
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 Object subclass:#WindowBuilder
    13 Object subclass:#WindowBuilder
    14 	instanceVariableNames:'topView application bindings aspects focusSequence'
    14 	instanceVariableNames:'window application bindings focusSequence namedComponents'
    15 	classVariableNames:''
    15 	classVariableNames:''
    16 	poolDictionaries:''
    16 	poolDictionaries:''
    17 	category:'Interface-Support-UI'
    17 	category:'Interface-Support-UI'
    18 !
    18 !
    19 
    19 
    47 ! !
    47 ! !
    48 
    48 
    49 !WindowBuilder methodsFor:'accessing'!
    49 !WindowBuilder methodsFor:'accessing'!
    50 
    50 
    51 application
    51 application
       
    52     "return the application (an ApplicationModel),
       
    53      for which the view is built.
       
    54      This one is supposed to provide the aspects, menus etc."
       
    55 
    52     ^ application
    56     ^ application
       
    57 
       
    58     "Modified: 17.1.1997 / 19:04:40 / cg"
    53 !
    59 !
    54 
    60 
    55 application:anApplicationModel
    61 application:anApplicationModel
       
    62     "set the application (an ApplicationModel),
       
    63      for which the view is built.
       
    64      This one is supposed to provide the aspects, menus etc."
       
    65 
    56     application := anApplicationModel
    66     application := anApplicationModel
       
    67 
       
    68     "Modified: 17.1.1997 / 19:04:47 / cg"
    57 !
    69 !
    58 
    70 
    59 aspectAt:aSymbol
    71 aspectAt:aSymbol
    60     aspects isNil ifTrue:[^ nil].
    72     bindings isNil ifTrue:[^ nil].
    61     ^ aspects at:aSymbol ifAbsent:nil
    73     ^ bindings at:aSymbol ifAbsent:nil
       
    74 
       
    75     "Modified: 17.1.1997 / 19:28:32 / cg"
    62 !
    76 !
    63 
    77 
    64 aspectAt:aSymbol put:aModel
    78 aspectAt:aSymbol put:aModel
    65     aspects isNil ifTrue:[
    79     bindings isNil ifTrue:[
    66 	aspects := IdentityDictionary new
    80         bindings := IdentityDictionary new
    67     ].
    81     ].
    68     ^ aspects at:aSymbol put:aModel
    82     ^ bindings at:aSymbol put:aModel
       
    83 
       
    84     "Modified: 17.1.1997 / 19:28:37 / cg"
    69 !
    85 !
    70 
    86 
    71 bindings
    87 bindings
    72     ^ bindings
    88     ^ bindings
    73 !
    89 !
    94 
   110 
    95 namedComponents
   111 namedComponents
    96     ^ bindings
   112     ^ bindings
    97 !
   113 !
    98 
   114 
       
   115 source
       
   116     "same as #application, for ST-80 compatibility"
       
   117 
       
   118     ^ application
       
   119 
       
   120     "Created: 17.1.1997 / 19:03:51 / cg"
       
   121 !
       
   122 
    99 source:anApplicationModel
   123 source:anApplicationModel
       
   124     "same as #application:, for ST-80 compatibility"
       
   125 
   100     application := anApplicationModel
   126     application := anApplicationModel
       
   127 
       
   128     "Modified: 17.1.1997 / 19:03:57 / cg"
   101 !
   129 !
   102 
   130 
   103 window
   131 window
   104     ^ topView
   132     "return the top window (view), for which an interface
       
   133      is (being) built"
       
   134 
       
   135     ^ window
       
   136 
       
   137     "Modified: 17.1.1997 / 19:30:00 / cg"
   105 !
   138 !
   106 
   139 
   107 window:aView
   140 window:aView
   108     topView := aView
   141     "set the top window (view), for which an interface
       
   142      is (being) built"
       
   143 
       
   144     window := aView
       
   145 
       
   146     "Modified: 17.1.1997 / 19:30:22 / cg"
   109 !
   147 !
   110 
   148 
   111 windowGroup
   149 windowGroup
   112     ^ topView windowGroup
   150 self halt.
   113 ! !
   151     ^ window windowGroup
   114 
   152 
   115 !WindowBuilder methodsFor:'operation'!
   153     "Modified: 17.1.1997 / 19:30:26 / cg"
       
   154 ! !
       
   155 
       
   156 !WindowBuilder methodsFor:'building'!
   116 
   157 
   117 buildFromSpec:aSpec
   158 buildFromSpec:aSpec
   118     ^ self subclassResponsibility
   159     ^ self subclassResponsibility
   119 !
   160 ! !
       
   161 
       
   162 !WindowBuilder methodsFor:'spec creation callbacks'!
       
   163 
       
   164 createdComponent:aView forSpec:spec
       
   165 
       
   166     "Modified: 5.9.1995 / 21:42:54 / claus"
       
   167 ! !
       
   168 
       
   169 !WindowBuilder methodsFor:'startup'!
   120 
   170 
   121 closeRequest
   171 closeRequest
   122     topView destroy
   172     window destroy
       
   173 
       
   174     "Modified: 17.1.1997 / 19:30:32 / cg"
   123 !
   175 !
   124 
   176 
   125 open
   177 open
   126     "open my topView, as previously created"
   178     "open my topView, as previously created"
   127 
   179 
   128     self openWithExtent:nil andType:#normal 
   180     self 
       
   181         openWithExtent:nil
       
   182         andType:(application defaultWindowType)
       
   183 
       
   184     "Modified: 17.1.1997 / 19:59:22 / cg"
   129 !
   185 !
   130 
   186 
   131 openDialog
   187 openDialog
   132     "open my topView, as previously created as a modal view,
   188     "open my topView, as previously created as a modal view,
   133      blocking interaction to the currently active view."
   189      blocking interaction to the currently active view."
   134 
   190 
   135     self openWithExtent:nil andType:#dialog
   191     self 
       
   192         openWithExtent:nil 
       
   193         andType:#dialog
       
   194 
       
   195     "Modified: 17.1.1997 / 19:59:29 / cg"
   136 !
   196 !
   137 
   197 
   138 openDialogWithExtent:ext
   198 openDialogWithExtent:ext
   139     "open my topView, as previously created as a modal view,
   199     "open my topView, as previously created as a modal view,
   140      blocking interaction to the currently active view."
   200      blocking interaction to the currently active view."
   141 
   201 
   142     self openWithExtent:ext andType:#dialog
   202     self 
       
   203         openWithExtent:ext 
       
   204         andType:#dialog
       
   205 
       
   206     "Modified: 17.1.1997 / 19:59:36 / cg"
       
   207 !
       
   208 
       
   209 openPopUpIn:aRectangle
       
   210     "open my topView, as previously created as a popUp view,
       
   211      blocking interaction to the currently active view."
       
   212 
       
   213     self 
       
   214         openWithExtent:nil 
       
   215         andType:#popUp
       
   216 
       
   217     "Modified: 17.1.1997 / 19:59:29 / cg"
       
   218     "Created: 17.1.1997 / 20:01:24 / cg"
   143 !
   219 !
   144 
   220 
   145 openWithExtent:aPoint
   221 openWithExtent:aPoint
   146     "open my topView, as previously created, but override
   222     "open my topView, as previously created, but override
   147      the extent."
   223      the extent."
   148 
   224 
   149     self openWithExtent:aPoint andType:#normal 
   225     self 
       
   226         openWithExtent:aPoint 
       
   227         andType:(application defaultWindowType)
       
   228 
       
   229     "Modified: 17.1.1997 / 19:58:48 / cg"
   150 !
   230 !
   151 
   231 
   152 openWithExtent:ext andType:type
   232 openWithExtent:ext andType:type
   153     "open my topView, as previously created. The type argument
   233     "open my window, as previously created. The type argument
   154      may be #dialog or #normal, and specifies if the view should
   234      may be #dialog or #normal, and specifies if the view should
   155      be opened as a modal view, blocking interaction to the currently 
   235      be opened as a modal view, blocking interaction to the currently 
   156      active view, or as a normal view."
   236      active view, or as a normal view."
   157 
   237 
   158     ext notNil ifTrue:[
   238     ext notNil ifTrue:[
   159 	topView extent:ext
   239         window extent:ext
   160     ].
   240     ].
       
   241 
   161     type == #dialog ifTrue:[
   242     type == #dialog ifTrue:[
   162 	topView openModal.
   243         window openModal.
   163 	^ self
   244         ^ self
   164     ].
   245     ].
   165 
   246 
   166     type == #normal ifTrue:[
   247     type == #normal ifTrue:[
   167 	topView open.
   248         window open.
   168 	^ self
   249         ^ self
   169     ].
   250     ].
       
   251 
       
   252     type == #popUp ifTrue:[
       
   253 "/        window openAsPopUp.  "/ not yet implemented
       
   254         window openModal.
       
   255         ^ self
       
   256     ].
       
   257 
   170     "
   258     "
   171      if ST-80 supports more types - these may be added later
   259      if ST-80 supports more types - these may be added later
   172     "
   260     "
   173     self halt:'unimplemented'
   261     self halt:'unimplemented'
   174 ! !
   262 
   175 
   263     "Modified: 17.1.1997 / 20:02:01 / cg"
   176 !WindowBuilder methodsFor:'spec creation callbacks'!
       
   177 
       
   178 createdComponent:aView forSpec:spec
       
   179 
       
   180     "Modified: 5.9.1995 / 21:42:54 / claus"
       
   181 ! !
   264 ! !
   182 
   265 
   183 !WindowBuilder class methodsFor:'documentation'!
   266 !WindowBuilder class methodsFor:'documentation'!
   184 
   267 
   185 version
   268 version
   186     ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.13 1996-04-25 16:43:54 cg Exp $'
   269     ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.14 1997-01-17 19:53:40 cg Exp $'
   187 ! !
   270 ! !