Path: blob/trunk/cpp/imehandler/windows/src/winapihandler.h
2868 views
/*1Licensed to the Software Freedom Conservancy (SFC) under one2or more contributor license agreements. See the NOTICE file3distributed with this work for additional information4regarding copyright ownership. The SFC licenses this file5to you under the Apache License, Version 2.0 (the "License");6you may not use this file except in compliance with the License.7You may obtain a copy of the License at89http://www.apache.org/licenses/LICENSE-2.01011Unless required by applicable law or agreed to in writing, software12distributed under the License is distributed on an "AS IS" BASIS,13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14See the License for the specific language governing permissions and15limitations under the License.1617Author: [email protected]18*/1920#ifndef WINAPIHANDLER_H_21#define WINAPIHANDLER_H_2223#include <vector>24#include <string>25#include <utility>2627#include <windows.h>2829#include "imehandler.h"30313233// a pair representing an entry as written in the windows registry:34// HKL <-> Keyboard layout name35typedef std::pair<std::string, std::string> keyboard_layout;3637class WinapiHandler : public ImeHandler {38public:39WinapiHandler();40virtual ~WinapiHandler() {}41virtual std::string GetToggleKeys() const;42virtual std::vector<std::string> GetLoadedEngines() const;43virtual std::vector<std::string> GetAvailableEngines() const;44virtual std::string GetNextEngineKeys() const;45virtual std::string GetActiveEngine() const;46virtual bool IsActivated() const;47virtual void Deactivate();48virtual int LoadEngines(const std::vector<std::string>& engines);49virtual bool ActivateEngine(const std::string& engine);5051// The following is specific to this handler's implementation.52std::string GetSwitchingKeysForEngine(std::string engine);5354protected:55std::vector<keyboard_layout> keyboard_layouts;5657/*58* Converts from HKL hexadecimal strings to human readable59* names and vice versa.60*/61std::string GetLayoutName(std::string hkl) const;62std::string GetLayoutHkl(const std::string& name) const;63unsigned int GetHKLFromString(const std::string &) const;64/*65* Reads the registry and loads all the available layouts66* and engines.67*/68void LoadAvailableLayouts();69/*70* Return the key modifiers�@for the DWORD value usually71* taken as written in the registry.72*/73std::string GetModifiers(DWORD value);74};7576#endif // WINAPIHANDLER_H_777879