Skip to content

Introduce custom status item view on OS X.#2232

Merged
zcbenz merged 11 commits intomasterfrom
status_item_view
Jul 21, 2015
Merged

Introduce custom status item view on OS X.#2232
zcbenz merged 11 commits intomasterfrom
status_item_view

Conversation

@hokein
Copy link
Copy Markdown
Contributor

@hokein hokein commented Jul 15, 2015

This PR introduces a custom status item view in NSStatusItem, so that we can easily implement some features in tray:

  • Implement right-clicked event on OS X and Windows. As a side effect, the 'clicked' event will also be emitted even the tray has context menu.
  • Implement popContextMenu API on OS X and Windows.
  • Implement dragged-files event to support drag-and-drop feature on OS X.

Fixes #1499, #1393, #1975, #1549.

@hokein hokein force-pushed the status_item_view branch from 4ec092c to 4e565a6 Compare July 16, 2015 02:19
@hokein hokein force-pushed the status_item_view branch from 4e565a6 to 4421fbf Compare July 16, 2015 02:51
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static variables should be put int anonymous namespace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@zcbenz
Copy link
Copy Markdown
Contributor

zcbenz commented Jul 16, 2015

I haven't tested but I think we should redraw the status item after the setImage/setTitle calls?

@zcbenz
Copy link
Copy Markdown
Contributor

zcbenz commented Jul 16, 2015

And does the status item show correctly with dark menu bar?

@hokein
Copy link
Copy Markdown
Contributor Author

hokein commented Jul 16, 2015

I haven't tested but I think we should redraw the status item after the setImage/setTitle calls?

Oops. I have missed them. Done now.

And does the status item show correctly with dark menu bar?

Haven't test it yet due to my OS X version is 10.9.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop-files might be a better name to match DOM's drop event.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Also having test in dark menu bar, the status item shows correctly.

@hokein hokein force-pushed the status_item_view branch from de2a936 to 953dd53 Compare July 20, 2015 09:29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated by DOM's docs:

The drag event is fired when an element or text selection is being dragged (every few hundred milliseconds)
The drop event is fired when an element or text selection is dropped on a valid drop target.

drop should be better than drag in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Done.

@hokein hokein force-pushed the status_item_view branch from 953dd53 to d342c9a Compare July 20, 2015 12:06
@zcbenz
Copy link
Copy Markdown
Contributor

zcbenz commented Jul 21, 2015

👍

zcbenz added a commit that referenced this pull request Jul 21, 2015
Introduce custom status item view on OS X.
@zcbenz zcbenz merged commit dbab889 into master Jul 21, 2015
@zcbenz zcbenz deleted the status_item_view branch July 21, 2015 02:36
@jorangreef
Copy link
Copy Markdown

Thanks

@fourpixels
Copy link
Copy Markdown

Hey guys,
Can this be implemented for Windows too?

@kemuri
Copy link
Copy Markdown

kemuri commented Jan 10, 2016

Is it possible to drag&drop (URL) for example? As far as I see, right now only files are allowed :(

@black-snow
Copy link
Copy Markdown

Seems like it's not optional to pass a Menu to Tray.popUpContextMenu() (on windows at least).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants