Skip to content

Commit

Permalink
Merge pull request #3576 from estebanlm/3575-add-setting-to-choose-OS…
Browse files Browse the repository at this point in the history
…Window-driver

3575-add-setting-to-choose-OSWindow-driver
  • Loading branch information
tesonep committed Jun 19, 2019
2 parents d63c606 + e33b665 commit f48cfb1
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions src/OSWindow-Core/OSWindowDriver.class.st
Expand Up @@ -16,19 +16,36 @@ Class {
#superclass : #Object,
#classVars : [
'Current',
'DriverClass',
'Session'
],
#category : #'OSWindow-Core-Utilities'
}

{ #category : #accessing }
OSWindowDriver class >> current [
^ Session == Smalltalk session ifTrue: [ Current ifNil: [Current := self pickDriver ]]
ifFalse: [
Session := Smalltalk session.
Current := self pickDriver
]

Session == Smalltalk session ifTrue: [
^ Current ifNil: [ Current := self driverClass new ] ].

Session := Smalltalk session.
^ Current := self driverClass new
]

{ #category : #settings }
OSWindowDriver class >> driverClass [

^ DriverClass ifNil: [ DriverClass := self pickDriverClass ]
]

{ #category : #settings }
OSWindowDriver class >> driverClass: aClass [

self driverClass = aClass ifTrue: [ ^ self ].

DriverClass := aClass.
Current := nil.
self inform: 'You need to restart your image for this changes to take effect.'
]

{ #category : #'class initialization' }
Expand All @@ -49,9 +66,28 @@ OSWindowDriver class >> isSupported [
]

{ #category : #'driver selection' }
OSWindowDriver class >> pickDriver [
self subclassesDo: [ :s | s isSuitable ifTrue: [ ^ s new ] ].
^ OSNullWindowDriver new
OSWindowDriver class >> pickDriverClass [

self subclassesDo: [ :s | s isSuitable ifTrue: [ ^ s ] ].
^ OSNullWindowDriver
]

{ #category : #settings }
OSWindowDriver class >> settingsOn: aBuilder [
<systemsettings>

(aBuilder group: #oswindow)
label: 'OSWindow';
parent: #pharoSystem;
description: 'OSWindow subsystem';
with: [
(aBuilder pickOne: #driverClass)
label: 'Driver to use';
description: 'Select the driver to use for OSWindow.
WARNING: Changing the driver will change the world rendering itself.
You will need to restart the image to make this changes take effect.';
target: self;
domainValues: (self allSubclasses select: [ :each | each isSuitable ]) ]
]

{ #category : #'system startup' }
Expand Down

0 comments on commit f48cfb1

Please sign in to comment.