Merge pull request #6762 from miniak/set-thumbnail-clip
Add BrowserWindow.prototype.setThumbnailToolTip
This commit is contained in:
commit
872fbe8ba0
5 changed files with 28 additions and 1 deletions
|
@ -667,6 +667,12 @@ bool Window::SetThumbnailClip(const gfx::Rect& region) {
|
||||||
return window->taskbar_host().SetThumbnailClip(
|
return window->taskbar_host().SetThumbnailClip(
|
||||||
window_->GetAcceleratedWidget(), region);
|
window_->GetAcceleratedWidget(), region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::SetThumbnailToolTip(const std::string& tooltip) {
|
||||||
|
auto window = static_cast<NativeWindowViews*>(window_.get());
|
||||||
|
return window->taskbar_host().SetThumbnailToolTip(
|
||||||
|
window_->GetAcceleratedWidget(), tooltip);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
|
@ -858,6 +864,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("unhookWindowMessage", &Window::UnhookWindowMessage)
|
.SetMethod("unhookWindowMessage", &Window::UnhookWindowMessage)
|
||||||
.SetMethod("unhookAllWindowMessages", &Window::UnhookAllWindowMessages)
|
.SetMethod("unhookAllWindowMessages", &Window::UnhookAllWindowMessages)
|
||||||
.SetMethod("setThumbnailClip", &Window::SetThumbnailClip)
|
.SetMethod("setThumbnailClip", &Window::SetThumbnailClip)
|
||||||
|
.SetMethod("setThumbnailToolTip", &Window::SetThumbnailToolTip)
|
||||||
#endif
|
#endif
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
.SetMethod("setIcon", &Window::SetIcon)
|
.SetMethod("setIcon", &Window::SetIcon)
|
||||||
|
|
|
@ -180,6 +180,7 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
void UnhookWindowMessage(UINT message);
|
void UnhookWindowMessage(UINT message);
|
||||||
void UnhookAllWindowMessages();
|
void UnhookAllWindowMessages();
|
||||||
bool SetThumbnailClip(const gfx::Rect& region);
|
bool SetThumbnailClip(const gfx::Rect& region);
|
||||||
|
bool SetThumbnailToolTip(const std::string& tooltip);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS)
|
#if defined(TOOLKIT_VIEWS)
|
||||||
|
|
|
@ -158,6 +158,15 @@ bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TaskbarHost::SetThumbnailToolTip(
|
||||||
|
HWND window, const std::string& tooltip) {
|
||||||
|
if (!InitializeTaskbar())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return SUCCEEDED(taskbar_->SetThumbnailTooltip(
|
||||||
|
window, base::UTF8ToUTF16(tooltip).c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
bool TaskbarHost::HandleThumbarButtonEvent(int button_id) {
|
bool TaskbarHost::HandleThumbarButtonEvent(int button_id) {
|
||||||
if (ContainsKey(callback_map_, button_id)) {
|
if (ContainsKey(callback_map_, button_id)) {
|
||||||
auto callback = callback_map_[button_id];
|
auto callback = callback_map_[button_id];
|
||||||
|
|
|
@ -42,7 +42,10 @@ class TaskbarHost {
|
||||||
HWND window, const gfx::Image& overlay, const std::string& text);
|
HWND window, const gfx::Image& overlay, const std::string& text);
|
||||||
|
|
||||||
// Set the region of the window to show as a thumbnail in taskbar.
|
// Set the region of the window to show as a thumbnail in taskbar.
|
||||||
bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region);
|
bool SetThumbnailClip(HWND window, const gfx::Rect& region);
|
||||||
|
|
||||||
|
// Set the tooltip for the thumbnail in taskbar.
|
||||||
|
bool SetThumbnailToolTip(HWND window, const std::string& tooltip);
|
||||||
|
|
||||||
// Called by the window that there is a button in thumbar clicked.
|
// Called by the window that there is a button in thumbar clicked.
|
||||||
bool HandleThumbarButtonEvent(int button_id);
|
bool HandleThumbarButtonEvent(int button_id);
|
||||||
|
|
|
@ -1041,6 +1041,13 @@ hovering over the window in the taskbar. You can reset the thumbnail to be
|
||||||
the entire window by specifying an empty region:
|
the entire window by specifying an empty region:
|
||||||
`{x: 0, y: 0, width: 0, height: 0}`.
|
`{x: 0, y: 0, width: 0, height: 0}`.
|
||||||
|
|
||||||
|
#### `win.setThumbnailToolTip(toolTip)` _Windows_
|
||||||
|
|
||||||
|
* `toolTip` String
|
||||||
|
|
||||||
|
Sets the toolTip that is displayed when hovering over the window thumbnail
|
||||||
|
in the taskbar.
|
||||||
|
|
||||||
#### `win.showDefinitionForSelection()` _macOS_
|
#### `win.showDefinitionForSelection()` _macOS_
|
||||||
|
|
||||||
Same as `webContents.showDefinitionForSelection()`.
|
Same as `webContents.showDefinitionForSelection()`.
|
||||||
|
|
Loading…
Add table
Reference in a new issue