Allow custom window level when sending window to top

This commit is contained in:
adammeyer 2016-09-21 13:35:59 -04:00
parent 805ce0dee9
commit fbb3a288ec
7 changed files with 15 additions and 10 deletions

View file

@ -486,8 +486,10 @@ bool Window::IsClosable() {
return window_->IsClosable();
}
void Window::SetAlwaysOnTop(bool top) {
window_->SetAlwaysOnTop(top);
void Window::SetAlwaysOnTop(bool top, mate::Arguments* args) {
int level = 0;
args->GetNext(&level);
window_->SetAlwaysOnTop(top, level);
}
bool Window::IsAlwaysOnTop() {

View file

@ -132,7 +132,7 @@ class Window : public mate::TrackableObject<Window>,
bool IsFullScreenable();
void SetClosable(bool closable);
bool IsClosable();
void SetAlwaysOnTop(bool top);
void SetAlwaysOnTop(bool top, mate::Arguments* args);
bool IsAlwaysOnTop();
void Center();
void SetPosition(int x, int y, mate::Arguments* args);

View file

@ -118,7 +118,7 @@ class NativeWindow : public base::SupportsUserData,
virtual bool IsFullScreenable() = 0;
virtual void SetClosable(bool closable) = 0;
virtual bool IsClosable() = 0;
virtual void SetAlwaysOnTop(bool top) = 0;
virtual void SetAlwaysOnTop(bool top, int level = 0) = 0;
virtual bool IsAlwaysOnTop() = 0;
virtual void Center() = 0;
virtual void SetTitle(const std::string& title) = 0;

View file

@ -64,7 +64,7 @@ class NativeWindowMac : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top) override;
void SetAlwaysOnTop(bool top, int level) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;

View file

@ -943,8 +943,11 @@ bool NativeWindowMac::IsClosable() {
return [window_ styleMask] & NSClosableWindowMask;
}
void NativeWindowMac::SetAlwaysOnTop(bool top) {
[window_ setLevel:(top ? NSFloatingWindowLevel : NSNormalWindowLevel)];
void NativeWindowMac::SetAlwaysOnTop(bool top, int level) {
if (!level) {
level = NSFloatingWindowLevel;
}
[window_ setLevel:(top ? level : NSNormalWindowLevel)];
}
bool NativeWindowMac::IsAlwaysOnTop() {

View file

@ -682,8 +682,8 @@ bool NativeWindowViews::IsClosable() {
#endif
}
void NativeWindowViews::SetAlwaysOnTop(bool top) {
window_->SetAlwaysOnTop(top);
void NativeWindowViews::SetAlwaysOnTop(bool top, int level) {
window_->SetAlwaysOnTop(top, level);
}
bool NativeWindowViews::IsAlwaysOnTop() {

View file

@ -84,7 +84,7 @@ class NativeWindowViews : public NativeWindow,
bool IsFullScreenable() override;
void SetClosable(bool closable) override;
bool IsClosable() override;
void SetAlwaysOnTop(bool top) override;
void SetAlwaysOnTop(bool top, int level) override;
bool IsAlwaysOnTop() override;
void Center() override;
void SetTitle(const std::string& title) override;