1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_GTK_H_ 6 #define UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_GTK_H_ 7 8 #include <gdk/gdk.h> 9 10 #include "base/compiler_specific.h" 11 #include "ui/base/accelerators/accelerator.h" 12 #include "ui/base/accelerators/platform_accelerator.h" 13 14 namespace ui { 15 16 class Accelerator; 17 18 // This is a GTK specific class for specifing accelerator keys. 19 class UI_EXPORT PlatformAcceleratorGtk : public PlatformAccelerator { 20 public: 21 PlatformAcceleratorGtk(); 22 PlatformAcceleratorGtk(guint gdk_key_code, GdkModifierType gdk_modifier); 23 virtual ~PlatformAcceleratorGtk(); 24 25 // PlatformAccelerator: 26 virtual scoped_ptr<PlatformAccelerator> CreateCopy() const OVERRIDE; 27 virtual bool Equals(const PlatformAccelerator& rhs) const OVERRIDE; 28 gdk_key_code()29 guint gdk_key_code() const { return gdk_key_code_; } gdk_modifier()30 GdkModifierType gdk_modifier() const { return gdk_modifier_; } 31 32 private: 33 guint gdk_key_code_; 34 GdkModifierType gdk_modifier_; 35 36 DISALLOW_COPY_AND_ASSIGN(PlatformAcceleratorGtk); 37 }; 38 39 UI_EXPORT Accelerator AcceleratorForGdkKeyCodeAndModifier( 40 guint gdk_key_code, 41 GdkModifierType gdk_modifier); 42 UI_EXPORT guint GetGdkKeyCodeForAccelerator(const Accelerator& accelerator); 43 UI_EXPORT GdkModifierType GetGdkModifierForAccelerator( 44 const Accelerator& accelerator); 45 46 } // namespace ui 47 48 #endif // UI_BASE_ACCELERATORS_PLATFORM_ACCELERATOR_GTK_H_ 49