eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'OSXOperatingSystem':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: OSXOperatingSystem


Inheritance:

   Object
   |
   +--AbstractOperatingSystem
      |
      +--UnixOperatingSystem
         |
         +--OSXOperatingSystem

Package:
stx:libbasic
Category:
OS-Unix
Version:
rev: 1.45 date: 2018/05/20 08:10:21
user: cg
file: OSXOperatingSystem.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


a small number of OS-X specific redefinitions here.


Class protocol:

cocoa - events
o  finishLaunching
tell the system, that I have finished my startup phase.
OSX will stop bounding the launch icon then.
usage example(s):
     self finishLaunching

o  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.

o  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.

o  generateMouseMoveEventX: screenX y: screenY
synthesize and send a mosue move event to the screen
usage example(s):
     OperatingSystem generateMouseMoveEventX:150 y:5.
     Delay waitFor:(1 seconds).
     OperatingSystem generateMouseMoveEventX:1050 y:150.

o  getNSApp
self getNSApp

o  receiveNextEvent

dummy shell operations
o  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

o  openApplicationHelperCommand
Return a command line helper to open a default application for file or URL

o  openTerminalWithCommand: shellCommand inBackground: inBackground
open a new terminal, which executes a command
usage example(s):
     OSXOperatingSystem openTerminalWithCommand:'ls -l' inBackground:true

file queries
o  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

o  defaultPackagePath
redefined to add /Application and /Library stuff
usage example(s):
self defaultPackagePath

o  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

o  getDriveList
return a list of volumes in the system.

o  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

o  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/)

o  supportsVolumes
return true if the os support a list of drives/volumes
(here we can return a list of mounted drives in /Volumes)

initialization
o  initializeCodeset

quartz - screen
o  getFrameBufferImage: displayNr
returns the framebuffer as an image object
usage example(s):
     self getFrameBufferImage:0

o  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

o  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):
     self getScreenBounds:0

sound & voice
o  playSound: soundFile
use 'say ...'

o  voiceCommandSpec
triples are:

o  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

time and date
o  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.



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 19 Sep 2018 01:42:38 GMT