From: Milan Burda Date: Sun, 7 Aug 2016 17:23:42 +0000 (+0200) Subject: Add BrowserWindow.prototype.setThumbnailToolTip X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6125c538eb989fdcef66fe61625466a28e63138;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add BrowserWindow.prototype.setThumbnailToolTip --- diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index fad4141..5410345 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -667,6 +667,12 @@ bool Window::SetThumbnailClip(const gfx::Rect& region) { return window->taskbar_host().SetThumbnailClip( window_->GetAcceleratedWidget(), region); } + +bool Window::SetThumbnailToolTip(const std::string& tooltip) { + auto window = static_cast(window_.get()); + return window->taskbar_host().SetThumbnailToolTip( + window_->GetAcceleratedWidget(), tooltip); +} #endif #if defined(TOOLKIT_VIEWS) @@ -858,6 +864,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("unhookWindowMessage", &Window::UnhookWindowMessage) .SetMethod("unhookAllWindowMessages", &Window::UnhookAllWindowMessages) .SetMethod("setThumbnailClip", &Window::SetThumbnailClip) + .SetMethod("setThumbnailToolTip", &Window::SetThumbnailToolTip) #endif #if defined(TOOLKIT_VIEWS) .SetMethod("setIcon", &Window::SetIcon) diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index e027cea..e9aeaac 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -180,6 +180,7 @@ class Window : public mate::TrackableObject, void UnhookWindowMessage(UINT message); void UnhookAllWindowMessages(); bool SetThumbnailClip(const gfx::Rect& region); + bool SetThumbnailToolTip(const std::string& tooltip); #endif #if defined(TOOLKIT_VIEWS) diff --git a/atom/browser/ui/win/taskbar_host.cc b/atom/browser/ui/win/taskbar_host.cc index 8fef5e0..adc41cf 100644 --- a/atom/browser/ui/win/taskbar_host.cc +++ b/atom/browser/ui/win/taskbar_host.cc @@ -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) { if (ContainsKey(callback_map_, button_id)) { auto callback = callback_map_[button_id]; diff --git a/atom/browser/ui/win/taskbar_host.h b/atom/browser/ui/win/taskbar_host.h index c10e05f..fb87ab4 100644 --- a/atom/browser/ui/win/taskbar_host.h +++ b/atom/browser/ui/win/taskbar_host.h @@ -42,7 +42,10 @@ class TaskbarHost { HWND window, const gfx::Image& overlay, const std::string& text); // 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. bool HandleThumbarButtonEvent(int button_id); diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 22ad3a8..a4d149b 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -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: `{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_ Same as `webContents.showDefinitionForSelection()`.