forked from appjs/appjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Linux] Basic status icon implementation
- Loading branch information
Showing
19 changed files
with
333 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <node.h> | ||
#include "appjs.h" | ||
#include "appjs_status_icon.h" | ||
#include "includes/cef_handler.h" | ||
#include "includes/util.h" | ||
|
||
extern CefRefPtr<ClientHandler> g_handler; | ||
|
||
namespace appjs { | ||
|
||
using namespace v8; | ||
|
||
StatusIcon::StatusIcon(){} | ||
StatusIcon::~StatusIcon(){} | ||
|
||
Persistent<Function> StatusIcon::constructor; | ||
|
||
void StatusIcon::Init() { | ||
DECLARE_CONSTRUCTOR("NativeStatusIcon"); | ||
DECLARE_PROTOTYPE_METHOD("show",Show); | ||
DECLARE_PROTOTYPE_METHOD("hide",Hide); | ||
END_CONSTRUCTOR(); | ||
} | ||
|
||
Handle<Value> StatusIcon::New(const Arguments& args) { | ||
HandleScope scope; | ||
|
||
Persistent<Object> options = Persistent<Object>::New(args[0]->ToObject()); | ||
Settings* settings = new Settings(options); | ||
NativeStatusIcon* statusIcon = new NativeStatusIcon(settings); | ||
|
||
Persistent<Object> self = Persistent<Object>::New(args.This()); | ||
statusIcon->SetV8Handle(self); | ||
self->SetPointerInInternalField(0, statusIcon); | ||
|
||
return scope.Close(args.This()); | ||
} | ||
|
||
Handle<Value> StatusIcon::NewInstance(const Arguments& args) { | ||
HandleScope scope; | ||
Handle<Value> argv[1] = { args[0] }; | ||
return scope.Close(constructor->NewInstance(1, argv)); | ||
} | ||
|
||
CREATE_PROTOTYPE_INVOKER(StatusIcon, Show) | ||
CREATE_PROTOTYPE_INVOKER(StatusIcon, Hide) | ||
|
||
} /* appjs */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef APPJS_STATUS_ICON_H | ||
#define APPJS_STATUS_ICON_H | ||
#pragma once | ||
|
||
#include "appjs.h" | ||
#include "native_status_icon/native_status_icon.h" | ||
|
||
namespace appjs { | ||
|
||
using namespace v8; | ||
|
||
class StatusIcon : public node::ObjectWrap { | ||
DEFINE_OBJECT_FACTORY(StatusIcon); | ||
DEFINE_PROTOTYPE_METHOD(Show); | ||
DEFINE_PROTOTYPE_METHOD(Hide); | ||
}; | ||
|
||
} /* appjs */ | ||
#endif /* end of APPJS_STATUS_ICON_H */ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "includes/cef.h" | ||
#include "includes/cef_handler.h" | ||
#include "native_status_icon/native_status_icon.h" | ||
|
||
extern CefRefPtr<ClientHandler> g_handler; | ||
|
||
namespace appjs { | ||
|
||
using namespace v8; | ||
|
||
NativeStatusIcon::NativeStatusIcon(Settings* settings){ | ||
Init(settings); | ||
} | ||
|
||
NativeStatusIcon::~NativeStatusIcon(){ | ||
} | ||
|
||
void NativeStatusIcon::Emit(Handle<Value>* args,int length){ | ||
node::MakeCallback(v8handle_, "emit", length, args); | ||
} | ||
|
||
void NativeStatusIcon::Emit(const char* event){ | ||
Handle<Value> args[1] = { String::New(event) }; | ||
Emit(args,1); | ||
} | ||
|
||
void NativeStatusIcon::Emit(const char* event, Handle<Value> arg){ | ||
|
||
Handle<Value> args[2] = { | ||
String::New(event), | ||
arg | ||
}; | ||
|
||
Emit(args,2); | ||
} | ||
|
||
} /* appjs */ |
Oops, something went wrong.