Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instructions to be more clear and note that it supports OSX #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Still in development, is shown to work fine, but needs more testing!
- [Installation](#installation)
* [Installation on Linux](#installation-on-linux)
* [Installation on Windows](#installation-on-windows)
* [Installation on OSX](#installation-on-osx)
- [Examples](#examples)
* [With GenUI macro](#with-genui-macro)
* [Running work on background threads](#running-work-on-background-threads)
Expand All @@ -22,15 +23,15 @@ Still in development, is shown to work fine, but needs more testing!


# Installation
wxWidgets works across all major platforms but the build process is slightly different. Below follows instructions on how to build for Linux and Windows. If you use Mac OSX it would be great if you shared how to build on a Mac and it can be added here as well. Since a simple nim.cfg file doesn't quite cut it here we use the file wxCompile.nim to decide which flags to pass so you would have to modify that to make changes.
wxWidgets works across all major platforms but the build process is slightly different. Below follows instructions on how to build for Linux, Windows and OSX. Since a simple nim.cfg file doesn't quite cut it here we use the file wxCompile.nim to decide which flags to pass so you would have to modify that to make changes. You don't need to install this specific module, you can go to the [examples](#examples) directly to see how to use this module.

## Installation on Linux

Install ``wxnim`` and grab the ``wxGtk`` package from your package manager. Make sure ``wx-config`` is in your PATH and executable. If you want to compile wxWidgets 3.0.2 yourself (for example in order to use X11 or link it statically into your application) you can use the ``-d:"wxWidgetsPath:<path to the folder wx-config is in>"`` flag.
Download ``wxnim`` and grab the ``wxGtk`` package from your package manager. Make sure ``wx-config`` is in your PATH and executable. If you want to compile wxWidgets 3.0.2 yourself (for example in order to use X11 or link it statically into your application) you can use the ``-d:"wxWidgetsPath:<path to the folder wx-config is in>"`` flag.

## Installation on Windows

Install ``wxnim`` and point it to a compiled version of wxWidgets 3.0.2 with the ``-d:"wxWidgetsPath:<path to wxWidgets root folder>"`` flag or set up your compiler to know where these files are.
Download ``wxnim`` and point it to a compiled version of wxWidgets 3.0.2 with the ``-d:"wxWidgetsPath:<path to wxWidgets root folder>"`` flag or set up your compiler to know where these files are.

Compile wxWidgets
via ``mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release``.
Expand All @@ -39,6 +40,10 @@ More details can be found here:

https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW

## Installation on OSX

Make sure you have wxWindows installed. The easiest way to do so is through brew, with the command ``brew install wxmac``, if you have [homebrew](https://brew.sh) installed. The ``wx-config`` should be in your PATH. More details can be found at the [Linux installation](#installation-on-linux).

# Examples

## With GenUI macro
Expand All @@ -49,7 +54,7 @@ This module ships with a macro to easily create GUIs. To see it in use look at o

nim cpp -r controlgallery.nim

The output of the macro should look like these images from Linux and Windows respectively:
The output of the macro should look like these images from Linux, Windows and OSX respectively:

On Linux wxWidgets uses GTK+ as it's backend and looks will vary greatly depending on theme (this screenshot is taken with the Arc theme and M+ 2p font).

Expand All @@ -59,6 +64,11 @@ On Windows wxWidgets uses Win32 Forms, so looks might change depending on Window

![Windows](/screenshots/windows.png)

On OSX it supports both, Light and Dark theme, if wxmac version is >=3.1.2.

![OSX](/screenshots/osx.png)


## Running work on background threads

Since wxWidgets requires the main thread to perform UI actions you would want to perform long running tasks in threads. To see an example of how you can use threads with wxWidgets look at the ``threads`` example found in ``examples/genuimacro``.
Expand Down
Binary file added screenshots/osx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.