Changed StringArray options to regular js objects with boolean values for better readability from the js side
This commit is contained in:
parent
dbcd0a4235
commit
b2af370249
6 changed files with 139 additions and 80 deletions
|
@ -3,6 +3,7 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/common/event_types.h"
|
||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -40,6 +41,78 @@ const char kModifierIsAutoRepeat[] = "auto-repeat";
|
|||
const char kModifierIsLeft[] = "left";
|
||||
const char kModifierIsRight[] = "right";
|
||||
|
||||
} // namespace switches
|
||||
int modifierStrToWebModifier(std::string modifier){
|
||||
if(modifier.compare(event_types::kModifierLeftButtonDown) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::LeftButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierMiddleButtonDown) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::MiddleButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierRightButtonDown) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::RightButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kMouseLeftButton) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::LeftButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kMouseRightButton) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::RightButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kMouseMiddleButton) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::MiddleButtonDown;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierIsKeyPad) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::IsKeyPad;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierIsAutoRepeat) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::IsAutoRepeat;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierIsLeft) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::IsLeft;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierIsRight) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::IsRight;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierShiftKey) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::ShiftKey;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierControlKey) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::ControlKey;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierAltKey) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::AltKey;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierMetaKey) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::MetaKey;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierCapsLockOn) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::CapsLockOn;
|
||||
|
||||
}else if(modifier.compare(event_types::kModifierNumLockOn) == 0){
|
||||
|
||||
return blink::WebInputEvent::Modifiers::NumLockOn;
|
||||
|
||||
}else{
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace event_types
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef ATOM_COMMON_EVENT_TYPES_H_
|
||||
#define ATOM_COMMON_EVENT_TYPES_H_
|
||||
|
||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace event_types {
|
||||
|
@ -41,7 +43,9 @@ extern const char kModifierIsAutoRepeat[];
|
|||
extern const char kModifierIsLeft[];
|
||||
extern const char kModifierIsRight[];
|
||||
|
||||
} // namespace switches
|
||||
int modifierStrToWebModifier(std::string modifier);
|
||||
|
||||
} // namespace event_types
|
||||
|
||||
} // namespace atom
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue