diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 22:53:37 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 22:53:37 +0000 |
commit | 148d105e27c7c8c2cda0c81292690b9edafcae1f (patch) | |
tree | e278052fc84a6e5399aec5bd0d423162aecb6d16 /views/focus/accelerator_handler.h | |
parent | dc75d4823b598a9b9b313728a06f6b47d6a73929 (diff) | |
download | chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.zip chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.gz chromium_src-148d105e27c7c8c2cda0c81292690b9edafcae1f.tar.bz2 |
This CL adds accelerators to the Linux toolkit views.
The MessageLoop had to be modified to support Dispatchers on Linux.
BUG=None
TEST=On Windows and Linux, make sure the accelerators still work as expected. On Linux toolkit views, build and run the unit-tests.
Review URL: http://codereview.chromium.org/159046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus/accelerator_handler.h')
-rw-r--r-- | views/focus/accelerator_handler.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/views/focus/accelerator_handler.h b/views/focus/accelerator_handler.h new file mode 100644 index 0000000..618f541 --- /dev/null +++ b/views/focus/accelerator_handler.h @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ +#define VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ + +#if defined(OS_LINUX) +#include <gdk/gdk.h> +#endif + +#include "base/message_loop.h" + +namespace views { + +// This class delegates the key messages to the associated FocusManager class +// for the window that is receiving these messages for accelerator processing. +class AcceleratorHandler : public MessageLoopForUI::Dispatcher { + public: + AcceleratorHandler(); + // Dispatcher method. This returns true if an accelerator was processed by the + // focus manager +#if defined(OS_WIN) + virtual bool Dispatch(const MSG& msg); +#else + virtual bool Dispatch(GdkEvent* event); +#endif + + private: +#if defined(OS_LINUX) + // Last key pressed and consumed as an accelerator. + guint last_key_pressed_; +#endif + + DISALLOW_COPY_AND_ASSIGN(AcceleratorHandler); +}; + +} // namespace views + +#endif // VIEWS_FOCUS_ACCELERATOR_HANDLER_H_ |