[Cuis-dev] [IMPROV] KeyboardFocus in Titlebar

Gerald Klix cuis.01 at klix.ch
Thu Dec 2 06:00:09 PST 2021


Hi all, Hi Juan,

Please find attached a change-set, that indicates the keyboard focus
in the title-bar of SystemWindows.


Hope you like it and Best Regards,

Gerald
-------------- next part --------------
'From Haver 5.0 [latest update: #4995] on 2 December 2021 at 2:56:20 pm'!
"Change Set:		4997-KeyboardFocus-GeraldKlix-2021Dec02-14h56m
Date:			2 December 2021
Author:			Gerald Klix

Provides keyboard focus indication in the title-bar of SystemWindows"!


!Preferences class methodsFor: 'standard queries' stamp: 'KLG 11/29/2021 12:44:29'!
titlebarIndicatesKeyboardFocus
	"Answer true if the title bar should indicate the keyboard focus."

	^ self
		valueOfFlag: #titlebarIndicatesKeyboardFocus
		ifAbsent: [ true ].! !


!HandMorph methodsFor: 'focus handling' stamp: 'KLG 11/29/2021 12:59:33'!
newKeyboardFocus: aMorphOrNil
	"Make the given morph the new keyboard focus, canceling the previous keyboard focus if any. If the argument is nil, the current keyboard focus is cancelled."

	| oldFocus |
	oldFocus _ keyboardFocus.
	keyboardFocus _ aMorphOrNil.
	oldFocus ifNotNil: [
		oldFocus == aMorphOrNil ifFalse: [ oldFocus keyboardFocusChange: false ].
		Preferences titlebarIndicatesKeyboardFocus ifTrue: [
			oldFocus owningWindow ifNotNil: [ :window |
				window redrawNeeded ]]].
	aMorphOrNil ifNotNil: [
		aMorphOrNil keyboardFocusChange: true.
		Preferences titlebarIndicatesKeyboardFocus ifTrue: [
			aMorphOrNil owningWindow ifNotNil: [ :window |
				window redrawNeeded ]]].! !


!SystemWindow methodsFor: 'drawing' stamp: 'KLG 12/2/2021 14:25:33'!
drawClassicFrameOn: aCanvas color: windowFrameColor
	"Window border encompasses title area. No round corners. No title gradient."

	aCanvas
		fillRectangle: (self morphLocalBounds insetBy: 1.5)
		color: color
		borderWidth: borderWidth
		borderStyleSymbol: #simple
		baseColorForBorder: self widgetsColor.
	"A border was drawn at the left, top and right of the title area.
	The look is that the title area is inside the window"
	aCanvas
		fillRectangle: (borderWidth @ borderWidth extent: extent x - (2 * borderWidth) @ self labelHeight)
		color:
			(self submorphHasKeyboardFocus 
				ifTrue: [ Theme current titlebarColorFromWindowFrameColor: windowFrameColor ]
				ifFalse: [ windowFrameColor ]).! !

!SystemWindow methodsFor: 'drawing' stamp: 'KLG 12/2/2021 14:26:01'!
drawRoundedFrameOn: aCanvas color: widgetsColor

	aCanvas
		drawRoundedFrame: self morphLocalBounds
		border: borderWidth 
		color: widgetsColor
		insideColor: color
		labelHeight: self labelHeight.
	self shouldIndicateKeyboardFocus ifTrue: [
		aCanvas
			roundRect: (0 @ 0 extent: extent x - borderWidth @ self labelHeight + borderWidth)
			color: (Theme current titlebarColorFromWindowFrameColor: widgetsColor)
			radius: Theme current roundedWindowRadius ].! !

!SystemWindow methodsFor: 'testing' stamp: 'KLG 11/29/2021 12:46:56'!
shouldIndicateKeyboardFocus
	"Answer true if the titlebar should indicate the keyboard focus."

	^ Preferences titlebarIndicatesKeyboardFocus and: [
		self submorphHasKeyboardFocus ]! !

!SystemWindow methodsFor: 'testing' stamp: 'KLG 11/29/2021 12:28:42'!
submorphHasKeyboardFocus
	"Answer true if one of my submoprhs have the keyboard focus."

	^ self runningWorld
		ifNotNil: [ :world |
			world activeHand keyboardFocus 
				ifNotNil: [ :morphInFocus |
					morphInFocus owningWindow == self ]
				ifNil: [ false ] ]
		ifNil: [ false ]! !


!Theme methodsFor: 'colors' stamp: 'KLG 12/2/2021 14:33:01'!
titlebarColorFromWindowFrameColor: aWindowFrameColor
	"Convert the title bar color to the window frame color."

	^ aWindowFrameColor darker ! !


!DarkTheme methodsFor: 'colors' stamp: 'KLG 12/2/2021 14:25:04'!
titlebarColorFromWindowFrameColor: aWindowFrameColor
	"Convert the title bar color to the window frame color."

	^ aWindowFrameColor mixed: 0.5 with: `Color orange`! !


!Preferences class reorganize!
('add preferences' addPreference:categories:default:balloonHelp: addPreference:category:default:balloonHelp:)
('bigger and smaller GUI' bigFonts defaultFont05 defaultFont06 defaultFont07 defaultFont08 defaultFont09 defaultFont10 defaultFont11 defaultFont12 defaultFont14 defaultFont17 defaultFont22 defaultFont28 defaultFont36 defaultFont46 defaultFont60 defaultFont80 haloHandleSize hugeFonts smallFonts standardFonts tinyFonts veryBigFonts verySmallFonts)
('class finder' classFinder classFinder: restoreDefaultClassFinder)
('class state access' parameters preferencesDictionary releaseClassState)
('code generation' leftArrowAssignmentsInGeneratedCodeWithComputedDefault)
('exception handling' allowNonLocalReturnsInExceptionHandlers warnAboutNonLocalReturnsInExceptionHandlers)
('fonts' cacheTrueTypeGlyphs loadOnlyLatinGlyphData properDisplayAlphaForFonts restoreDefaultFonts setButtonFontTo: setCodeFontTo: setDefaultFont: setDefaultFont:spec: setListFontTo: setMenuFontTo: setSystemFontTo: setWindowTitleFontTo: standardButtonFont standardCodeFont standardListFont standardMenuFont subPixelRenderColorFonts windowTitleFont)
('get/set' disable: disableFocusFollowsMouse disableTileResizerInWindowMenu doesNotUnderstand: enable: enableFocusFollowsMouse enableTileResizerInWindowMenu setPreference:toValue: valueOfFlag: valueOfFlag:ifAbsent:)
('halos' haloSpecifications iconicHaloSpecifications installHaloSpecsFromArray: installHaloTheme: resetHaloSpecifications)
('hard-coded prefs' desktopMenuTitle)
('initialization' compileAccessMethodForPreference: setPreferencesFrom:)
('menu icons' useMenuIcons useNoMenuIcons)
('misc' cacheDisplayContentWhenMovingMorphs wantsChangeSetLogging)
('parameters' annotationInfo classAnnotations defaultAuthorName methodAnnotations setDefaultAnnotationsInBrowsers setQuickAnnotationsInBrowsers systemCategoryAnnotations)
('personalization' askConfirmationOnQuit askToInstallComplexPackage compileHardCodedPref:enable: disableProgrammerFacilities enableProgrammerFacilities fullPrintItInWorkspaces usePreDebugWindow)
('preference-object access' preferenceAt: preferenceAt:ifAbsent:)
('preferences panel' openPreferencesInspector)
('scrollbar parameters')
('shout' backgroundColorFillsAllBackground highlightBlockNesting italicsInShout shoutInWorkspaces useAlwaysLeftArrow useAssignmentGlyphLeftArrow)
('standard queries' aaFontsColormapDepth allowBlockArgumentAssignment alternativeBrowseIt assignmentGlyphSelector autoNumberUserChanges automaticPlatformSettings balloonHelpEnabled biggerCursors browseWithPrettyPrint canRecordWhilePlaying caseSensitiveFinds changeSetVersionNumbers cheapWindowReframe checkForSlips clickGrabsMorphs cmdDotEnabled cmdDotInterruptTakesStatistics ctrlArrowsScrollHorizontally debugHaloHandle debugLogTimestamp debugShowDamage debugShowDamage2 decorateBrowserButtons diffsInChangeList diffsWithPrettyPrint dismissAllOnOptionClose drawKeyboardFocusIndicator extraDebuggerButtons focusFollowsMouse focusIndicatorWidth fullScreenLeavesDeskMargins haloEnclosesFullBounds halosShowCoordinateSystem leftArrowAssignmentsInGeneratedCode listClassesHierarchically logDebuggerStackToFile menuKeyboardControl menusShowSubSectionTitles optionalButtons prettyPrintRectangularBlocks selectionsMayShrink selectiveHalos serverMode showAnnotations showLinesInHierarchyViews soundQuickStart soundStopWhenDone soundsEnabled stylingWithEmphasisInWorkspaces subPixelRenderFonts syntaxHighlightingAsYouType syntaxHighlightingAsYouTypeAnsiAssignment syntaxHighlightingAsYouTypeLeftArrowAssignment systemWindowEmbedOK tapAndHoldEmulatesButton2 thoroughSenders tileResizerInWindowMenu titlebarIndicatesKeyboardFocus transcriptLogVerbose wantsMenuIcons warnIfNoChangesFile warnIfNoSourcesFile)
('start up' checkLostChangesOnStartUp)
('themes' cuisDefaults forMouse forTouch slowMachine smalltalk80)
('user changes' use:asUserChangesFileNameExtensionWhile: userChangesFileNameExtension)
('file list' addInitialFileListDirectory: initialFileListDirectories initialFileListDirectories: isInitialFileListDirectory: removeInitialFileListDirectory:)
('system startup')
('bigger and smaller GUI element sizes' roundedButtonRadius roundedWindowRadius scrollbarThickness)
!


!HandMorph reorganize!
('accessing' lastMouseEvent lastMouseEventTime mouseOverHandler)
('balloon help' balloonHelp balloonHelp: deleteBalloonTarget: removePendingBalloonFor: spawnBalloonFor: triggerBalloonFor:after:)
('caching' releaseCachedState)
('classification' is:)
('double click support' dontWaitForMoreClicks waitForClicksOrDrag:event:clkSel:dblClkSel: waitForClicksOrDrag:event:dragSel:clkSel: waitForClicksOrDragOrSimulatedMouseButton2:event:clkSel: waitForClicksOrDragOrSimulatedMouseButton2:event:clkSel:clkNHalf:dblClkSel:dblClkNHalfSel:tripleClkSel: waitForClicksOrDragOrSimulatedMouseButton2:event:clkSel:clkNHalf:dblClkSel:dblClkNHalfSel:tripleClkSel:dragSel: waitingForMoreClicks)
('drawing' drawOn: fullDrawHandOn: hideHardwareCursor isDrawnBySoftware restoreSavedPatchOn: savePatchFrom: showHardwareCursor)
('event handling' createEventFrom:ofType: flushEvents noticeMouseOver:event: processEventQueue)
('events-processing' startDropEventDispatch: startDropFilesEventDispatch: startEventDispatch: startKeyboardDispatch: startMouseDispatch: startWindowEventDispatch:)
('focus handling' activateNextWindow activatePreviousWindow keyboardFocus keyboardFocusNext keyboardFocusPrevious mouseFocus newKeyboardFocus: newMouseFocus: nextFocusMorph nextFocusWindow previousFocusMorph previousFocusWindow releaseAllFoci releaseKeyboardFocus releaseKeyboardFocus: releaseMouseFocus releaseMouseFocus:)
('geometry' basicDisplayBounds displayFullBoundsForPatch morphPosition:)
('geometry testing' submorphsMightProtrude)
('grabbing/dropping' attachMorph: attachMorphBeside: dropMorph:event: dropMorphs: grabMorph: grabMorph:delta: grabMorph:moveUnderHand:)
('halo handling' halo: obtainHalo: releaseHalo: removeHaloFromClick:on:)
('halos and balloon help' halo)
('initialization' initForEvents initialize)
('testing' isIncludedInTaskbar)
('objects from disk' objectForDataStream:)
('paste buffer' pasteMorph)
('updating')
('private' forgetGrabMorphDataFor: grabMorphDataFor: rememberGrabMorphDataFor:)
('private events' generateDropFilesEvent: generateKeyboardEvent: generateMouseEvent: generateMouseScrollEvent: generateWindowEvent: mouseTrailFrom: shouldControlEmulateAltFor:)
!


!SystemWindow reorganize!
('GUI building' buttonColor defaultButtonPaneHeight textBackgroundColor windowColor)
('change reporting' invalidateTitleArea)
('drawing' drawClassicFrameOn:color: drawLabelOn: drawOn: drawRoundedFrameOn:color: makeMeFullyVisible makeMeVisible visible:)
('events' wantsToBeDroppedInto:)
('geometry' fontPreferenceChanged justDroppedInto:event: minimumExtent rescaleButtons)
('geometry services' on:ifCovered:uncoveredPartsDo:else:)
('initialization' createCloseButton createCollapseButton createExpandButton createMenuButton defaultBorderWidth defaultColor initialize initializeLabelArea openInWorld)
('label' label labelHeight relabel setLabel: update:)
('layout' beColumn beRow layoutMorph layoutSubmorphs)
('menu' addCustomMenuItems:hand: addTileResizerMenuTo: addWindowControlTo: buildWindowMenu changeColor fullScreen makeSecondTopmost offerWindowMenu sendToBack setWindowColor setWindowColor:)
('open/close' closeBoxHit delete initialExtent initialFrameIn: openInWorld:)
('panes' widgetsColor widgetsColor: windowFrameColor)
('printing' printOn:)
('resize/collapse' allowedArea expandBoxHit resize resize: resizeBottom resizeBottomLeft resizeBottomRight resizeFull resizeLeft resizeRight resizeTop resizeTopLeft resizeTopRight)
('resizing' windowBottom: windowBottomLeft: windowBottomRight: windowLeft: windowRight: windowTop: windowTopLeft: windowTopRight:)
('stepping' stepAt: stepTime wantsSteps wantsStepsWhenCollapsed)
('structure' owningWindow)
('submorphs-accessing')
('submorphs-add/remove' addMorph: addMorph:layoutSpec:)
('testing' is: shouldIndicateKeyboardFocus submorphHasKeyboardFocus)
('top window' activate activateAndForceLabelToShow activateAndSendTopToBack: isTopWindow submorphToFocusKeyboard)
('user interface' canDiscardEditsOf: hasSaveAs isItOkToLooseChanges notifyUserWith: okToChange okToChangeDueTo: saveContents saveContentsTo:)
!


!Theme reorganize!
('colors' background buttonColorFrom: buttonLabel errorColor failureColor focusIndicator line missingCommentTextColor paneBackgroundFrom: scrollbarButtonColor scrollbarColor scrollbarSliderShadowColor successColor text textCursor textEmptyDisplayMessage textHighlight textHighlightFocused: titlebarColorFromWindowFrameColor: unfocusedTextHighlightFrom: windowLabel)
('menu colors' menu menuHighlight menuText menuTitleBar)
('tool colors' autoCompleter autoCompleterDefaultBorderColor autoCompleterMaybeInvalid browser changeList changeSorter debugger defaultWindowColor dualChangeSorter fileContentsBrowser fileList messageNames messageSet object packageList testRunner textEditor transcript versionsBrowser workspace)
('widget colors' acceptButton cancelButton hoverHelp listHighlightFocused: listMultiHighlightFocused: textPane)
('other options' buttonBorderWidth buttonPaneHeight embossedButtonLabels embossedTitles fullScreenDeskMargin layoutAdjusterThickness menuBorderWidth roundButtons roundWindowCorners roundedButtonRadius roundedWindowRadius scrollbarShowButtons scrollbarThickness titleBarButtonsExtent titleGradientBottomFactor titleGradientExtraLightness titleGradientTopFactor useTaskbar useUniformColors useWindowTitleGradient windowBorderWidth)
('private - shout mappings' ansiAssignment argumentTypes assignment blockLevelFive blockLevelFour blockLevelOne blockLevelSeven blockLevelSix blockLevelThree blockLevelTwo blockLevelZero blockTemps defaults generateShoutConfig globals incompleteMessages instVar italic literals messages methodTags pattern pseudoVariables return symbols tempBar tempVars undefined)
('icons' acceptIcon addressBookIcon appearanceIcon blankIcon cancelIcon changesIcon chatIcon classIcon clockIcon closeIcon collapseIcon copyIcon cutIcon dateIcon debugIcon deleteIcon developmentIcon displayIcon doItIcon editFindReplaceIcon emblemImportantIcon exitFullscreenIcon expandIcon exploreIcon fileOutIcon findIcon fontIcon fontXGenericIcon formatJustifyCenterIcon formatJustifyFillIcon formatJustifyLeftIcon formatJustifyRightIcon genericTextIcon globeIcon goBottomIcon goDownIcon goTopIcon goUpIcon graphicsIcon halfRefreshIcon haloCollapseIcon haloColorIcon haloDebugIcon haloDismissIcon haloDragIcon haloDuplicateIcon haloFontEmphasisIcon haloFontSizeIcon haloGrabIcon haloHelpIcon haloMenuIcon haloResizeIcon haloRotateIcon haloScaleIcon helpIcon imageIcon inspectIcon instanceIcon junkIcon keyboardShortcutsIcon listAddIcon listRemoveIcon mailForwardIcon mailMarkJunkIcon mediaPlaybackStartIcon morphsIcon newFolderIcon newIcon newWindowIcon openIcon packageIcon pasteIcon preferencesDesktopFontIcon preferencesIcon printIcon printerIcon pushPinIcon quitIcon redoIcon removableMediaIcon resizeBottomIcon resizeBottomLeftIcon resizeBottomRightIcon resizeFullIcon resizeLeftIcon resizeRightIcon resizeTopIcon resizeTopLeftIcon resizeTopRightIcon saveAndQuitIcon saveAsIcon saveAsNewVersionIcon saveIcon scriptIcon selectAllIcon sendReceiveIcon speadsheetTemplateIcon spreadsheetIcon stillCameraIcon switchIcon systemFileManagerIcon systemIcon systemMonitorIcon terminalIcon textEditorIcon undoIcon updateIcon usersIcon viewFullscreenIcon wallpaperIcon warningIcon weatherFewCloudsIcon windowIcon windowMenuIcon worldIcon)
('icon lookup' appendExtensionToContentSpec: fetch: prepend:toContentSpec:)
('shout' shout)
!


!DarkTheme reorganize!
('colors' background buttonLabel defaultWindowColor missingCommentTextColor paneBackgroundFrom: shout text textHighlight textPane titlebarColorFromWindowFrameColor: unfocusedTextHighlightFrom: useUniformColors)
('other options' windowLabel)
('menu colors' menu menuText)
!



More information about the Cuis-dev mailing list