337 'Generates aspect methods for defined aspect selectors of the widgets' |
337 'Generates aspect methods for defined aspect selectors of the widgets' |
338 |
338 |
339 #generateHookMethods |
339 #generateHookMethods |
340 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)' |
340 'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)' |
341 |
341 |
342 "/ #group |
|
343 "/ '' |
|
344 |
|
345 #helpExamples |
342 #helpExamples |
346 'Show some examples uses of the GUI Painter' |
343 'Show some examples uses of the GUI Painter' |
347 |
344 |
348 #helpFunctions |
345 #helpFunctions |
349 'Show the documentation on the GUI Painters menu and button functions' |
346 'Show the documentation on the GUI Painters menu and button functions' |
453 #testStartApplication |
450 #testStartApplication |
454 'Starts the application with the current window spec' |
451 'Starts the application with the current window spec' |
455 |
452 |
456 #useDefaultColorToggle |
453 #useDefaultColorToggle |
457 'Toggle between default and explicit color' |
454 'Toggle between default and explicit color' |
|
455 |
|
456 #wrapInto |
|
457 '' |
458 |
458 |
459 ) |
459 ) |
460 ! ! |
460 ! ! |
461 |
461 |
462 !UIPainter class methodsFor:'helpers'! |
462 !UIPainter class methodsFor:'helpers'! |
2215 enabled: canReplaceSelection |
2215 enabled: canReplaceSelection |
2216 label: 'Replace By...' |
2216 label: 'Replace By...' |
2217 itemValue: doAskAndReplaceWidgetBy |
2217 itemValue: doAskAndReplaceWidgetBy |
2218 ) |
2218 ) |
2219 (MenuItem |
2219 (MenuItem |
|
2220 activeHelpKey: wrapInto |
|
2221 enabled: canWrapeSelection |
|
2222 label: 'Wrap Into...' |
|
2223 itemValue: doAskAndWrapWidgetInto |
|
2224 isVisible: false |
|
2225 ) |
|
2226 (MenuItem |
2220 label: '-' |
2227 label: '-' |
2221 ) |
2228 ) |
2222 (MenuItem |
2229 (MenuItem |
2223 enabled: canMoveSelection |
2230 enabled: canMoveSelection |
2224 label: 'Move' |
2231 label: 'Move' |
3009 and all widgets in the selection can be resized" |
3016 and all widgets in the selection can be resized" |
3010 |
3017 |
3011 ^ builder booleanValueAspectFor:#canResizeSelection |
3018 ^ builder booleanValueAspectFor:#canResizeSelection |
3012 ! |
3019 ! |
3013 |
3020 |
|
3021 canWrapSelection |
|
3022 treeView isCanvasSelected ifTrue:[^ false]. |
|
3023 ^ true |
|
3024 ! |
|
3025 |
3014 editToolBarVisibleHolder |
3026 editToolBarVisibleHolder |
3015 |holder| |
3027 |holder| |
3016 |
3028 |
3017 (holder := builder bindingAt:#editToolBarVisibleHolder) isNil ifTrue:[ |
3029 (holder := builder bindingAt:#editToolBarVisibleHolder) isNil ifTrue:[ |
3018 holder := self class defaultEditToolbarVisible asValue. |
3030 holder := self class defaultEditToolbarVisible asValue. |
4923 self clearModified. |
4935 self clearModified. |
4924 ] |
4936 ] |
4925 ! |
4937 ! |
4926 |
4938 |
4927 doAskAndReplaceWidgetBy |
4939 doAskAndReplaceWidgetBy |
|
4940 "ask for a widget class, |
|
4941 and replace the selected widget by a new instance of that one, |
|
4942 which gets the old widget's layout" |
|
4943 |
4928 |widgetClass list common selectedSpec| |
4944 |widgetClass list common selectedSpec| |
4929 |
4945 |
4930 selectedSpec := self selectedSpec. |
4946 selectedSpec := self selectedSpec. |
4931 selectedSpec isNil ifTrue:[^ self]. |
4947 selectedSpec isNil ifTrue:[^ self]. |
4932 |
4948 |
4941 common := selectedSpec class commonReplacementClasses. |
4957 common := selectedSpec class commonReplacementClasses. |
4942 common notEmpty ifTrue:[ |
4958 common notEmpty ifTrue:[ |
4943 list addAllFirst:(common , (Array with:'-')). |
4959 list addAllFirst:(common , (Array with:'-')). |
4944 ]. |
4960 ]. |
4945 widgetClass := Dialog |
4961 widgetClass := Dialog |
4946 requestClass:'Spec- or View-Class:' |
4962 requestClass:'Replace by (Spec or View Class):' |
4947 list:list |
4963 list:list |
4948 okLabel:'OK' |
4964 okLabel:'OK' |
4949 initialAnswer:nil. |
4965 initialAnswer:nil. |
4950 widgetClass isNil ifTrue:[ |
4966 widgetClass isNil ifTrue:[ |
4951 ^ self |
4967 ^ self |
4952 ]. |
4968 ]. |
4953 self replaceWidgetByClass:widgetClass |
4969 self replaceWidgetByClass:widgetClass |
4954 |
4970 |
4955 "Modified: / 05-09-2012 / 19:31:22 / cg" |
4971 "Modified: / 05-09-2012 / 19:31:22 / cg" |
|
4972 ! |
|
4973 |
|
4974 doAskAndWrapWidgetInto |
|
4975 "ask for a container class, |
|
4976 and put the selected widget into a new instance of that one, |
|
4977 which gets the wrapped widget's layout" |
|
4978 |
|
4979 |widgetClass list selectedSpec| |
|
4980 |
|
4981 Dialog information:'sorry - unfinished.'. |
|
4982 ^ self. |
|
4983 selectedSpec := self selectedSpec. |
|
4984 selectedSpec isNil ifTrue:[^ self]. |
|
4985 |
|
4986 list := UISpecification allSubclasses |
|
4987 select:[:cls | |
|
4988 [ cls viewClass notNil |
|
4989 and:[ cls supportsSubComponents ]] |
|
4990 on: NotFoundError |
|
4991 do:[ false ] |
|
4992 ]. |
|
4993 list sort:[:a :b | a name < b name]. |
|
4994 |
|
4995 widgetClass := Dialog |
|
4996 requestClass:'Wrap into (Spec or View Class):' |
|
4997 list:list |
|
4998 okLabel:'OK' |
|
4999 initialAnswer:nil. |
|
5000 widgetClass isNil ifTrue:[ |
|
5001 ^ self |
|
5002 ]. |
|
5003 self wrapWidgetIntoClass:widgetClass |
4956 ! |
5004 ! |
4957 |
5005 |
4958 doBrowseActionMethod:aspectSelector |
5006 doBrowseActionMethod:aspectSelector |
4959 "browse or create the action method as entered in the field (button beside input filed pressed)" |
5007 "browse or create the action method as entered in the field (button beside input filed pressed)" |
4960 |
5008 |
5846 hideToolbar |
5894 hideToolbar |
5847 self toolBarVisibleHolder value:false |
5895 self toolBarVisibleHolder value:false |
5848 ! |
5896 ! |
5849 |
5897 |
5850 replaceWidgetByClass:aSpecOrWidgetClass |
5898 replaceWidgetByClass:aSpecOrWidgetClass |
|
5899 "replace the selected widget by a new instance of aSpecOrWidgetClass, |
|
5900 which gets the old widget's layout" |
|
5901 |
5851 |newSpecClass oldSpec newSpec| |
5902 |newSpecClass oldSpec newSpec| |
|
5903 |
|
5904 treeView isCanvasSelected ifTrue:[ |
|
5905 ^ self |
|
5906 ]. |
|
5907 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
5908 ^ newSpecClass |
|
5909 ]. |
|
5910 |
|
5911 oldSpec := self selectedSpec. |
|
5912 newSpec := newSpecClass cloneFrom:oldSpec. |
|
5913 |
|
5914 self painter replaceSelectionBy:newSpec. |
|
5915 |
|
5916 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
5917 ! |
|
5918 |
|
5919 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass |
|
5920 |newSpecClass| |
5852 |
5921 |
5853 (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[ |
5922 (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[ |
5854 newSpecClass := aSpecOrWidgetClass. |
5923 newSpecClass := aSpecOrWidgetClass. |
5855 ] ifFalse:[ |
5924 ] ifFalse:[ |
5856 (aSpecOrWidgetClass isSubclassOf:View) ifTrue:[ |
5925 (aSpecOrWidgetClass isSubclassOf:View) ifTrue:[ |
5859 newSpecClass := nil |
5928 newSpecClass := nil |
5860 ]. |
5929 ]. |
5861 ]. |
5930 ]. |
5862 newSpecClass isNil ifTrue:[ |
5931 newSpecClass isNil ifTrue:[ |
5863 Dialog warn:'Invalid Spec- or View-Class: ' , aSpecOrWidgetClass name. |
5932 Dialog warn:'Invalid Spec- or View-Class: ' , aSpecOrWidgetClass name. |
5864 ^ self. |
5933 ^ nil. |
5865 ]. |
5934 ]. |
5866 |
5935 ^ newSpecClass |
5867 treeView isCanvasSelected ifTrue:[ |
|
5868 ^ self |
|
5869 ]. |
|
5870 oldSpec := self selectedSpec. |
|
5871 newSpec := newSpecClass cloneFrom:oldSpec. |
|
5872 |
|
5873 self painter replaceSelectionBy:newSpec. |
|
5874 |
|
5875 "Modified: / 05-09-2012 / 19:24:40 / cg" |
|
5876 ! |
5936 ! |
5877 |
5937 |
5878 useBackgroundImage |
5938 useBackgroundImage |
5879 "select bitmap to underly" |
5939 "select bitmap to underly" |
5880 |
5940 |
5900 ^ self |
5960 ^ self |
5901 ]. |
5961 ]. |
5902 painter useSketchFile:fn |
5962 painter useSketchFile:fn |
5903 |
5963 |
5904 "Created: / 16-01-2008 / 17:49:20 / cg" |
5964 "Created: / 16-01-2008 / 17:49:20 / cg" |
|
5965 ! |
|
5966 |
|
5967 wrapWidgetIntoClass:aSpecOrWidgetClass |
|
5968 "put the selected widget into a new instance of aSpecOrWidgetClass, |
|
5969 which gets the wrapped widget's layout" |
|
5970 |
|
5971 |newSpecClass oldSpec newSpec| |
|
5972 |
|
5973 treeView isCanvasSelected ifTrue:[ |
|
5974 ^ self |
|
5975 ]. |
|
5976 (newSpecClass := self specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass) isNil ifTrue:[ |
|
5977 ^ newSpecClass |
|
5978 ]. |
|
5979 |
|
5980 oldSpec := self selectedSpec. |
|
5981 newSpec := newSpecClass cloneFrom:oldSpec. |
|
5982 |
|
5983 self painter wrapSelectionInto:newSpec. |
|
5984 |
|
5985 "Modified: / 05-09-2012 / 19:24:40 / cg" |
5905 ! ! |
5986 ! ! |
5906 |
5987 |
5907 !UIPainter::TreeView class methodsFor:'documentation'! |
5988 !UIPainter::TreeView class methodsFor:'documentation'! |
5908 |
5989 |
5909 documentation |
5990 documentation |