Class for managing the MacOSX desktop. More...
Public Types | |
enum | MouseButton |
Mouse buttons. | |
enum | Modifiers |
Key modifiers. | |
enum | KeyType |
Key event types. | |
Public Member Functions | |
int | system (const std::string &command) |
calls the C system() function. | |
int | system (const std::string &command, std::string &result) |
calls the C popen() function and returns the result. | |
void | activateApp (const std::string &appName) |
activates an application. | |
bool | getFrontAppPath (std::string &str) |
returns the path of the front-most application. | |
bool | getFrontAppName (std::string &str) |
returns the name of the front-most application. | |
bool | getFrontAppLocName (std::string &str) |
returns the localized name of the front-most application. | |
void | open (const std::string &path) |
opens a file or an URL. More... | |
void | openUrl (const std::string &url) |
opens an URL using the default web browser. More... | |
void | openFile (const std::string &path) |
opens a file. More... | |
void | openApp (const std::string &path) |
opens an application. More... | |
void | openApp (const std::string &path, const std::string &arg) |
opens an application with an argument. | |
void | hideApp (const std::string &path) |
hides an application. | |
void | tellApp (const std::string &path, const std::string &command, bool inBackground=true) |
sends an AppleScript command to an application. | |
void | tellApp (const std::string &path, const std::string &command, std::string &result) |
sends an AppleScript command to an application and return the result. | |
void | wakeScreen () |
reactivates the screen if it's off. | |
void | changeVolume (int value, bool displayNotification=false) |
increasees or decrease current volume depending on value sign (exple: -10 or +10). | |
void | setVolume (unsigned int value, bool displayNotification=false) |
sets the volume (value must be between 0 and 100). | |
void | muteVolume () |
aternately mute/unmutes the volume. | |
void | beep (int seconds) |
beeps the speaker. | |
void | say (const std::string &message) |
says this message. | |
void | playPause () |
aternately play/pause iTunes. | |
bool | playAlbum (const std::string &album, const std::string &artist) |
Plays one or several albums. More... | |
bool | playPlaylist (const std::string &playlist, const std::string &track="") |
Plays tracks in a playlist. More... | |
bool | getCurrentTrack (std::string &album, std::string &artist, std::string &track, bool isPlaying=true) |
returns what is currently played or selected in iTunes. More... | |
void | showHideDock () |
aternately show/hides the Dock. | |
void | sendKeyStroke (const std::string &keystroke) |
generates a keyStroke, possibly with modifiers. More... | |
Static Public Member Functions | |
static void | getMainScreenSize (size_t &width, size_t &height) |
returns the width and height of the main screen. | |
static void | hideMouse (bool state) |
hide/unhides the mouse cursor. More... | |
static void | getMouse (double &x, double &y) |
gets mouse location (in screen coordinates). | |
static void | pressMouse (double x, double y, unsigned int mouseButton) |
generates a mouse down (button is one of MacDesktop::MouseButton). | |
static void | releaseMouse (double x, double y, unsigned int mouseButton) |
generates a mouse up (button is one of MacDesktop::MouseButton. | |
static void | dragMouse (double x, double y, unsigned int mouseButton) |
drags the mouse to this location (button is one of MacDesktop::MouseButton). | |
static void | moveMouse (double x, double y) |
moves the mouse to this location. | |
static void | sendKeycode (uint32_t keycode, uint8_t modifiers=0, uint8_t keytype=KeyType) |
generates a keyCode, possibly with modifiers. More... | |
static void | sendLeftKey () |
generates a LEFT key down/key up. | |
static void | sendRightKey () |
generates a RIGHT key down/key up. | |
static void | sendUpKey () |
generates a UP key down/key up. | |
static void | sendDownKey () |
generates a DOWN key down/key up. | |
static void | sendTabKey () |
generates a TAB key down/key up. | |
static void | sendBacktabKey () |
generates a BACKTAB key down/key up. | |
static void | sendSpaceKey () |
generates a SPACE key down/key up. | |
static void | sendReturnKey () |
generates an RETURN key down/key up. | |
static void | sendDeleteKey () |
generates an DELETE key down/key up. | |
static void | sendEscapeKey () |
generates an ESCAPE key down/key up. | |
Class for managing the MacOSX desktop.
void ccuty::MacDesktop::open | ( | const std::string & | path) |
void ccuty::MacDesktop::openUrl | ( | const std::string & | url) |
void ccuty::MacDesktop::openFile | ( | const std::string & | path) |
opens a file.
path must be the pathname of the file. Apple and Unix scripts are opened in editor.
void ccuty::MacDesktop::openApp | ( | const std::string & | path) |
opens an application.
path can be the name or the pathname of the application. Apple and Unix scripts are executed as applications.
bool ccuty::MacDesktop::playAlbum | ( | const std::string & | album, |
const std::string & | artist | ||
) |
Plays one or several albums.
Either album or artist may be empty, resp. meaning: play any album from this artist or any album with this name
bool ccuty::MacDesktop::playPlaylist | ( | const std::string & | playlist, |
const std::string & | track = "" |
||
) |
Plays tracks in a playlist.
Plays all tracks if track is empty.
bool ccuty::MacDesktop::getCurrentTrack | ( | std::string & | album, |
std::string & | artist, | ||
std::string & | track, | ||
bool | isPlaying = true |
||
) |
returns what is currently played or selected in iTunes.
returns what is being played if isPlaying is true and what is currently seclected if isPlaying is false.
|
static |
hide/unhides the mouse cursor.
hides the mouse if the argument is true, unhide otherwise.
void ccuty::MacDesktop::sendKeyStroke | ( | const std::string & | keystroke) |
generates a keyStroke, possibly with modifiers.
keystroke must start by an AppleScript keystroke possibily followed by modifiers. modifiers is 0 or an ORred combination of MacDesktop::Alt, Control, Command, Shift. modifiers should be 0 if modifiers are already present in keystroke
keystroke examples:
|
static |
generates a keyCode, possibly with modifiers.
keycode is a virtual key code. modifiers is 0 or an ORred combination of MacDesktop::Alt, Control, Command, Shift. keytype should either be MacDesktop::KeyDown, KeyUp or KeyType (the default)