Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: views/controls/textfield/textfield.h

Issue 200035: First cut at implementation of FindBar for views / gtk... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: views/controls/textfield/textfield.h
===================================================================
--- views/controls/textfield/textfield.h (revision 25765)
+++ views/controls/textfield/textfield.h (working copy)
@@ -5,8 +5,13 @@
#ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
#define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
+#if defined (OS_LINUX)
+#include <gdk/gdk.h>
+#endif
+
#include "app/gfx/font.h"
#include "base/basictypes.h"
+#include "base/keyboard_codes.h"
#include "base/string16.h"
#include "views/view.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -30,28 +35,42 @@
// Cross-platform code can use IsKeystrokeEnter/Escape to check for these
// two common key events.
// TODO(brettw) this should be cleaned up to be more cross-platform.
+ class Keystroke {
+ public:
#if defined(OS_WIN)
- struct Keystroke {
Keystroke(unsigned int m,
wchar_t k,
int r,
unsigned int f)
- : message(m),
- key(k),
- repeat_count(r),
- flags(f) {
+ : message_(m),
+ key_(k),
+ repeat_count_(r),
+ flags_(f) {
}
+ unsigned int message() const { return message_; }
+ wchar_t key() const { return key_; }
+ int repeat_count() const { return repeat_count_; }
+ unsigned int flags() const { return flags_; }
+#else
+ explicit Keystroke(GdkEventKey* event)
+ : event_(*event) {
+ }
+ const GdkEventKey* event() const { return &event_; }
+#endif
+ base::KeyboardCode GetKeyboardCode() const;
+ bool IsControlHeld() const;
+ bool IsShiftHeld() const;
- unsigned int message;
- wchar_t key;
- int repeat_count;
- unsigned int flags;
- };
+ private:
+#if defined(OS_WIN)
+ unsigned int message_;
+ wchar_t key_;
+ int repeat_count_;
+ unsigned int flags_;
#else
- struct Keystroke {
- // TODO(brettw) figure out what this should be on GTK.
+ GdkEventKey event_;
+#endif
sky 2009/09/09 22:49:41 DISALLOW_COPY_AND_ASSIGN
};
-#endif
// This defines the callback interface for other code to be notified of
// changes in the state of a text field.
@@ -157,15 +176,6 @@
// been deleted during a window close.
void SyncText();
- // Provides a cross-platform way of checking whether a keystroke is one of
- // these common keys. Most code only checks keystrokes against these two keys,
- // so the caller can be cross-platform by implementing the platform-specific
- // parts in here.
- // TODO(brettw) we should use a more cross-platform representation of
- // keyboard events so these are not necessary.
- static bool IsKeystrokeEnter(const Keystroke& key);
- static bool IsKeystrokeEscape(const Keystroke& key);
-
#ifdef UNIT_TEST
gfx::NativeView GetTestingHandle() const {
return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL;

Powered by Google App Engine
This is Rietveld 408576698