Commit Graph

357 Commits

Author SHA1 Message Date
Paul Rouget 73455d52ad More NSButton methods 2017-02-01 09:49:16 +01:00
Paul Rouget 128a1ab460 NSTextField support 2017-02-01 09:49:04 +01:00
bors-servo 3d7fc57a8b Auto merge of #151 - servo:version, r=jdm
Update version to account for semver changes.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/151)
<!-- Reviewable:end -->
2017-01-20 08:34:45 -08:00
Josh Matthews 9b7e83091b Update version to account for semver changes. 2017-01-20 10:04:50 -05:00
bors-servo 54e71f0086 Auto merge of #150 - servo:bump-cg, r=glennw
Update core-graphics to 0.5; update minor version.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/150)
<!-- Reviewable:end -->
2017-01-19 06:20:08 -08:00
Josh Matthews d0566aace0 Update core-graphics to 0.5; update minor version. 2017-01-19 09:16:35 -05:00
bors-servo df110542ce Auto merge of #148 - upsuper:legacy-gitignore, r=emilio
Remove legacy items from .gitignore

The items being removed were added in da80902 for temporary files generated by `make`. But the Makefile is later removed in #36, and thus these items are no longer needed.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/148)
<!-- Reviewable:end -->
2016-12-12 01:29:20 -08:00
Xidorn Quan 078eb35d34 Remove legacy items from .gitignore 2016-12-12 20:14:50 +11:00
bors-servo 5b23ee37aa Auto merge of #143 - frewsxcv:rustfmt, r=jdm
Run rustfmt on entire crate.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/143)
<!-- Reviewable:end -->
2016-11-26 13:01:08 -08:00
Corey Farwell 0e94af3c19 Merge pull request #146 from frewsxcv/bump
Bump version to 0.5.2.
2016-11-26 15:38:51 -05:00
Corey Farwell 9727b0de72 Bump version to 0.5.2. 2016-11-26 15:21:34 -05:00
bors-servo f6c7230fab Auto merge of #144 - frewsxcv:nscolor, r=nox
Init `NSColor` trait, add `clearColor` constructor.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/144)
<!-- Reviewable:end -->
2016-11-26 12:17:11 -08:00
Corey Farwell 5b9a27e4cb Init NSColor trait, add clearColor constructor. 2016-11-26 15:06:06 -05:00
Corey Farwell 59fa67d901 Run rustfmt on entire crate. 2016-11-26 14:45:27 -05:00
bors-servo d1775d8d49 Auto merge of #142 - servo:constraints, r=jdm
Add UIKit classes and methods to support layout constraints.

Written primarily for https://github.com/tomaka/winit/issues/80.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/142)
<!-- Reviewable:end -->
2016-11-23 05:41:10 -08:00
Corey Farwell 1c40b191f0 Bump version to 0.5.1. 2016-11-23 00:15:19 -05:00
Corey Farwell 7cb21cfb61 Add UIKit classes and methods to support layout constraints.
Written primarily for https://github.com/tomaka/winit/issues/80.
2016-11-23 00:10:51 -05:00
bors-servo a21ac5970c Auto merge of #137 - burtonageo:NSDictionary, r=pcwalton
Add NSDictionary + tests, define NSComparator and NSComparisonResult

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/137)
<!-- Reviewable:end -->
2016-10-23 15:24:57 -05:00
bors-servo 5f5eece89d Auto merge of #141 - nox:core-graphics, r=Ms2ger
Update core-graphics to 0.4

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/141)
<!-- Reviewable:end -->
2016-08-02 03:52:24 -05:00
Anthony Ramine ba799c0b20 Update core-graphics to 0.4 2016-08-02 09:46:07 +02:00
bors-servo bce77bf83b Auto merge of #139 - rafaelbarbosa:master, r=pcwalton
Implemented NSTabView and NSTabViewItem. Simple example included. Again :)

Hi,

A long time ago I created PR #62, sadly life got in the way and I was unable fix the issues with the PR.

I've updated the code to the current codebase.

Hope this is useful for someone.
Thanks!

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/139)
<!-- Reviewable:end -->
2016-07-26 18:12:44 -05:00
Rafael Barbosa edcf333e8a Updated the NSTabView and NSTabViewItem bindings to match the current codebase. Updated the tab_view example 2016-07-26 23:53:07 +01:00
Rafael Barbosa 3f0c4ce8e6 Merge remote-tracking branch 'upstream/master'
Conflicts:
	src/appkit.rs
2016-07-24 22:22:56 +01:00
bors-servo 520a755e39 Auto merge of #138 - burtonageo:NSImage, r=pcwalton
Add more NSImage methods, and add associated enums + string constants

Adds:
 - most remaining NSImage methods,
 - NSImage name and hint constants,
 - NSCompositingOperation, NSImageCacheMode, NSTIFFCompression, NSImageLoadStatus

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/138)
<!-- Reviewable:end -->
2016-07-11 14:07:18 -07:00
George Burton 0b4616d1c3 Add more NSImage methods, and add associated enums + string constants 2016-07-10 10:36:09 +01:00
George Burton 0b07a7962d Add NSDictionary + tests, define NSComparator and NSComparisonResult 2016-07-09 15:39:32 +01:00
bors-servo 3c7f5376f2 Auto merge of #136 - burtonageo:NSSound, r=pcwalton
Add NSSound

Add NSSound and NSSoundPboardType, excluding depreciated methods

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/136)
<!-- Reviewable:end -->
2016-07-07 13:23:28 -07:00
George Burton 575fd9ea92 Add NSSound 2016-07-07 20:54:55 +01:00
bors-servo 5481f56375 Auto merge of #135 - burtonageo:master, r=pcwalton
Add NSData and associated constants

Adds:

- NSData
- NSDataReadingOptions
- NSDataBase64EncodingOptions
- NSDataBase64DecodingOptions
- NSDataWritingOptions
- NSDataSearchOptions

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/135)
<!-- Reviewable:end -->
2016-07-06 12:18:48 -07:00
George Burton 3c86fc88bb Add NSData and associated constants 2016-07-03 22:13:58 +01:00
bors-servo c98663a2e0 Auto merge of #134 - burtonageo:master, r=jdm
Add NSPasteboard and associated APIs

Adds:

- NSPasteboard
- NSPasteboardItem
- NSPasteboardReading
- NSPasteboardWriting
- NSPasteboardReadingOptions
- NSPasteboardWritingOptions

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/134)
<!-- Reviewable:end -->
2016-07-03 09:13:35 -07:00
George Burton 6367782ef8 Add NSPasteboard, NSPasteboardItem, NSPasteboardReading, NSPasteboardWriting, NSPasteboardReadingOptions, NSPasteboardWriting options, and various other constants 2016-07-03 15:08:09 +01:00
bors-servo 45fa6dc471 Auto merge of #133 - mitchmindtree:data_type_constants, r=metajack
Add missing "Types for Standard Data" constants.

This adds bindings to cocoa's "Types for Standard Data". I believe these are necessary for registering an `NSDraggingDestination` as a receiver for certain kinds of data types.

Here are the cocoa references for:
- [Types for Standard Data (OS X v10.6 and later)](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/#//apple_ref/doc/constant_group/Types_for_Standard_Data_OS_X_v10.6_and_later_)
- [Types for Standard Data (OS X v10.5 and earlier)](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/#//apple_ref/doc/constant_group/Types_for_Standard_Data_OS_X_v10.5_and_earlier_)

Relevant to tomaka/glutin#496

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/133)
<!-- Reviewable:end -->
2016-06-24 10:20:58 -05:00
mitchmindtree a7b905f263 Add missing cocoa Data Type constants 2016-06-24 15:48:16 +10:00
Patrick Walton daac2c1cc1 0.4.4 2016-06-10 18:41:45 -07:00
bors-servo 78cebf2d68 Auto merge of #132 - pcwalton:runloop, r=metajack
Add bindings for `+[NSRunLoop currentRunLoop]` and `-[NSRunLoop performSelector:target:argument:order:modes:]`

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/132)
<!-- Reviewable:end -->
2016-06-10 20:34:46 -05:00
Patrick Walton 866cdb1ec8 Add bindings for +[NSRunLoop currentRunLoop] and
`-[NSRunLoop performSelector:target:argument:order:modes:]`
2016-06-10 18:34:41 -07:00
Patrick Walton 9c1ae89a9e 0.4.3 2016-06-08 10:30:12 -07:00
bors-servo 8bcff922a3 Auto merge of #131 - pcwalton:fix-nsanyeventmask, r=metajack
appkit: Lengthen `NSAnyEventMask` to (-1 as u64) rather than (-1 as u32), to fix the problem whereby windows don't reappear and don't appear on top on startup.

The window restoration feature in Mac OS X from Lion onward prevents
windows from appearing until restoration is complete and the app is
launched. Internally, the persistent UI restorer detects the app launch
by listening to the Carbon event `kAEOpenApplication`, which, as an
Apple event, has the event class `kEventClassAppleEvent`.

Like `-[NSApplication run]` does, Glutin uses the method
`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]` to
pump the application event loop. The event mask provided is an
`NSEventMask`; events that do not match this mask are filtered out. When
pumping the Carbon event loop, the Cocoa framework internally converts
this `NSEventMask` to a Carbon event mask. The logic to perform this
conversion proceeds in two steps:

1. If the provided `NSEventMask` is exactly equal to `NSAnyEventMask`,
then the rest of the logic is skipped and the resulting Carbon event
mask is a null mask--i.e. a mask that matches all events.

2. Otherwise, the framework constructs a blank Carbon mask--that is, a
mask that matches no events at all. The various bits of the
`NSEventMask` are examined, translated to their Carbon equivalents, and
added to the mask. Then that Carbon mask is returned.

In Glutin prior to this patch, our definition of `NSAnyEventMask` was a
mask that effectively matched all events but was not equal to the real
`NSAnyEventMask` that, for example, `-[NSApplication run]` supplies to
`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]`. This
means that our code causes the system to take path (2) above, whereas
standard Cocoa apps take path (1). Now it might seem that these paths
are equivalent, but in fact they are very different. This is because
*there are classes of Carbon events that do not correspond to Cocoa
events selectable via `NSEventMask`*. One of these Carbon-only event
types is Apple events.

This fact is what made Glutin apps prior to this patch go wrong. The
Carbon framework would deliver the `kAEOpenApplication` event to the
application, but it was always masked out and ignored because the
`NSEventMask` we supplied to `-[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]` did not translate to a
Carbon event mask that included Apple events. This, in turn, caused the
persistent UI restorer to never notice that the app finished launching.
Thus the flag that inhibited windows from appearing would never be
cleared, and all windows would end up invisible.

This patch fixes the issue by lengthening `NSAnyEventMask` to its true
64-bit value, allowing the expected Carbon event filter to be used
during app startup and enabling the app startup event to be handled
properly.

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/131)
<!-- Reviewable:end -->
2016-06-08 09:00:30 -05:00
Patrick Walton 44d3744515 appkit: Lengthen NSAnyEventMask to (-1 as u64) rather than (-1 as
u32), to fix the problem whereby windows don't reappear and don't appear
on top on startup.

The window restoration feature in Mac OS X from Lion onward prevents
windows from appearing until restoration is complete and the app is
launched. Internally, the persistent UI restorer detects the app launch
by listening to the Carbon event `kAEOpenApplication`, which, as an
Apple event, has the event class `kEventClassAppleEvent`.

Like `-[NSApplication run]` does, Glutin uses the method
`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]` to
pump the application event loop. The event mask provided is an
`NSEventMask`; events that do not match this mask are filtered out. When
pumping the Carbon event loop, the Cocoa framework internally converts
this `NSEventMask` to a Carbon event mask. The logic to perform this
conversion proceeds in two steps:

1. If the provided `NSEventMask` is exactly equal to `NSAnyEventMask`,
then the rest of the logic is skipped and the resulting Carbon event
mask is a null mask--i.e. a mask that matches all events.

2. Otherwise, the framework constructs a blank Carbon mask--that is, a
mask that matches no events at all. The various bits of the
`NSEventMask` are examined, translated to their Carbon equivalents, and
added to the mask. Then that Carbon mask is returned.

In Glutin prior to this patch, our definition of `NSAnyEventMask` was a
mask that effectively matched all events but was not equal to the real
`NSAnyEventMask` that, for example, `-[NSApplication run]` supplies to
`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]`. This
means that our code causes the system to take path (2) above, whereas
standard Cocoa apps take path (1). Now it might seem that these paths
are equivalent, but in fact they are very different. This is because
*there are classes of Carbon events that do not correspond to Cocoa
events selectable via `NSEventMask`*. One of these Carbon-only event
types is Apple events.

This fact is what made Glutin apps prior to this patch go wrong. The
Carbon framework would deliver the `kAEOpenApplication` event to the
application, but it was always masked out and ignored because the
`NSEventMask` we supplied to `-[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]` did not translate to a
Carbon event mask that included Apple events. This, in turn, caused the
persistent UI restorer to never notice that the app finished launching.
Thus the flag that inhibited windows from appearing would never be
cleared, and all windows would end up invisible.

This patch fixes the issue by lengthening `NSAnyEventMask` to its true
64-bit value, allowing the expected Carbon event filter to be used
during app startup and enabling the app startup event to be handled
properly.
2016-06-07 22:23:11 -07:00
bors-servo df3d4d1f4c Auto merge of #130 - edunham:readme, r=jdm
add README

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/130)
<!-- Reviewable:end -->
2016-06-07 05:19:06 -05:00
E. Dunham ccf5a63e8c add README 2016-06-06 23:01:19 -07:00
Patrick Walton 32de713f33 0.4.2 2016-06-02 15:29:24 -07:00
bors-servo a103706181 Auto merge of #129 - pcwalton:rect-additions, r=metajack
Add bindings to `NSInsetRect` and `NSRectToCGRect`, and make various geometry types copyable.

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/129)
<!-- Reviewable:end -->
2016-05-27 15:52:41 -05:00
Patrick Walton 37b5ce6113 Add bindings to NSInsetRect and NSRectToCGRect, and make various
geometry types copyable.
2016-05-27 13:25:32 -07:00
Patrick Walton 5fef233f64 0.4.1 2016-05-16 11:24:02 -07:00
bors-servo 24f7593061 Auto merge of #125 - pcwalton:menu-additions, r=larsbergstrom
Add bindings for a few more menu-related functions.

Bindings added include:

* `-[NSApplication mainMenu]`
* `-[NSApplication setWindowsMenu:]`
* `+[NSMenu alloc]`
* `-[NSMenu initWithTitle:]`
* `-[NSMenu itemAtIndex:]`

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/125)
<!-- Reviewable:end -->
2016-05-16 10:05:07 -07:00
bors-servo 06220ff121 Auto merge of #128 - servo:bump, r=Wafflespeanut
Bump to 0.4.0

Version 0.3.4 should be yanked because bitflags >= 0.6 is incompatible with Rust <1.8
and this breaks downstream crates.

Unfortunately, we can't depend on bitflags >=0.5, <0.8 because it doesn't compile with
bitflags 0.5-6 because of https://github.com/rust-lang-nursery/bitflags/issues/39.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/128)
<!-- Reviewable:end -->
2016-05-16 07:17:14 -07:00
Anthony Ramine 127f5ded12 Bump to 0.4.0
Version 0.3.4 should be yanked because bitflags >= 0.6 is incompatible with Rust <1.8
and this breaks downstream crates.

Unfortunately, we can't depend on bitflags >=0.5, <0.8 because it doesn't compile with
bitflags 0.5-6 because of https://github.com/rust-lang-nursery/bitflags/issues/39.
2016-05-16 16:14:34 +02:00
bors-servo e5c69dd609 Auto merge of #127 - servo:bump, r=nox
Bump to 0.3.4

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/127)
<!-- Reviewable:end -->
2016-05-15 03:34:43 -07:00