|
Class: OSXOperatingSystem
Object
|
+--AbstractOperatingSystem
|
+--UnixOperatingSystem
|
+--OSXOperatingSystem
- Package:
- stx:libbasic
- Category:
- OS-Unix
- Version:
- rev:
1.57
date: 2019/07/23 08:31:08
- user: cg
- file: OSXOperatingSystem.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
a small number of OS-X specific redefinitions here.
cocoa - events
-
finishLaunching
-
tell the system, that I have finished my startup phase.
OSX will stop bounding the launch icon then.
usage example(s):
-
generateButtonEvent: button down: down x: screenX y: screenY
-
synthesize and send a button event to the screen
usage example(s):
OperatingSystem generateButtonEvent:1 down:true x:150 y:150.
OperatingSystem generateButtonEvent:1 down:false x:150 y:150.
OperatingSystem generateButtonEvent:2 down:true x:150 y:150.
OperatingSystem generateButtonEvent:2 down:false x:150 y:150.
|
-
generateKeyboardEvent: keyCode down: down
-
synthesize and send a keyboard event to the screen
usage example(s):
OperatingSystem generateKeyboardEvent:6 down:true.
OperatingSystem generateKeyboardEvent:6 down:false.
|
-
generateMouseMoveEventX: screenX y: screenY
-
synthesize and send a mouse move event to the screen
usage example(s):
OperatingSystem generateMouseMoveEventX:150 y:5.
Delay waitFor:(1 seconds).
OperatingSystem generateMouseMoveEventX:1050 y:150.
|
-
getNSApp
-
get the NSApplication instance and remember in the global named NSApp
usage example(s):
-
receiveNextEvent
-
dummy shell operations
-
openApplicationForDocument: aFilenameOrString operation: operationSymbol
-
open a windows-shell/mac finder/desktop application to present the document contained in aFilenameOrString.
This is typically used to present help-files, html documents, pdf documents etc.
operationSymbol is one of:
open
edit
explore
-
openApplicationHelperCommand
-
Return a command line helper to open a default application for file or URL
-
openTerminalWithCommand: shellCommand inBackground: inBackground
-
open a new terminal, which executes a command
usage example(s):
OSXOperatingSystem openTerminalWithCommand:'ls -l' inBackground:true
|
file queries
-
caseSensitiveFilenames
-
return true, if the OS has caseSensitive file naming.
On MSDOS, this will return false;
on a real OS, we return true.
Be aware, that OSX can be configured to be either.
Also, that it actually depends on the mounted volume
-
defaultPackagePath
-
redefined to add /Application and /Library stuff
usage example(s):
-
getDocumentsDirectory
-
return your documents directory.
Under osx, that's the user's 'Documents' folder.
The fallback for other OS's may return the user's home directory.
usage example(s):
OperatingSystem getDocumentsDirectory
|
-
getDriveList
-
return a list of volumes in the system.
-
getTrashDirectory
-
get the name of a trash folder (if the OS supports it),
or nil, if not.
Must be redefined to return non nil in concrete operating systems
-
pathNameForDrive: driveName
-
given a drive name, return the pathname to open it as a directory.
For Windows, this is the driveName itself.
For OSX, '/Volumes' is prepended.
Other OSs might prepent the pount point (i.e. /mnt/)
-
supportsVolumes
-
return true if the os support a list of drives/volumes
(here we can return a list of mounted drives in /Volumes)
initialization
-
initializeCodeset
-
quartz - screen
-
getFrameBufferImage: displayNr
-
returns the framebuffer as an image object
usage example(s):
self getFrameBufferImage:0
|
-
getFrameBufferImage: displayNr in: aRectangleOrNil
-
returns the frameBuffer (if rect-arg is nil)
or part of the framebuffer (if non-nil) as an image object
usage example(s):
self getFrameBufferImage:0 in:nil
self getFrameBufferImage:0 in:(100@100 corner:301@303)
Delay waitFor:3 seconds. self getFrameBufferImage:0 in:nil
|
-
getMousePosition
-
-
getScreenBounds: displayNr
-
returns the bounds of the screen.
This is needed, because the dimension of the XQuartz screen does not include the dock.
usage example(s):
sound & voice
-
bestVoiceForLanguage: language
-
choose a voice as per language
usage example(s):
self bestVoiceForLanguage:'de'
|
-
canPlaySound
-
-
canSpeak
-
-
playSound: soundFile
-
use 'say ...'
-
voiceCommandSpec
-
triples are:
-
voiceInfo
-
return a list of available voices plus info:
for each available voice, a triple is returned, containing:
voiceName language_territory comment/description
usage example(s):
OperatingSystem voiceInfo
|
-
voiceMapping
-
return a mapping from common (OS-independent) voice names
to OS-specific names or IDs.
The speak:voiceName interface will recognize both.
For portable programs, always use the OS-independent name and
let every OS xlate to its internal name.
usage example(s):
OperatingSystem voiceMapping
|
time and date
-
getOSTimeWithNanos
-
This returns the OS time as a 2-element vector with milliseconds (as before)
plus nanoseconds.
The base of the returned value is not consistent across
different OS's - some return the number of nanoseconds since jan, 1st 1970;
others since 1900. The Time classes are prepared for this, and
convert as appropriate (by using my fromOSTime: conversion methods).
Don't use this method in application code since it is an internal (private)
interface. For compatibility use instances of Time, Date or Timestamp to work with.
|