2186 Commits

Author SHA1 Message Date
Mads Marquart 560da05fef Add CoreGraphics FFI used by winit 2022-09-05 13:33:55 +02:00
bors-servo bb8852eff8 Auto merge of #516 - keiya01:fix/use-animate-set-frame, r=jdm
fix: add animate property to NSWindow:setFrame:

I added animate property to `NSWindow:setFrame:`.
If this behavior is intended, I'm sorry but please close this PR.
2022-08-16 21:43:32 -04:00
bors-servo 7185556f5c Auto merge of #519 - mantou132:docktile, r=jdm
Add `NSDockTile`

init https://developer.apple.com/documentation/appkit/nsdocktile

example:
```rs
let dock_tile: cocoa::base::id = msg_send![NSApp(), dockTile];
NSDockTile::set_shows_applicatin_badge(dock_tile, cocoa::base::YES);
NSDockTile::setBadgeLabel_(dock_tile, NSString::alloc(nil).init_str("9"));
```
2022-08-16 21:39:39 -04:00
Josh Matthews e64eab3eca Merge pull request #508 from maxichrome/master
Add NSWindowToolbarStyle bindings
2022-08-15 09:41:17 -02:30
wangxianqiao f10db81e85 Add NSDockTile 2022-06-29 22:18:43 +08:00
keiya01 0df00e0543 fix: add animate property to NSWindow:setFrame: 2022-06-28 08:57:37 +09:00
bors-servo 614d43aa54 Auto merge of #510 - pevers:fix-set-tooltip, r=jrmuizel
fix: setToolTip wrong method invocation

This fixes the `setToolTip` method on the `NSTabViewItem`. It should be `setToolTip`, not `setTooltip`.
2022-06-14 09:34:46 -04:00
bors-servo e51cf4186d Auto merge of #512 - Hupka:master, r=jrmuizel
Fixes #511: Add`NSPanel` trait to create NSPanels

Intention for PR described here: https://github.com/servo/core-foundation-rs/issues/511.

I didn't extend any of the examples to include `NSPanel` because I think that's not really worth it. Instead, here is an adapted version of the `hello_world.rs` example that prints out responses of the API for both, `NSWindow` and `NSPanel`.

  ```Rust
extern crate cocoa;

use cocoa::appkit::{
    NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps,
    NSApplicationActivationPolicyRegular, NSBackingStoreBuffered, NSMenu, NSMenuItem, NSPanel,
    NSRunningApplication, NSWindow, NSWindowStyleMask,
};
use cocoa::base::{nil, selector, NO};
use cocoa::foundation::{NSAutoreleasePool, NSPoint, NSProcessInfo, NSRect, NSSize, NSString};

fn main() {
    unsafe {
        let _pool = NSAutoreleasePool::new(nil);

        let app = NSApp();
        app.setActivationPolicy_(NSApplicationActivationPolicyRegular);

        // create Menu Bar
        let menubar = NSMenu::new(nil).autorelease();
        let app_menu_item = NSMenuItem::new(nil).autorelease();
        menubar.addItem_(app_menu_item);
        app.setMainMenu_(menubar);

        // create Application menu
        let app_menu = NSMenu::new(nil).autorelease();
        let quit_prefix = NSString::alloc(nil).init_str("Quit ");
        let quit_title =
            quit_prefix.stringByAppendingString_(NSProcessInfo::processInfo(nil).processName());
        let quit_action = selector("terminate:");
        let quit_key = NSString::alloc(nil).init_str("q");
        let quit_item = NSMenuItem::alloc(nil)
            .initWithTitle_action_keyEquivalent_(quit_title, quit_action, quit_key)
            .autorelease();
        app_menu.addItem_(quit_item);
        app_menu_item.setSubmenu_(app_menu);

        // create Window
        let window = NSWindow::alloc(nil)
            .initWithContentRect_styleMask_backing_defer_(
                NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)),
                NSWindowStyleMask::NSTitledWindowMask,
                NSBackingStoreBuffered,
                NO,
            )
            .autorelease();
        window.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));
        window.center();
        let title = NSString::alloc(nil).init_str("Hello World!");
        window.setTitle_(title);
        window.makeKeyAndOrderFront_(nil);

        // create Panel
        let panel = NSPanel::alloc(nil)
            .initWithContentRect_styleMask_backing_defer_(
                NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)),
                NSWindowStyleMask::NSTitledWindowMask,
                NSBackingStoreBuffered,
                NO,
            )
            .autorelease();
        panel.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));
        panel.center();
        let title = NSString::alloc(nil).init_str("Hello PANEL!");
        panel.setTitle_(title);
        panel.makeKeyAndOrderFront_(nil);

        // Specific behavior of NSWindow & NSPanel
        println!(
            "NSWindow can become main window: {}",
            window.canBecomeMainWindow()
        ); // returns true
        println!(
            "NSPanel can become main window? {}",
            panel.canBecomeMainWindow()
        ); // returns false

        // Test methods of NSPanel Trait
        println!(
            "BEFORE setting it: NSPanel is a floating panel: {}",
            panel.floatingPanel()
        ); // returns false
        println!(
            "BEFORE setting it: NSPanel becomes key only when needed: {}",
            panel.becomesKeyOnlyIfNeeded()
        ); // returns false

        panel.setFloatingPanel(true);
        panel.setBecomesKeyOnlyIfNeeded(true);

        println!(
            "AFTER: NSPanel is a floating panel: {}",
            panel.floatingPanel()
        ); // returns true
        println!(
            "AFTER: NSPanel becomes key only when needed: {}",
            panel.becomesKeyOnlyIfNeeded()
        ); // returns true

        let current_app = NSRunningApplication::currentApplication(nil);
        current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);
        app.run();
    }
}
```
2022-06-09 20:04:04 -04:00
Adrian Hupka 01169af4e2 Added setWorksWhenModal to NSPanel trait 2022-06-03 19:01:08 +02:00
Adrian Hupka dd1135e599 AddNSPanel trait to create NSPanels
Intention for PR described here: https://github.com/servo/core-foundation-rs/issues/511
2022-06-03 16:17:32 +02:00
Peter Evers 3ede1dd222 fix: typo in setToolTip 2022-05-29 17:31:12 +02:00
Alex Touchet 5143684bb5 Fix listed core-graphics homepage 2022-05-26 08:25:16 -04:00
maxichrome a4aac2645b attempt to add toolbar style 2022-05-23 00:32:06 -05:00
bors-servo 0796658825 Auto merge of #482 - rectang:contribution-guidelines, r=jdm
Add basic contfibution guidelines to README

In #453, @pmj proposed bare-bones contribution guidelines, which were received favorably by @jrmuizel. This pull request insert's @pmj's proposed text into the top-level README.
2022-03-27 18:37:32 -04:00
bors-servo 29af672896 Auto merge of #500 - ssssota:master, r=jdm
Add get name function to CTFont

## Overview

Now we can get family name, full name, postscript name and some names.
But I want to use other names. (e.g. Copyright notice, License etc...)
So, I made `get_string_by_name_key` methods from helper function.
2022-03-27 18:01:05 -04:00
bors-servo 9941118f82 Auto merge of #502 - madsmtm:remove-build-script, r=jrmuizel
Remove build script from `core-foundation-sys`

Should result in faster build times
2022-03-21 23:15:12 -04:00
Mads Marquart f855f23902 Remove build script from core-foundation-sys
Should result in faster build times
2022-03-22 01:14:16 +01:00
ssssota b0e0dd8bf4 Add get name function 2022-02-16 12:09:01 +09:00
bors-servo 18b5e607c0 Auto merge of #498 - n-eq:patch-1, r=jrmuizel
Update Cargo.toml: cocoa-foundation - publish a new version (0.1.1)

Following this change https://github.com/servo/core-foundation-rs/commit/6e78ddfb8a18b2e0f88c330e1a08c7c1f8c6a71e
2022-02-08 11:51:05 -05:00
Nabil Elqatib 8d3c2cd870 Update Cargo.toml
Following this change https://github.com/servo/core-foundation-rs/commit/6e78ddfb8a18b2e0f88c330e1a08c7c1f8c6a71e
2022-02-07 21:47:39 +01:00
bors-servo 6642b11b4c Auto merge of #481 - n-eq:master, r=jrmuizel
Bump core-foundation crate version

Following https://github.com/servo/core-foundation-rs/pull/477
2022-02-07 09:42:34 -05:00
bors-servo f8f8a5867a Auto merge of #493 - joshchngs:nswindow-document-edited, r=jdm
Add binding for NSWindow::isDocumentEdited()

Getter for the existing setDocumentEdited() binding.
I've tested both via an in-progress change to tauri-apps/tao
2022-01-17 14:55:22 -05:00
Josh Channings 29a7e2d265 Add binding for NSWindow::isDocumentEdited()
Getter for the existing setDocumentEdited() binding.
I've tested both via an in-progress change to tauri-apps/tao
2022-01-17 19:20:24 +00:00
bors-servo f58166d728 Auto merge of #491 - ldm0:more_array, r=jdm
Add more functions to CFArray

None
2021-12-26 13:44:48 -05:00
Liu Dingming 09763eb8bd Add more functions to CFArray 2021-12-27 01:57:52 +08:00
bors-servo 669cb0c0f6 Auto merge of #489 - youngsing:master, r=jdm
Update NSAppKitVersionNumber

Version Number get from macOS 12.1 and Xcode 13.2

![Screen Shot 2021-12-23 at 15 51 50](https://user-images.githubusercontent.com/2562374/147207082-775b259c-6cba-4518-a7b3-627e212469ba.png)
2021-12-23 10:20:11 -05:00
youngsing 9b7c820c33 Update NSAppKitVersionNumber 2021-12-23 15:50:19 +08:00
bors-servo 6be86aa99f Auto merge of #488 - jrmuizel:ui-font, r=mstange
Expose bindings to CTFontCreateUIFontForLanguage

None
2021-12-13 15:23:31 -05:00
Jeff Muizelaar aee417874f Expose bindings to CTFontCreateUIFontForLanguage 2021-12-13 12:42:52 -05:00
bors-servo 3c92593b70 Auto merge of #487 - jrmuizel:mac12, r=mstange
Add some more tests around system fonts and variations

None
2021-12-08 20:39:03 -05:00
Jeff Muizelaar 5dff9e13fd Add some more tests around system fonts and variations 2021-12-08 20:23:44 -05:00
bors-servo cc53ab53c0 Auto merge of #486 - jrmuizel:oor-var-mac12, r=mstange
core-text: out_of_range_variations: Add support for macOS 12

None
2021-12-08 19:04:00 -05:00
Jeff Muizelaar 77ffcfe731 core-text: out_of_range_variations: Add support for macOS 12 2021-12-08 19:02:22 -05:00
bors-servo 57d00a34cf Auto merge of #485 - jrmuizel:variation-capping, r=mstange
core-text: Add a test for out of range variations.

None
2021-12-08 16:58:48 -05:00
Jeff Muizelaar 3d6c103a14 core-text: Add a test for out of range variations. 2021-12-08 14:53:53 -05:00
Marvin Humphrey 7efb780ef0 Add basic contfibution guidelines to README 2021-11-28 18:28:31 -08:00
Nabil Elqatib 9856555517 Bump core-foundation crate version 2021-11-23 10:13:56 +01:00
Nabil Elqatib cbf991ec33 Merge remote-tracking branch 'upstream/master' 2021-11-23 10:13:26 +01:00
bors-servo c6d7268854 Auto merge of #480 - jrmuizel:system-font, r=mstange
Test that we can create a new CTFont from the descriptor attributes.

None
2021-11-22 19:36:52 -05:00
bors-servo 92bae14037 Auto merge of #477 - n-eq:processinfo-uptime, r=jrmuizel
Add ProcessInfo.systemUptime implementation

Hello,

Added [NSProcessInfo.systemUptime](https://developer.apple.com/documentation/foundation/processinfo/1414553-systemuptime) implementation, successfully tested on iOS.
Feel free to merge.

Best,
2021-11-22 19:25:35 -05:00
Jeff Muizelaar 1ad12536ec Test that we can create a new CTFont from the descriptor attributes. 2021-11-22 19:22:41 -05:00
bors-servo 8c72b7d50a Auto merge of #474 - jrmuizel:cfs-version, r=jdm
Bump the required version of core-foundation-sys

None
2021-11-21 15:17:39 -05:00
Nabil Elqatib 6e78ddfb8a Update cocoa-foundation/src/foundation.rs 2021-11-18 14:52:36 +01:00
Nabil Elqatib e07fe2713e Update cocoa-foundation/src/foundation.rs 2021-11-18 14:06:09 +01:00
Nabil Elqatib bcea771dae Update cocoa-foundation/src/foundation.rs
Fix method name
2021-11-18 14:04:47 +01:00
Nabil Elqatib 46a3b04936 Update cocoa-foundation/src/foundation.rs
Delete default implementation
2021-11-18 14:02:10 +01:00
Nabil Elqatib 54d1b935fe Merge pull request #1 from n-eq/processinfo-uptime 2021-11-16 11:29:51 +01:00
Nabil Elqatib e8fb7ada2d Add ProcessInfo.systemUptime implemention 2021-11-16 11:25:43 +01:00
bors-servo 2ae6b790de Auto merge of #455 - xiaopengli89:fix-window-number-at-point, r=jrmuizel
fix: windowNumberAtPoint_belowWindowWithWindowNumber_

[windowNumber(at:belowWindowWithWindowNumber:)](https://developer.apple.com/documentation/appkit/nswindow/1419210-windownumber) is a type method.
2021-11-02 16:22:45 -04:00
Jeff Muizelaar 3d5df0a167 Bump the required version of core-foundation-sys 2021-11-02 16:21:20 -04:00