Polish thumbar code.

* Fix a memory leak in thumbar initialization.
* Check the number of thumbar buttons, should be <= 7.
* Correct to check thumbar button click event.
This commit is contained in:
Haojian Wu 2015-08-05 13:47:59 +08:00
parent dfd076a3e5
commit 78eac4116c
6 changed files with 64 additions and 38 deletions

View file

@ -648,29 +648,32 @@ __Note:__ This API is only available on Windows (Windows 7 and above)
* `buttons` Array of `button` objects
* `button` Object
* `icon` [NativeImage](native-image.md) - The icon showing in thumbnail toolbar.
* `tooltip` String - (Option) - The text of the button's tooltip.
* `flags` Array of Strings - (Option) Control specific states and behaviors
of the button. By default, it uses `enabled`.
* `enabled` - The button is active and available to the user.
* `disabled` - The button is disabled. It is present, but has a visual state
that indicates that it will not respond to user action.
* `dismissonclick` - When the button is clicked, the taskbar button's flyout
closes immediately.
* `nobackground` - Do not draw a button border, use only the image.
* `hidden` - The button is not shown to the user.
* `noninteractive` - The button is enabled but not interactive; no pressed
button state is drawn. This value is intended for instances where the button
is used in a notification.
* `click` - Function
* `icon` [NativeImage](native-image.md) - The icon showing in thumbnail
toolbar.
* `tooltip` String - (Option) - The text of the button's tooltip.
* `flags` Array of Strings - (Option) Control specific states and behaviors
of the button. By default, it uses `enabled`.
* `enabled` - The button is active and available to the user.
* `disabled` - The button is disabled. It is present, but has a visual
state that indicates that it will not respond to user action.
* `dismissonclick` - When the button is clicked, the taskbar button's
flyout closes immediately.
* `nobackground` - Do not draw a button border, use only the image.
* `hidden` - The button is not shown to the user.
* `noninteractive` - The button is enabled but not interactive; no
pressed button state is drawn. This value is intended for instances
where the button is used in a notification.
* `click` - Function
Add a thumbnail toolbar with a specified set of buttons to the thumbnail image of
a window in a taskbar button layout.
Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
of a window in a taskbar button layout. Returns a `Boolean` object indicates
whether the thumbnail has been added successfully.
__Note:__ This API is only available on Windows (Windows 7 and above).
Once you setup the thumbnail toolbar, the toolbar cannot be removed due to the
platform's limitation. But you can call the API with an empty array to clean the
buttons.
The number of buttons in thumbnail toolbar should be no greater than 7 due to
the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
removed due to the platform's limitation. But you can call the API with an empty
array to clean the buttons.
### BrowserWindow.showDefinitionForSelection()