Merge pull request #2 from lawsonry/master
Add platform-specific examples and update readme
This commit is contained in:
59
README.md
59
README.md
@@ -11,6 +11,65 @@ Works well on:
|
||||
|
||||
There is also a stub implementation that returns errors on attempt to create a tray menu.
|
||||
|
||||
# Setup
|
||||
|
||||
Before you can compile `tray`, you'll need to add an environment definition before the line where you include `tray.h`.
|
||||
|
||||
**For Windows:**
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TRAY_WINAPI 1
|
||||
|
||||
#include "tray.h"
|
||||
...
|
||||
```
|
||||
|
||||
**For Linux:**
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TRAY_APPINDICATOR 1
|
||||
|
||||
#include "tray.h"
|
||||
...
|
||||
```
|
||||
|
||||
**For Mac:**
|
||||
**For Windows:**
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TRAY_APPKIT 1
|
||||
|
||||
#include "tray.h"
|
||||
...
|
||||
```
|
||||
|
||||
// For Linux:
|
||||
//#define TRAY_APPINDICATOR 1
|
||||
// For Mac:
|
||||
//#define TRAY_APPKIT 1
|
||||
|
||||
# Demo
|
||||
|
||||
The included example `.c` files can be compiled based on your environment.
|
||||
|
||||
For example, to compile and run the program on Windows:
|
||||
|
||||
```shell
|
||||
$> gcc example_windows.c [Enter]
|
||||
```
|
||||
|
||||
This will compile and build `a.out`. To run it:
|
||||
|
||||
```
|
||||
$> a [Enter]
|
||||
```
|
||||
|
||||
# Example
|
||||
|
||||
```c
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
#define TRAY_WINAPI 1
|
||||
#elif defined (__linux__) || defined (linux) || defined (__linux)
|
||||
#define TRAY_APPINDICATOR 1
|
||||
#elif defined (__APPLE__) || defined (__MACH__)
|
||||
#define TRAY_APPKIT 1
|
||||
#endif
|
||||
|
||||
#include "tray.h"
|
||||
|
||||
#if TRAY_APPINDICATOR
|
||||
|
||||
Reference in New Issue
Block a user