Add BrowserWindow.isFocused() API.
This commit is contained in:
parent
eec8abf397
commit
5c3857790c
5 changed files with 14 additions and 0 deletions
|
@ -116,6 +116,12 @@ v8::Handle<v8::Value> Window::Focus(const v8::Arguments &args) {
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
v8::Handle<v8::Value> Window::IsFocused(const v8::Arguments &args) {
|
||||||
|
UNWRAP_WINDOW_AND_CHECK;
|
||||||
|
return v8::Boolean::New(self->window_->IsFocused());
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
v8::Handle<v8::Value> Window::Show(const v8::Arguments &args) {
|
v8::Handle<v8::Value> Window::Show(const v8::Arguments &args) {
|
||||||
UNWRAP_WINDOW_AND_CHECK;
|
UNWRAP_WINDOW_AND_CHECK;
|
||||||
|
@ -591,6 +597,7 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus);
|
NODE_SET_PROTOTYPE_METHOD(t, "focus", Focus);
|
||||||
|
NODE_SET_PROTOTYPE_METHOD(t, "isFocused", IsFocused);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "show", Show);
|
NODE_SET_PROTOTYPE_METHOD(t, "show", Show);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "hide", Hide);
|
NODE_SET_PROTOTYPE_METHOD(t, "hide", Hide);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "maximize", Maximize);
|
NODE_SET_PROTOTYPE_METHOD(t, "maximize", Maximize);
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Window : public EventEmitter,
|
||||||
// APIs for NativeWindow.
|
// APIs for NativeWindow.
|
||||||
static v8::Handle<v8::Value> Close(const v8::Arguments &args);
|
static v8::Handle<v8::Value> Close(const v8::Arguments &args);
|
||||||
static v8::Handle<v8::Value> Focus(const v8::Arguments &args);
|
static v8::Handle<v8::Value> Focus(const v8::Arguments &args);
|
||||||
|
static v8::Handle<v8::Value> IsFocused(const v8::Arguments &args);
|
||||||
static v8::Handle<v8::Value> Show(const v8::Arguments &args);
|
static v8::Handle<v8::Value> Show(const v8::Arguments &args);
|
||||||
static v8::Handle<v8::Value> Hide(const v8::Arguments &args);
|
static v8::Handle<v8::Value> Hide(const v8::Arguments &args);
|
||||||
static v8::Handle<v8::Value> Maximize(const v8::Arguments &args);
|
static v8::Handle<v8::Value> Maximize(const v8::Arguments &args);
|
||||||
|
|
|
@ -63,6 +63,7 @@ class NativeWindow : public content::WebContentsDelegate,
|
||||||
virtual void CloseImmediately() = 0;
|
virtual void CloseImmediately() = 0;
|
||||||
virtual void Move(const gfx::Rect& pos) = 0;
|
virtual void Move(const gfx::Rect& pos) = 0;
|
||||||
virtual void Focus(bool focus) = 0;
|
virtual void Focus(bool focus) = 0;
|
||||||
|
virtual bool IsFocused() = 0;
|
||||||
virtual void Show() = 0;
|
virtual void Show() = 0;
|
||||||
virtual void Hide() = 0;
|
virtual void Hide() = 0;
|
||||||
virtual void Maximize() = 0;
|
virtual void Maximize() = 0;
|
||||||
|
|
|
@ -23,6 +23,7 @@ class NativeWindowMac : public NativeWindow {
|
||||||
virtual void CloseImmediately() OVERRIDE;
|
virtual void CloseImmediately() OVERRIDE;
|
||||||
virtual void Move(const gfx::Rect& pos) OVERRIDE;
|
virtual void Move(const gfx::Rect& pos) OVERRIDE;
|
||||||
virtual void Focus(bool focus) OVERRIDE;
|
virtual void Focus(bool focus) OVERRIDE;
|
||||||
|
virtual bool IsFocused() OVERRIDE;
|
||||||
virtual void Show() OVERRIDE;
|
virtual void Show() OVERRIDE;
|
||||||
virtual void Hide() OVERRIDE;
|
virtual void Hide() OVERRIDE;
|
||||||
virtual void Maximize() OVERRIDE;
|
virtual void Maximize() OVERRIDE;
|
||||||
|
|
|
@ -151,6 +151,10 @@ void NativeWindowMac::Focus(bool focus) {
|
||||||
[window() orderBack:nil];
|
[window() orderBack:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NativeWindowMac::IsFocused() {
|
||||||
|
return [window() isKeyWindow];
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::Show() {
|
void NativeWindowMac::Show() {
|
||||||
[window() makeKeyAndOrderFront:nil];
|
[window() makeKeyAndOrderFront:nil];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue