Commit graph

31 commits

Author SHA1 Message Date
Mads Marquart 02f5d6aa87 Remove trailing whitespace 2022-07-15 16:13:27 +02:00
Ryan McGrath 609a822e3f Merge branch 'trunk' into airyx-appkit-uikit-features
Needs merging for custom image drawing example.

* trunk:
  Add custom image drawing example
2022-07-11 22:12:54 -07:00
Ryan McGrath f925205876
Provide a standard NSMenu generator, fix a bug in NSEvent key character releasing, and add an animation example. 2022-01-07 01:13:24 -08:00
Ryan McGrath b9bf30e6f1
Fix examples, fix webview to work with new ObjcAccess trait, rename Image icon method for toolbars 2022-01-06 23:25:36 -08:00
Ryan McGrath 01d12396ef
Add custom image drawing example
Useful for Issue #21.
2021-11-20 17:35:25 -08:00
Ryan McGrath 93424f74c0
Throw autolayout behind a feature flag.
- AutoLayout is now behind a feature flag (that is defaulted) to enable
  building and running on platforms that do _not_ support AutoLayout.

- Added a frame-based Layout example for platforms that don't have
  AutoLayout support.

- Fixed a bug in geometry.rs where x/y coordinates would get swapped on
  conversion to `CGRect`.

- Added a README to the examples directory to aid in first time users
  running examples.
2021-08-08 18:42:07 -07:00
Ryan McGrath c713194262
v0.3.
- Changes internal target_os flags to be feature flags; macOS is now
  appkit, and iOS/tvOS are now uikit. This enables platforms that are
  not Apple-specific platforms that use frameworks to be compiled for.

- Updates the examples to handle closing/quitting better.
2021-08-07 22:31:48 -07:00
David Lemarier c9d665963a
feat(webview): Add custom protocol (scheme) support
This is a basic implementation of the custom protocol, with built-in mimetype extraction from the content, backed by URI detection.

To make it clear, I added an example and can be run with:

```
cargo run --example webview_custom_protocol --features webview
```
2021-04-25 12:07:45 -04:00
Ryan McGrath f558f8e24d
iOS works again, lol.
- Corrects `feature` -> `target_os` checks.
- Updates the old iOS scene delegate pieces to use the new class
  structure.
- Bundles in an iOS demo app.
- Blocks off most things that should not even attempt to compile for
  iOS.
2021-04-15 17:13:59 -07:00
Ryan McGrath 8a9c45af61
Building out browser example.
- Includes test case to reproduce textfield dealloc bug.
2021-04-14 19:00:34 -07:00
Ryan McGrath 80ec654d8d
Adds a text_input example to act as a test.
- TextFieldDelegate methods needed to retain the string, otherwise it
  could crash under fast usage.
- Work on improving the browser example; WIP.
2021-04-12 18:17:36 -07:00
Ryan McGrath 420422187a
Fixes #6 and updates WebView to new layout system.
- Includes a (basic) `browser` example to make testing the feature
  easier.
2021-04-08 17:54:32 -07:00
Ryan McGrath 46ee9e2ea8
Add in .layer support for Views.
- Cleans up `View` implementation so there's less boilerplate all
  around.

- Adds in a `Layer` wrapper for `CALayer`s on widgets.
2021-03-26 16:25:57 -07:00
Ryan McGrath 85eaedca2a Merge branch 'trunk' of github.com:ryanmcgrath/cacao into trunk
* 'trunk' of github.com:ryanmcgrath/cacao:
  implemented applicationShouldTerminateAfterLastWindowClosed
2021-03-17 21:42:18 -07:00
Ryan McGrath 10c513edad
A rather large and not very clean update.
- Adds support for NSSplitViewController.
- Reworks NSMenu support to be cleaner with enum variants.
- Reworks the Foundation underpinnings to be a bit safer and more clear
  in how they're used and passed around.
- Changes to docs structure for push towards v0.1.
- Examples updated to account for changes.
2021-03-04 17:24:39 -08:00
jussiniinikoski 6b53b30565 implemented applicationShouldTerminateAfterLastWindowClosed 2021-03-01 13:32:14 +02:00
Ryan McGrath 5cd59b5636
Begin reworking many internals to push for v0.1.
- Beginning to transition View types to use Rc/RefCell internally,
  which should provide better guarantees about ownership on the Rust side.
  This is also important for certain Objective-C side scenarios where we
  may need to set an ivar after creation, which requires some level of
  mutability. This may also possibly help bring down the unsafe usage,
  which would be cool.

- Rewrote the Color module; this now handles system colors better, and
  provides support for dynamic color creation. Supporting combinations
  of dark/light/contrast is now possible with handler passed in via
  `Color::dynamic`. This still has work to do in terms of some accessor
  methods and such, but it works well for now. The `to_platform...`
  method should be removed before v0.1.

- Added a new feature for enabling fallback color usage on older macOS
  versions that don't support system colors. This may honestly never be
  used, but it cost nothing to implement.

- Fixed a bug in the Autolayout wrapper where dereferencing could cause
  constraints to crash at runtime.

- Support setting text color on labels.

- Support setting text color on buttons, albeit very hacky right now.
  This needs to be extracted and/or cleaned up, but getting it sketched
  out was important for this commit.

- Support setting a key equivalent on buttons.

- Creating a local event monitor is now possible.

- Examples updated; Calculator clone example added.

The only API breaking change in this commit from earlier commits should
be `color::rgb` needing to be `color::Color` followed by a
`Color::rgb(...)` call.
2021-02-12 17:57:06 -08:00
Ryan McGrath 724b40e5a8
Add a (useful) example: a todo list.
- Adds a Todo list example.
- Updates ListView to support ending the row actions visible state.
- Support setting Label text color.
2021-02-07 23:37:25 -08:00
Ryan McGrath 3a77fd8a91
Fix existing examples 2021-02-07 20:51:40 -08:00
Ryan McGrath ab53150abc
Finalize some NSString handling that I'd been mulling over. This should be much more sound and transparent regarding ownership while keeping the same general approach that's been working so far. 2020-03-31 20:59:08 -07:00
Ryan McGrath db4da24268
Fix BOOL return values from NSUserDefaults, improve documentation 2020-03-31 19:00:03 -07:00
Ryan McGrath f4ca9770e1
Fix NSData wrapper so storing and retrieving bytes in UserDefaults works as expected, with hopefully little to no cloning issues. Wrap the NSNumber logic into a proper type. More documentation/cleanup, still ongoing. 2020-03-31 15:22:00 -07:00
Ryan McGrath 3f9c9f992c
Almost done with a proper NSUserDefaults wrapper... 2020-03-30 20:23:54 -07:00
Ryan McGrath e4ddfb975a
Further work on wrapping NSUserDefaults 2020-03-30 01:35:11 -07:00
Ryan McGrath d69f59d284
Further work on splitting for macOS/iOS support 2020-03-29 22:33:51 -07:00
Ryan McGrath 27e534a612
Ongoing documentation work, reworked Toolbar. Moved away from Rc/RefCell approach and will require users to handle interior mutability themselves, because Cocoa makes it tricky to automate. Beginning to figure out the split where macOS/iOS code should live. 2020-03-29 20:49:36 -07:00
Ryan McGrath 0b362a59d1
appkit -> cacao, updated README 2020-03-28 18:45:24 -07:00
Ryan McGrath 6b8aad4a94
Fix up the repo so examples work as they should 2020-03-26 18:06:11 -07:00
Ryan McGrath d512b7bcf5
Bring back dependency on core-graphics because, well, I'm apparently a moron. Further sketching out of WindowDelegate. 2020-03-26 17:31:42 -07:00
Ryan McGrath fc53848ba2
Add in an autolayout example 2020-03-20 14:02:46 -07:00
Ryan McGrath f45c86743b
Moving to a model where ther are actual examples, since the handler logic is finally ironed out well. 2020-03-19 20:07:44 -07:00