2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/integration-api/events/key-event-integ.h>
22 #include <dali/internal/event/events/key-event-impl.h>
38 state( KeyEvent::Down ),
41 deviceClass( Device::Class::NONE ),
42 deviceSubclass( Device::Subclass::NONE )
46 KeyEvent::KeyEvent( const std::string& keyName, const std::string& logicalKey, const std::string& keyString, int keyCode, int keyModifier,
47 unsigned long timeStamp, const State& keyState, const std::string& compose, const std::string& deviceName,
48 const Device::Class::Type deviceClass, const Device::Subclass::Type deviceSubclass )
51 logicalKey( logicalKey ),
52 keyString( keyString ),
54 keyModifier( keyModifier ),
58 deviceName( deviceName ),
59 deviceClass( deviceClass ),
60 deviceSubclass( deviceSubclass )
64 KeyEvent::KeyEvent( const Dali::KeyEvent& event )
66 keyName( event.keyPressedName ),
68 keyString( event.keyPressed ),
69 keyCode( event.keyCode ),
70 keyModifier( event.keyModifier ),
72 state( static_cast< Integration::KeyEvent::State >( event.state ) ),
75 deviceClass( Device::Class::NONE ),
76 deviceSubclass( Device::Subclass::NONE )
78 const Internal::KeyEventImpl* keyEventImpl = GetImplementation( &event );
79 logicalKey = keyEventImpl->GetLogicalKey();
80 compose = keyEventImpl->GetCompose();
81 deviceName = keyEventImpl->GetDeviceName();
82 deviceClass = keyEventImpl->GetDeviceClass();
83 deviceSubclass = keyEventImpl->GetDeviceSubclass();
90 Dali::KeyEvent KeyEvent::Convert( const Dali::Integration::KeyEvent& event )
92 Dali::KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state));
93 GetImplementation( &keyEvent )->SetLogicalKey( event.logicalKey );
94 GetImplementation( &keyEvent )->SetCompose( event.compose );
95 GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
96 GetImplementation( &keyEvent )->SetDeviceClass( event.deviceClass );
97 GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass );
102 } // namespace Integration