VDBAbstractApplication.st
changeset 115 0dd989ce3ae7
parent 113 1a40f33af921
child 124 3cce4791af34
equal deleted inserted replaced
114:8a0643c344a9 115:0dd989ce3ae7
    28 
    28 
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    30 "
    30 "
    31 ! !
    31 ! !
    32 
    32 
    33 !VDBAbstractApplication class methodsFor:'accessing'!
    33 !VDBAbstractApplication class methodsFor:'accessing - defaults'!
    34 
    34 
    35 windowTitle
    35 defaultMenuFont
    36     | m s |
    36     "Return a default font to be used in list and text views. VDB UI is designed
       
    37      so that it expects thos font to be monospaced but does not enforce it."     
       
    38 
       
    39     DefaultMenuFont isNil ifTrue:[ ^ MenuPanel defaultFont asSize: self defaultTextFont size ].
       
    40     ^ DefaultMenuFont
       
    41 
       
    42     "Created: / 31-08-2018 / 08:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    43 !
       
    44 
       
    45 defaultTextFont
       
    46     "Return a default font to be used in list and text views. VDB UI is designed
       
    47      so that it expects thos font to be monospaced but does not enforce it."     
       
    48 
       
    49     DefaultTextFont isNil ifTrue:[ ^ CodeView defaultFont ].
       
    50     ^ DefaultTextFont
       
    51 
       
    52     "Created: / 20-08-2018 / 10:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    53 !
       
    54 
       
    55 defaultTextFont: aFont
       
    56     "Set a default font to be used in list and text views. VDB UI is designed
       
    57      so that it expects thos font to be monospaced but does not enforce it."     
       
    58 
       
    59     DefaultTextFont := aFont
       
    60 
       
    61     "Created: / 20-08-2018 / 10:54:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    62 !
       
    63 
       
    64 defaultWindowTitle
       
    65     "Returns default window title for this application. By default,
       
    66      extracts the title from #windowSpec. 
       
    67      
       
    68      Subclasses may (must) override this method." 
       
    69      
       
    70     | m |
    37 
    71 
    38     m := self class lookupMethodFor: #windowSpec.
    72     m := self class lookupMethodFor: #windowSpec.
    39     m mclass theNonMetaclass isAbstract ifTrue:[ 
    73     m mclass theNonMetaclass isAbstract ifTrue:[ 
    40         self subclassResponsibility: 'Override #windowTitle in concrete classes'.
    74         self subclassResponsibility: 'Override #defaultWindowTitle in concrete classes'.
    41     ].
    75     ].
    42     s := self windowSpec.
    76     ^ (self defaultWindowTitleFromSpec: self windowSpec) ? (self name)
    43     s do: [:e | 
    77 
       
    78     "Created: / 03-10-2018 / 15:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    79 !
       
    80 
       
    81 defaultWindowTitleFromSpec: spec
       
    82     "Given a window spec, return the specified (window) label. 
       
    83      If no window label is specified, retun `nil`"
       
    84 
       
    85     spec do: [:e | 
    44         (e isArray and:[ e first == #WindowSpec ]) ifTrue:[
    86         (e isArray and:[ e first == #WindowSpec ]) ifTrue:[
    45             ^ self resources string: (e at: 3)
    87             ^ self resources string: (e at: 3)
    46         ]
    88         ]
    47     ].
    89     ].
    48     ^ self name
    90     ^ nil
    49 
    91 
    50     "Created: / 16-12-2017 / 00:45:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    92     "Created: / 03-10-2018 / 15:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    51     "Modified: / 01-10-2018 / 12:07:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    52 ! !
       
    53 
       
    54 !VDBAbstractApplication class methodsFor:'accessing - defaults'!
       
    55 
       
    56 defaultMenuFont
       
    57     "Return a default font to be used in list and text views. VDB UI is designed
       
    58      so that it expects thos font to be monospaced but does not enforce it."     
       
    59 
       
    60     DefaultMenuFont isNil ifTrue:[ ^ MenuPanel defaultFont asSize: self defaultTextFont size ].
       
    61     ^ DefaultMenuFont
       
    62 
       
    63     "Created: / 31-08-2018 / 08:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    64 !
       
    65 
       
    66 defaultTextFont
       
    67     "Return a default font to be used in list and text views. VDB UI is designed
       
    68      so that it expects thos font to be monospaced but does not enforce it."     
       
    69 
       
    70     DefaultTextFont isNil ifTrue:[ ^ CodeView defaultFont ].
       
    71     ^ DefaultTextFont
       
    72 
       
    73     "Created: / 20-08-2018 / 10:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    74 !
       
    75 
       
    76 defaultTextFont: aFont
       
    77     "Set a default font to be used in list and text views. VDB UI is designed
       
    78      so that it expects thos font to be monospaced but does not enforce it."     
       
    79 
       
    80     DefaultTextFont := aFont
       
    81 
       
    82     "Created: / 20-08-2018 / 10:54:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    83 ! !
    93 ! !
    84 
    94 
    85 !VDBAbstractApplication class methodsFor:'interface opening'!
    95 !VDBAbstractApplication class methodsFor:'interface opening'!
    86 
    96 
    87 openFor: debugger
    97 openFor: debugger
   202 
   212 
   203 titleHolder
   213 titleHolder
   204     "return/create the 'titleHolder' value holder (automatically generated)"
   214     "return/create the 'titleHolder' value holder (automatically generated)"
   205 
   215 
   206     titleHolder isNil ifTrue:[
   216     titleHolder isNil ifTrue:[
   207         titleHolder := ValueHolder with: self class windowTitle
   217         titleHolder := ValueHolder with: self class defaultWindowTitle
   208     ].
   218     ].
   209     ^ titleHolder
   219     ^ titleHolder
   210 
   220 
   211     "Modified: / 01-06-2017 / 12:13:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   221     "Modified: / 03-10-2018 / 15:36:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   212 ! !
   222 ! !
   213 
   223 
   214 !VDBAbstractApplication methodsFor:'binding access'!
   224 !VDBAbstractApplication methodsFor:'binding access'!
   215 
   225 
   216 menuExtendersFor: key do: block
   226 menuExtendersFor: key do: block