UIPainter.st
changeset 724 7c7fb3f3a927
parent 721 325eba9f37b7
child 729 12f157d5e017
equal deleted inserted replaced
723:60e8ffac2f38 724:7c7fb3f3a927
    96     ^ false
    96     ^ false
    97 
    97 
    98 
    98 
    99 ! !
    99 ! !
   100 
   100 
   101 !UIPainter class methodsFor:'accessing'!
       
   102 
       
   103 label
       
   104 
       
   105     ^'GUI Builder'
       
   106 ! !
       
   107 
       
   108 !UIPainter class methodsFor:'accessing-defaults'!
   101 !UIPainter class methodsFor:'accessing-defaults'!
   109 
   102 
   110 defaultNameOfCanvas
   103 defaultNameOfCanvas
   111     "returns the default name (id) of the application
   104     "returns the default name (id) of the application
   112     "
   105     "
   192 #editDimensionPasteLayout
   185 #editDimensionPasteLayout
   193 'Sets the layout of the selected widgets to the last copied layout.'
   186 'Sets the layout of the selected widgets to the last copied layout.'
   194 
   187 
   195 #editDimensionPasteWidth
   188 #editDimensionPasteWidth
   196 'Sets the width of the selected widgets to the width of the last copied layout/extent.'
   189 'Sets the width of the selected widgets to the width of the last copied layout/extent.'
       
   190 
       
   191 #editInspectSpec
       
   192 'Opens an inspector on the spec of the selected widget.'
   197 
   193 
   198 #fileBrowseAspectMethods
   194 #fileBrowseAspectMethods
   199 'Opens a System Browser to browse the aspect methods.'
   195 'Opens a System Browser to browse the aspect methods.'
   200 
   196 
   201 #fileLoad
   197 #fileLoad
   441     "
   437     "
   442 
   438 
   443     <resource: #canvas>
   439     <resource: #canvas>
   444 
   440 
   445     ^
   441     ^
   446 
   442      
   447        #(#FullSpec
   443        #(#FullSpec
   448           #'window:' 
   444           #window: 
   449            #(#WindowSpec
   445            #(#WindowSpec
   450               #'name:' 'GUI Builder'
   446               #name: 'GUI Painter'
   451               #'layout:' #(#LayoutFrame 238 0 270 0 584 0 429 0)
   447               #layout: #(#LayoutFrame 296 0 349 0 642 0 508 0)
   452               #'label:' 'GUI Builder'
   448               #label: 'GUI Painter'
   453               #'min:' #(#Point 10 10)
   449               #min: #(#Point 10 10)
   454               #'max:' #(#Point 1152 900)
   450               #max: #(#Point 1152 900)
   455               #'bounds:' #(#Rectangle 238 270 585 430)
   451               #bounds: #(#Rectangle 296 349 643 509)
   456               #'usePreferredExtent:' false
   452               #usePreferredExtent: false
   457           )
   453           )
   458           #'component:' 
   454           #component: 
   459            #(#SpecCollection
   455            #(#SpecCollection
   460               #'collection:' 
   456               #collection: 
   461                #(
   457                #(
   462                  #(#FramedBoxSpec
   458                  #(#FramedBoxSpec
   463                     #'name:' 'framedBox1'
   459                     #name: 'framedBox1'
   464                     #'layout:' #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   460                     #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   465                     #'component:' 
   461                     #component: 
   466                      #(#SpecCollection
   462                      #(#SpecCollection
   467                         #'collection:' 
   463                         #collection: 
   468                          #(
   464                          #(
   469                            #(#LabelSpec
   465                            #(#LabelSpec
   470                               #'name:' 'selectorLabel'
   466                               #name: 'selectorLabel'
   471                               #'layout:' #(#AlignmentOrigin 77 0.11 39 0 1 0.5)
   467                               #layout: #(#AlignmentOrigin 77 0.11 39 0 1 0.5)
   472                               #'label:' 'Selector:'
   468                               #label: 'Selector:'
   473                               #'adjust:' #right
   469                               #adjust: #right
   474                               #'resizeForLabel:' true
   470                               #resizeForLabel: true
   475                           )
   471                           )
   476                            #(#InputFieldSpec
   472                            #(#InputFieldSpec
   477                               #'name:' 'methodNameField'
   473                               #name: 'methodNameField'
   478                               #'layout:' #(#LayoutFrame 80 0.11 28 0 14 1.0 50 0)
   474                               #layout: #(#LayoutFrame 80 0.11 28 0 14 1.0 50 0)
   479                               #'tabable:' true
   475                               #tabable: true
   480                               #'model:' #methodNameChannel
   476                               #model: #methodNameChannel
   481                           )
   477                           )
   482                            #(#LabelSpec
   478                            #(#LabelSpec
   483                               #'name:' 'classLabel'
   479                               #name: 'classLabel'
   484                               #'layout:' #(#AlignmentOrigin 77 0.11 64 0 1 0.5)
   480                               #layout: #(#AlignmentOrigin 77 0.11 64 0 1 0.5)
   485                               #'label:' 'Class:'
   481                               #label: 'Class:'
   486                               #'adjust:' #right
   482                               #adjust: #right
   487                               #'resizeForLabel:' true
   483                               #resizeForLabel: true
   488                           )
   484                           )
   489                            #(#InputFieldSpec
   485                            #(#InputFieldSpec
   490                               #'name:' 'classNameField'
   486                               #name: 'classNameField'
   491                               #'layout:' #(#LayoutFrame 80 0.11 53 0 14 1.0 75 0)
   487                               #layout: #(#LayoutFrame 80 0.11 53 0 14 1.0 75 0)
   492                               #'tabable:' true
   488                               #tabable: true
   493                               #'model:' #classNameChannel
   489                               #model: #classNameChannel
   494                           )
   490                           )
   495                            #(#LabelSpec
   491                            #(#LabelSpec
   496                               #'name:' 'superClassLabel'
   492                               #name: 'superClassLabel'
   497                               #'layout:' #(#AlignmentOrigin 77 0.11 89 0 1 0.5)
   493                               #layout: #(#AlignmentOrigin 77 0.11 89 0 1 0.5)
   498                               #'label:' 'Superclass:'
   494                               #label: 'Superclass:'
   499                               #'adjust:' #right
   495                               #adjust: #right
   500                               #'resizeForLabel:' true
   496                               #resizeForLabel: true
   501                           )
   497                           )
   502                            #(#ComboBoxSpec
   498                            #(#ComboBoxSpec
   503                               #'name:' 'superclassNameComboBox'
   499                               #name: 'superclassNameComboBox'
   504                               #'layout:' #(#LayoutFrame 80 0.11 78 0 14 1.0 100 0)
   500                               #layout: #(#LayoutFrame 80 0.11 78 0 14 1.0 100 0)
   505                               #'tabable:' true
   501                               #tabable: true
   506                               #'model:' #superclassNameChannel
   502                               #model: #superclassNameChannel
   507                               #'comboList:' #superclassNameDefaults
   503                               #comboList: #superclassNameDefaults
   508                           )
   504                           )
   509                         )
   505                         )
   510                     )
   506                     )
   511                     #'label:' 'Define Class And Selector'
   507                     #label: 'Define Class And Selector'
   512                     #'labelPosition:' #topLeft
   508                     #labelPosition: #topLeft
   513                 )
   509                 )
   514                  #(#UISubSpecification
   510                  #(#UISubSpecification
   515                     #'name:' 'uISubSpecifica1'
   511                     #name: 'uISubSpecifica1'
   516                     #'layout:' #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   512                     #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   517                     #'majorKey:' #ToolApplicationModel
   513                     #majorKey: #ToolApplicationModel
   518                     #'minorKey:' #windowSpecForCommitWithoutChannels
   514                     #minorKey: #windowSpecForCommitWithoutChannels
   519                 )
   515                 )
   520               )
   516               )
   521           )
   517           )
   522       )
   518       )
   523 
       
   524 !
   519 !
   525 
   520 
   526 windowSpec
   521 windowSpec
   527     "this window spec was automatically generated by the ST/X UIPainter"
   522     "this window spec was automatically generated by the ST/X UIPainter"
   528 
   523 
   938                 #submenu: 
   933                 #submenu: 
   939                  #(#Menu
   934                  #(#Menu
   940                     
   935                     
   941                      #(
   936                      #(
   942                        #(#MenuItem
   937                        #(#MenuItem
   943                           #label: 'Documentation'
   938                           #label: 'Tutorial'
   944                           #translateLabel: true
   939                           #translateLabel: true
   945                           #value: #openDocumentation
   940                           #value: #openHTMLDocument:
   946                           #activeHelpKey: #helpTutorial
   941                           #activeHelpKey: #helpTutorial
   947                           #enabled: #valueOfHavingDocumentation
   942                           #argument: 'tools/uipainter/TOP.html'
       
   943                       )
       
   944                        #(#MenuItem
       
   945                           #label: '-'
       
   946                       )
       
   947                        #(#MenuItem
       
   948                           #label: 'Functions'
       
   949                           #translateLabel: true
       
   950                           #value: #openHTMLDocument:
       
   951                           #activeHelpKey: #helpTutorial
       
   952                           #argument: 'tools/uipainter/Functions.html'
   948                       )
   953                       )
   949                        #(#MenuItem
   954                        #(#MenuItem
   950                           #label: 'Examples'
   955                           #label: 'Examples'
   951                           #translateLabel: true
   956                           #translateLabel: true
   952                           #value: #openExamples
   957                           #value: #openHTMLDocument:
   953                           #activeHelpKey: #helpTutorial
   958                           #activeHelpKey: #helpTutorial
   954                           #enabled: #valueOfHavingExamples
   959                           #argument: 'tools/uipainter/Examples.html'
   955                       )
   960                       )
   956                        #(#MenuItem
   961                        #(#MenuItem
   957                           #label: '-'
   962                           #label: '-'
   958                       )
   963                       )
   959                        #(#MenuItem
   964                        #(#MenuItem
  1110              #(#MenuItem
  1115              #(#MenuItem
  1111                 #label: '-'
  1116                 #label: '-'
  1112             )
  1117             )
  1113              #(#MenuItem
  1118              #(#MenuItem
  1114                 #label: 'Cut'
  1119                 #label: 'Cut'
  1115                 #value: #cutSelection
  1120                 #value: #deleteSelection
  1116                 #activeHelpKey: #editCut
  1121                 #activeHelpKey: #editCut
  1117                 #enabled: #valueOfCanCut
  1122                 #enabled: #valueOfCanCut
  1118                 #shortcutKeyCharacter: #Cut
  1123                 #shortcutKeyCharacter: #Cut
  1119             )
  1124             )
  1120              #(#MenuItem
  1125              #(#MenuItem
  1131                 #enabled: #valueOfCanPaste
  1136                 #enabled: #valueOfCanPaste
  1132                 #shortcutKeyCharacter: #Paste
  1137                 #shortcutKeyCharacter: #Paste
  1133             )
  1138             )
  1134              #(#MenuItem
  1139              #(#MenuItem
  1135                 #label: 'Delete'
  1140                 #label: 'Delete'
  1136                 #value: #deleteSelection
  1141                 #value: #deleteTotalSelection
       
  1142                 #activeHelpKey: #editDelete
  1137                 #enabled: #valueOfCanCut
  1143                 #enabled: #valueOfCanCut
  1138                 #shortcutKeyCharacter: #Delete
  1144                 #shortcutKeyCharacter: #Delete
  1139             )
  1145             )
  1140              #(#MenuItem
  1146              #(#MenuItem
  1141                 #label: '-'
  1147                 #label: '-'
  1228                 #label: '-'
  1234                 #label: '-'
  1229             )
  1235             )
  1230              #(#MenuItem
  1236              #(#MenuItem
  1231                 #label: 'Inspect Spec'
  1237                 #label: 'Inspect Spec'
  1232                 #value: #inspectSpec
  1238                 #value: #inspectSpec
       
  1239                 #activeHelpKey: #editInspectSpec
  1233             )
  1240             )
  1234           ) nil
  1241           ) nil
  1235           nil
  1242           nil
  1236       )
  1243       )
  1237 
       
  1238     "Modified: / 10.3.1998 / 18:12:11 / stefan"
       
  1239 !
  1244 !
  1240 
  1245 
  1241 menuMove
  1246 menuMove
  1242     "this window spec was automatically generated by the ST/X MenuEditor"
  1247     "this window spec was automatically generated by the ST/X MenuEditor"
  1243 
  1248 
  1342                 #label: ''
  1347                 #label: ''
  1343             )
  1348             )
  1344              #(#MenuItem
  1349              #(#MenuItem
  1345                 #label: 'Cut'
  1350                 #label: 'Cut'
  1346                 #isButton: true
  1351                 #isButton: true
  1347                 #value: #cutSelection
  1352                 #value: #deleteSelection
  1348                 #activeHelpKey: #editCut
  1353                 #activeHelpKey: #editCut
  1349                 #enabled: #valueOfCanCut
  1354                 #enabled: #valueOfCanCut
  1350                 #labelImage: #(#ResourceRetriever nil #cutIcon)
  1355                 #labelImage: #(#ResourceRetriever nil #cutIcon)
  1351             )
  1356             )
  1352              #(#MenuItem
  1357              #(#MenuItem
  1366                 #labelImage: #(#ResourceRetriever nil #pasteIcon)
  1371                 #labelImage: #(#ResourceRetriever nil #pasteIcon)
  1367             )
  1372             )
  1368              #(#MenuItem
  1373              #(#MenuItem
  1369                 #label: 'Delete'
  1374                 #label: 'Delete'
  1370                 #isButton: true
  1375                 #isButton: true
  1371                 #value: #deleteSelection
  1376                 #value: #deleteTotalSelection
  1372                 #activeHelpKey: #editDelete
  1377                 #activeHelpKey: #editDelete
  1373                 #enabled: #valueOfCanCut
  1378                 #enabled: #valueOfCanCut
  1374                 #labelImage: #(#ResourceRetriever nil #deleteIcon)
  1379                 #labelImage: #(#ResourceRetriever nil #deleteIcon)
  1375             )
  1380             )
  1376              #(#MenuItem
  1381              #(#MenuItem
  1713 
  1718 
  1714 ! !
  1719 ! !
  1715 
  1720 
  1716 !UIPainter methodsFor:'aspects'!
  1721 !UIPainter methodsFor:'aspects'!
  1717 
  1722 
       
  1723 aspectFor:aKey
       
  1724     "aspect for a key
       
  1725     "
       
  1726   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
       
  1727 !
       
  1728 
  1718 canChangeOrderInContainer
  1729 canChangeOrderInContainer
  1719     "returns a boolean value holder which is true if the component order can be changed within their container.
  1730     "returns a boolean value holder which is true if the component order can be changed within their container.
  1720     "
  1731     "
  1721     ^ builder booleanValueAspectFor:#canChangeOrderInContainer
  1732     ^ builder booleanValueAspectFor:#canChangeOrderInContainer
  1722 !
  1733 !
  1854 
  1865 
  1855 treeView
  1866 treeView
  1856     "returns the selection tree view which holds all widget identifiers
  1867     "returns the selection tree view which holds all widget identifiers
  1857     "
  1868     "
  1858     ^ treeView
  1869     ^ treeView
  1859 ! !
       
  1860 
       
  1861 !UIPainter methodsFor:'binding access'!
       
  1862 
       
  1863 aspectFor:aKey
       
  1864     "aspect for a key
       
  1865     "
       
  1866   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
       
  1867 ! !
  1870 ! !
  1868 
  1871 
  1869 !UIPainter methodsFor:'building editors'!
  1872 !UIPainter methodsFor:'building editors'!
  1870 
  1873 
  1871 openDataSetColumnEditor
  1874 openDataSetColumnEditor
  2109 
  2112 
  2110 defaultInfoLabel
  2113 defaultInfoLabel
  2111 
  2114 
  2112     specClass isNil ifTrue: [^'No class and selector defined'].
  2115     specClass isNil ifTrue: [^'No class and selector defined'].
  2113     ^specClass printString, ' >> ', specSelector
  2116     ^specClass printString, ' >> ', specSelector
  2114 !
       
  2115 
       
  2116 openDocumentation
       
  2117 
       
  2118     self openHTMLDocument: 'tools/uipainter/TOP.html'
       
  2119 !
       
  2120 
       
  2121 openExamples
       
  2122 
       
  2123     self openHTMLDocument: 'tools/uipainter/Examples.html'
       
  2124 !
  2117 !
  2125 
  2118 
  2126 showHelp:aHelpText for:view
  2119 showHelp:aHelpText for:view
  2127     "display active help texts in my own info area."
  2120     "display active help texts in my own info area."
  2128 
  2121 
  2858 
  2851 
  2859     code := painter generateWindowSpecMethodSource withCRs.
  2852     code := painter generateWindowSpecMethodSource withCRs.
  2860     painter resetModification.
  2853     painter resetModification.
  2861     (ReadStream on:code) fileIn.
  2854     (ReadStream on:code) fileIn.
  2862 
  2855 
  2863     self helpTool installHelpSpecInto:specClass.
  2856     self helpTool installHelpSpecsOnClass:specClass.
  2864 
  2857 
  2865     self updateInfoLabel.
  2858     self updateInfoLabel.
  2866     self painter resetModification.
  2859     self painter resetModification.
  2867 
  2860 
  2868     ((Smalltalk at: specClass asSymbol) class implements: specSelector) 
  2861     ((Smalltalk at: specClass asSymbol) class implements: specSelector)