[ENH]Scamper buttonRow: back, forward, home, stop v0.2

Karl Ramberg karl.ramberg at chello.se
Sun Jun 11 12:39:08 UTC 2000


Well, one should attach :-)

Karl Ramberg wrote:
> 
> Added buttons to the top of Scamper to improve navigation
> speed. The Stop button is quite useful.
> To do: Optional if the button row is shown. Find the bookmarks enhancement,
> include that and add a bookmarks button.
> 
> New in v0.2
> ReloadButton
> Changed layout for all panes so less space is wasted, hopefully.
> Fixed editStartPage
> 
> Karl
-------------- next part --------------
'From Squeak2.8alpha of 19 February 2000 [latest update: #2310] on 11 June 2000 at 1:35:54 pm'!

!Scamper methodsFor: 'menus' stamp: 'kfr 6/11/2000 13:33'!
editStartPage
	| win textMorph |
	Smalltalk isMorphic ifFalse: [^ self inform: 'only works for morphic currently'].

	win _ SystemWindow labelled: 'edit Bookmark page'.
	win model: self.
	textMorph _ PluggableTextMorph on: self text: #startPage  accept: #startPage:.
	win addMorph: textMorph frame: (0 at 0 extent: 1 at 1).
	win openInWorld.
	^ true! !

!Scamper methodsFor: 'menus' stamp: 'kfr 6/11/2000 13:24'!
reload
	self stopEverything.
	self jumpToUrl: currentUrl
	
! !

!Scamper methodsFor: 'user interface' stamp: 'kfr 6/11/2000 13:26'!
openAsMorph
	"open a set of windows for viewing this browser"
	|win urlMorph buttonRow button |

	"create a window for it"
	win _ SystemWindow labelled: 'Scamper'.
	win model: self.
	win setProperty: #webBrowserView toValue: true.

	"create a button row"

	buttonRow _ AlignmentMorph new.
	buttonRow borderWidth: 0.
	buttonRow inset: 0.
buttonRow hResizing: #spaceFill.
	buttonRow centering: #center.
	buttonRow setProperty: #clipToOwnerWidth toValue: true.
	buttonRow addTransparentSpacerOfSize: (5 at 0).
	
	
	button _ SimpleButtonMorph new label: 'Back';
			 target: self;
			 color: Color transparent;
			 cornerStyle: #rounded;
			borderColor: Color black;
			 actionSelector: #back;
			 actWhen: #buttonUp;
			setBalloonText: 'Go back to previous URL in history'.
	buttonRow addMorphBack: button.
	buttonRow addTransparentSpacerOfSize: (5 at 0).
	
	button _ SimpleButtonMorph new label: 'Forward';
			target: self;
color: Color transparent;
			 cornerStyle: #rounded;
			borderColor: Color black;
			 actionSelector: #forward;
			 actWhen: #buttonUp;
			setBalloonText: 'Go forward to next URL in history'.
	buttonRow addMorphBack: button.
buttonRow addTransparentSpacerOfSize: (5 at 0).

button _ SimpleButtonMorph new label: 'Reload';
			target: self;
color: Color transparent;
			 cornerStyle: #rounded;
			borderColor: Color black;
			 actionSelector: #reload;
			 actWhen: #buttonUp;
			setBalloonText: 'Reload page'.
	buttonRow addMorphBack: button.
buttonRow addTransparentSpacerOfSize: (5 at 0).

	button _ SimpleButtonMorph new label: 'Home';
			 target: self;
color: Color transparent;
			 cornerStyle: #rounded;
			borderColor: Color black;
			 actionSelector: #visitStartPage;
			 actWhen: #buttonUp;
			setBalloonText: 'Go to start page.'.
	buttonRow addMorphBack: button.
buttonRow addTransparentSpacerOfSize: (5 at 0).	
	
	button _ SimpleButtonMorph new label: 'Stop!!';
			 target: self;
color: Color transparent;
			 cornerStyle: #rounded;
			borderColor: Color black;
			 actionSelector: #stopEverything;
			 actWhen: #buttonUp;
			setBalloonText: 'Stop loading page.'.
	buttonRow addMorphBack: button.

	
	win addMorph: buttonRow frame: (0 at 0 extent: 1 at 0.07).

	"create a view of the current url"
	urlMorph _  PluggableTextMorph on: self text: #currentUrl accept: #jumpToAbsoluteUrl:.
	urlMorph acceptOnCR: true.
	win addMorph: urlMorph frame: (0 at 0.07 extent: 1 at 0.06).

"create the text area"
	win addMorph: (WebPageMorph on: self bg: #backgroundColor text: #formattedPage readSelection: #formattedPageSelection menu: #menu:shifted:)
		frame: (0 at 0.13 extent: 1 at 0.81).

	"create a status view"
	win addMorph: (PluggableTextMorph on: self text: #status accept: nil) frame: (0 at 0.94 extent: 1.0 at 0.06).

	
	
	win openInWorld.
	^win! !



More information about the Squeak-dev mailing list