Commit graph

46 commits

Author SHA1 Message Date
Kevin Sawicki
e797eb5ca3 Use set context menu when param is not specified 2016-06-29 11:52:58 -07:00
Cheng Zhao
db98e256f2 mac: Add tray.getBounds() API 2016-06-21 15:40:30 +09:00
Leonard Lamprecht
67dd19ed0f Replace OS X and Mac OS with macOS 2016-06-18 15:26:26 +02:00
Cheng Zhao
548febfa4c Fix style issues 2016-04-07 15:23:16 +09:00
Ben Gotow
e0ee60f290 Fix memory leak 2016-04-07 15:21:07 +09:00
Ben Gotow
91457fe739 Support images larger than self.bounds 2016-04-07 15:21:07 +09:00
Ben Gotow
f9644463a9 Fix broken template image support in Tray icon
Between Electron `0.30.x` and `0.37.x`, the tray icon stopped automatically inverting template images when highlighted. NSImageView normally uses the correct color for template images magicaly, but I think the addition of event handlers in the container view prevents the image view from determining highlight state.

This PR switches to drawing the image manually. The `drawRect` function decides whether to use `image` or `alternateImage`(pressed image) and then if that image is marked as a template, it fills it with the same color used for the text before drawing it.
2016-04-07 15:21:07 +09:00
leethomas
59eda67ba4 🍎🐛 make displaying alternate tray image depend on mouse down event instead of highlight state 2016-01-05 09:49:27 -08:00
Nishanth Shanmugham
2bbf86c524 tray: Support file-drop from OS X Dock
A long-standing Apple bug does not call `prepareForDragOperation:sender`
for file drag-and-drop operations from the Dock. So we manually
call our custom `handleDrop:sender` for all drag-and-drop cases (that
is, from the Dock and from Finder).

References to the bug in question:
- http://stackoverflow.com/q/9534543/3309046
- http://openradar.appspot.com/radar?id=1745403

However, we still need to return YES from `prepareForDragOperation:sender`,
otherwise the "drag failed" animation occurs. For the same reason, we also
return YES from `performDragOperation:sender`.
2015-12-29 03:27:59 -06:00
Cheng Zhao
3cdd0f35c7 mac: Implement menu parameter 2015-12-02 19:05:22 +08:00
Cheng Zhao
2fba05b5e7 Add menu parameter for Tray.popUpContextMenu 2015-12-02 18:43:11 +08:00
Cheng Zhao
87546bd4f8 Merge pull request #3479 from bengotow/tray-resizing
Fix sizing of Mac OS X tray icon after image change
2015-11-18 18:49:15 +08:00
Ben Gotow
9c69416e32 Fix sizing of Mac OS X tray icon after image change
- Consolidate logic that applies view dimensions into a function
- Use `NSVariableStatusItemLength` instead of trying to sync status item width
- Use modern Obj-C syntax `@[], @{}` in a few places
- Recompute view bounds after updating image in `setImage:`
2015-11-17 13:43:55 -08:00
Nishanth Shanmugham
d1e8e71e3f Tray: Add drag-end and drop events 2015-11-10 10:02:50 -06:00
Nishanth Shanmugham
818892d474 Tray: Add drag-entered and drag-exited events 2015-11-05 18:46:49 -06:00
Brandon Cash
60b14d03e9 Fix: tray NotfiyDropFiles typo 2015-10-18 00:32:13 -05:00
Haojian Wu
2b051e3884 mac: make tray's behavior more official when getting clicked quickly
multiple times.
2015-08-26 16:28:22 +08:00
Cheng Zhao
33eadad139 popContextMenu => popUpContextMenu 2015-08-10 13:00:15 +08:00
Cheng Zhao
58dee04d5c mac: Redraw icon when menu is closed 2015-08-10 12:52:35 +08:00
Cheng Zhao
a3f3a35fd1 mac: Don't emit "clicked" event if there is menu attached 2015-08-10 12:18:00 +08:00
Cheng Zhao
be24d3e78c mac: Make the tray icon behave more like the official one 2015-07-30 13:58:53 +08:00
Haojian Wu
45f5a10d5d Use NSImageView to draw tray icon.
* Fixes Tempate image doesn't show correctly in dark mode.
* Fixes the tray icon is stretched showing in menubar.
* Fixes title color will not reversed in dark mode.
2015-07-29 13:45:01 +08:00
Cheng Zhao
edde653d60 Merge branch 'feature/modifiers-click-tray' of https://github.com/nishanths/electron into nishanths-feature/modifiers-click-tray 2015-07-29 12:19:17 +08:00
Nishanth Shanmugham
74b4522195 Add keyboard modifiers payload to tray click events
* Add keyboard and mouse button bitsum to Tray click events payload
* Move getBoundsFromRect: to common event_util file
* Update documentation
2015-07-27 03:15:51 -07:00
Nishanth Shanmugham
f53995d555 Send bounding Rect on tray double click events 2015-07-25 20:56:35 -07:00
Haojian Wu
d342c9a6df Implement 'drop-files' tray event on OS X. 2015-07-20 20:06:15 +08:00
Haojian Wu
2cd6ad1a97 More code style fixing. 2015-07-16 18:42:20 +08:00
Haojian Wu
736fe0c1db Fix OS X build error. 2015-07-16 11:43:42 +08:00
Haojian Wu
4421fbf9f3 Implement 'tray.popContextMenu' API on OS X. 2015-07-16 10:50:53 +08:00
Haojian Wu
002eb1a326 Simplify code logic and fix object-c code style. 2015-07-16 10:49:55 +08:00
Haojian Wu
cca4f4abd5 Implement 'right-clicked' tray event on OS X. 2015-07-15 19:32:00 +08:00
Haojian Wu
e54fda6b34 Introduce Electron custom statusItem view.
Reimplement tray functions on OS X by using custom statusItem view.
2015-07-15 18:26:39 +08:00
Cheng Zhao
ce042d0524 mac: Don't use [NSScreen mainScreen] 2015-05-10 16:51:18 +08:00
Cheng Zhao
f5cf3556b1 Pass bounds in clicked event of tray 2015-05-04 11:43:22 +08:00
deepak1556
6d7d068e49 tray: send tray icon position as payload onclick OSX 2015-05-01 19:30:01 +05:30
Cheng Zhao
443a4b8f2f mac: Use AsNSImage instead of ToNSImage
It can get rid of the empty check.
2015-02-12 12:29:49 +08:00
Cheng Zhao
ab83b21fa6 Use gfx::Image instead of gfx::ImageSkia in API
The gfx::Image can use NSImage directly as underlying format, so we
don't have to decode images ourselves on Mac, and we will also be able
to make use of template images.
2015-01-02 18:43:56 -08:00
Kevin Sawicki
b6b6fc3bfd Remove All Rights Reserved after GitHub copyright
Closes #762
2014-10-31 11:17:05 -07:00
Cheng Zhao
67cbecaba0 mac: Add "double-clicked" event for Tray. 2014-09-09 19:45:21 +08:00
Cheng Zhao
ec1db0c7bb mac: Add Tray.setHighlightMode API, fixes #425. 2014-09-09 19:39:39 +08:00
Cheng Zhao
4330d67e0d mac: Add Tray.setTitle API, fixes #560. 2014-09-09 19:36:15 +08:00
Cheng Zhao
6cac69238c mac: Convert from ImageSkia to NSImage to reserve DPI info. 2014-06-23 12:59:10 +08:00
Cheng Zhao
da31588e0d mac: Implement the "click" event of TrayIcon. 2014-06-02 11:28:23 +08:00
Cheng Zhao
6c7fe80ec5 Bind TrayIcon to JS. 2014-05-30 23:57:54 +08:00
Cheng Zhao
6f5184f001 mac: Simple implementation of tray icon. 2014-05-30 14:37:53 +08:00
Cheng Zhao
80fb79daac Add dummy implementations for TrayIcon. 2014-05-30 10:31:27 +08:00