Commit graph

174 commits

Author SHA1 Message Date
Ryan McGrath c3922633b9
Merge branch 'trunk' of github.com:ryanmcgrath/cacao into trunk
* 'trunk' of github.com:ryanmcgrath/cacao:
  Standard macOS event handlers for TextField
2021-03-17 21:45:21 -07:00
Ryan McGrath ce1bca84ce
Merge pull request #5 from MerlinDE/TextField_event_handler
Standard macOS event handlers for TextField
2021-03-17 21:43:46 -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 9446092169
Clean up AutoLayout wrapper.
- Anchors are now enums, which help in debugging constraint issues.

- Enum types that are acceptable for constraint generation are now
  matched at runtime, and provide better error messages if a constraint
  can't be satisfied and crashes the app.

- `left` and `right` anchors are now supported on all widgets, fixing an
  oversight from early iterations of the framework.

- Reduces `unsafe` usage by a decent amount when setting constraint
  pointers for widget types.
2021-03-16 18:21:31 -07:00
Ryan McGrath 696907aa73
Ongoing documentation and cleanup work. 2021-03-15 17:09:50 -07:00
Alexander Czernay a85f41be79 Standard macOS event handlers for TextField
added text_should_begin_editing(), text_did_begin_editing(), text_did_change(), text_should_end_editing() and text_did_end_editing() event handlers

for now these only take the value from the TextField and hand it over as a String
2021-03-14 17:41:36 +01:00
Ryan McGrath bc54b49475
Ongoing push to a v0.1.
- Basic support for `AttributedString` type.
- `Debug` implementations across the board to ease debugging issues.
- Methods that take `Color` and `Font` types now accept an `AsRef` to
  make implementing less of a headache.
- Cleanup of the `utils` module.
2021-03-05 14:11:17 -08: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
Ryan McGrath 400e763160
Merge pull request #3 from jussiniinikoski/trunk
implement applicationShouldTerminateAfterLastWindowClosed
2021-03-01 09:51:55 -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 9511a5a82c BOOL handling differs on M1 vs x64.
The M1 ruined me. Fixes building and running on Intel-based Macs.
2021-02-08 11:54:35 -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 c507d2e3b2
Docs bump; fixes #2 2021-02-07 20:36:47 -08:00
Ryan McGrath 4d82c4d8b3
Big Sur OS check... 2021-02-07 20:34:40 -08:00
Ryan McGrath a167be8383
More features and cleanup.
- Reconfigured subclass creation, as there was a
  subtle-but-big-when-it-hit bug in the prior method where bridge
  callbacks would lose context of the appropriate delegate when calling
  the trait method. The new approach found in `src/foundation/class.rs`
  maps and caches subclass creation, and subclasses are now more
  apparent when debugging from the Objective-C side as we can carry
  their intended name/usage through. Not applied to all yet, but
  eventually.

- Cleaned up a number of linter warnings that had grown over time.

- Delegate traits now require an associated const `NAME`, which is used
  for subclass creation.

- (macOS) Toolbars now supported setting selected items, which is
  typically used in preferences screens.

- (macOS) Windows now support setting the toolbar display style. On Big
  Sur, this works as intended - it's a noop on older OS's that don't
  support it.

- Support for system icons for macOS preferences windows.

Still a bit to go to flesh this all out, but it's getting there - at
which point then iOS supoort can be folded in easier.
2021-02-07 20:25:56 -08:00
Ryan McGrath 22f96bb238
More general updates.
- Filesystem Save/Open panels can return PathBuf's instead of Url's,
  which feels more native to Rust.
- Support for drawing into an Image context with Core Graphics.
- ListView swipe-to-reveal action support.
- Experimental ListView cell reuse support.
- Updates to QuickLook to also support PathBuf's.
2021-02-04 13:34:12 -08:00
Ryan McGrath 62cebab691
Some more updates for macOS.
- Added support for basic Cursor management.
- Added support for NSWindow cancelOperation: callbacks. It's not...
  perfect, but it works as a discrete hook.
- Added support for NSProgressIndicator.
- Properly forward Error types from QuickLook generation calls, and
  future-proof the ThumbnailQuality enum.
- Add support for configuring Label line break mode.
2021-01-19 00:11:52 -08:00
Ryan McGrath 121a2f938e
Some updates. API still in flux, but you can build
- Added support for Image
- Added a QuickLook feature, to enable thumbnail generation.
- Added support for NSButton.
- Fixed a bug where App activation under Big Sur would leave menus
  without the ability to be used.
- Added the ability for Buttons and ToolbarItems to execute callbacks.
- Added support for Labels and TextFields.
- Added support for MenuItems to have callbacks as well.
- Preliminary ListView support; you have to cache your ListViewRow items
  yourself for the time being, but it works.
- Animation support for ListView operations.
- Support for ScrollViews.
- Helpers for dispatching actions to the main thread (for UI work).
- Updated the Dispatcher trait to make thread handling simpler.
- Basic font support.
2021-01-16 17:11:04 -08:00
Ryan McGrath 784727748c
Missing files from last commit, whoops. Also begin the long arduous process of bringing in NSNotificationName. Just end me now. 2020-04-05 00:09:17 -07:00
Ryan McGrath ba59b06177
Ensure macOS still works, and make these things call super when need be 2020-04-04 21:12:17 -07:00
Ryan McGrath 4ff69c008a
Very rough experimental support for iOS13+ Scenes. Not ready for use or comment yet. 2020-04-04 19:50:58 -07:00
Ryan McGrath 0c604c2e84
Further work on iOS support, mulling over how to make this cleaner 2020-04-02 13:16:20 -07:00
Ryan McGrath 47ddf7f5a3
Experimental iOS support - delegate pattern working in simulator, need to figure out scenes next. 2020-04-01 01:04:34 -07: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 8c39ea6f94
Cleaning up 2020-03-31 17:38:47 -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 ccaf61f56f
Webview patches 2020-03-30 00:37:10 -07:00
Ryan McGrath ad54670ffd
Docs need cleanup again, but fixing the README so nobody is confused... much 2020-03-29 22:35:19 -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 4266c4c8dc
Ongoing cleaning efforts 2020-03-28 22:05:40 -07:00
Ryan McGrath 6891e83019
Blockquote that 2020-03-28 20:32:31 -07:00
Ryan McGrath 566c13ada8
A typo 2020-03-28 18:46:49 -07:00
Ryan McGrath 0b362a59d1
appkit -> cacao, updated README 2020-03-28 18:45:24 -07:00
Ryan McGrath 8d490b3e33
Further work on docs 2020-03-27 20:13:51 -07:00
Ryan McGrath b573fba459
Working on fixing up docs, general cleanup 2020-03-26 20:19:52 -07:00
Ryan McGrath ebec770581
Bringing Window to a usable point 2020-03-26 19:02:53 -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 b0232ca225
Window movement delegate callback support 2020-03-25 19:57:47 -07:00
Ryan McGrath 34b02b28b5
On dropping a View, which is the originating View, we check to see if there's a superview and remove it if so 2020-03-24 21:42:07 -07:00
Ryan McGrath d7c367e7e9
Experimenting with Drop logic - will extend to View/etc if it works fine with Window. I... think it will. 2020-03-23 21:16:13 -07:00
Ryan McGrath 8910a88a93
Fix up the WebView implementation so that Subatomic compiles on the latest appkit codebase. Undo an experimental NSString wrapper type that caused problems. Docs forthcoming. 2020-03-21 16:46:35 -07:00
Ryan McGrath e4f96b4ab5
Working on getting WKWebView working again - close 2020-03-20 18:37:00 -07:00
Ryan McGrath c1da7b1b37
Clean up warnings, finish moving View/ViewController to new paradigm, general cleanup - need to rewrite docs 2020-03-20 15:03:19 -07:00