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

Side by Side Diff: views/controls/textfield/textfield.h

Issue 5857002: no native implementation of Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 25 matching lines...) Expand all
36 // This class implements a ChromeView that wraps a native text (edit) field. 36 // This class implements a ChromeView that wraps a native text (edit) field.
37 class Textfield : public View { 37 class Textfield : public View {
38 public: 38 public:
39 // The button's class name. 39 // The button's class name.
40 static const char kViewClassName[]; 40 static const char kViewClassName[];
41 41
42 // Keystroke provides a platform-dependent way to send keystroke events. 42 // Keystroke provides a platform-dependent way to send keystroke events.
43 // Cross-platform code can use IsKeystrokeEnter/Escape to check for these 43 // Cross-platform code can use IsKeystrokeEnter/Escape to check for these
44 // two common key events. 44 // two common key events.
45 // TODO(brettw) this should be cleaned up to be more cross-platform. 45 // TODO(brettw) this should be cleaned up to be more cross-platform.
46 class Keystroke { 46 class Keystroke {
oshima 2010/12/15 17:29:06 I wonder if we need this now. Is it possible to re
47 public: 47 public:
48 #if defined(OS_WIN) 48 #if defined(OS_WIN)
49 const Keystroke(unsigned int m, 49 const Keystroke(unsigned int m,
50 wchar_t k, 50 wchar_t k,
51 int r, 51 int r,
52 unsigned int f) 52 unsigned int f)
53 : message_(m), 53 : message_(m),
54 key_(k), 54 key_(k),
55 repeat_count_(r), 55 repeat_count_(r),
56 flags_(f) { 56 flags_(f) {
57 } 57 }
58 unsigned int message() const { return message_; } 58 unsigned int message() const { return message_; }
59 wchar_t key() const { return key_; } 59 wchar_t key() const { return key_; }
60 int repeat_count() const { return repeat_count_; } 60 int repeat_count() const { return repeat_count_; }
61 unsigned int flags() const { return flags_; } 61 unsigned int flags() const { return flags_; }
62 #else 62 #else
63 explicit Keystroke(GdkEventKey* event) 63 explicit Keystroke(const KeyEvent* event)
64 : event_(*event) { 64 : event_(event) {
65 } 65 }
oshima 2010/12/15 17:29:06 This seems to be safe as Keystroke is used on stac
66 const GdkEventKey* event() const { return &event_; } 66 const GdkEventKey* event() const { return event_->native_event(); }
rjkroege 2010/12/15 21:23:31 I think we should exclude this in a touchui=1 cont
oshima 2010/12/16 01:15:19 we still need this to compile.
67 #endif 67 #endif
68 app::KeyboardCode GetKeyboardCode() const; 68 app::KeyboardCode GetKeyboardCode() const;
69 bool IsControlHeld() const; 69 bool IsControlHeld() const;
70 bool IsShiftHeld() const; 70 bool IsShiftHeld() const;
71 71
72 private: 72 private:
73 #if defined(OS_WIN) 73 #if defined(OS_WIN)
74 unsigned int message_; 74 unsigned int message_;
75 wchar_t key_; 75 wchar_t key_;
76 int repeat_count_; 76 int repeat_count_;
77 unsigned int flags_; 77 unsigned int flags_;
78 #else 78 #else
79 GdkEventKey event_; 79 const KeyEvent* event_;
80 #endif 80 #endif
81 81
82 DISALLOW_COPY_AND_ASSIGN(Keystroke); 82 DISALLOW_COPY_AND_ASSIGN(Keystroke);
83 }; 83 };
84 84
85 // This defines the callback interface for other code to be notified of 85 // This defines the callback interface for other code to be notified of
86 // changes in the state of a text field. 86 // changes in the state of a text field.
87 class Controller { 87 class Controller {
88 public: 88 public:
89 // This method is called whenever the text in the field changes. 89 // This method is called whenever the text in the field changes.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // been deleted during a window close. 223 // been deleted during a window close.
224 void SyncText(); 224 void SyncText();
225 225
226 // Returns whether or not an IME is composing text. 226 // Returns whether or not an IME is composing text.
227 bool IsIMEComposing() const; 227 bool IsIMEComposing() const;
228 228
229 #ifdef UNIT_TEST 229 #ifdef UNIT_TEST
230 gfx::NativeView GetTestingHandle() const { 230 gfx::NativeView GetTestingHandle() const {
231 return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL; 231 return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL;
232 } 232 }
233 NativeTextfieldWrapper* native_wrapper() const {
234 return native_wrapper_;
235 }
233 #endif 236 #endif
234 237
235 // Overridden from View: 238 // Overridden from View:
236 virtual void Layout(); 239 virtual void Layout();
237 virtual gfx::Size GetPreferredSize(); 240 virtual gfx::Size GetPreferredSize();
238 virtual bool IsFocusable() const; 241 virtual bool IsFocusable() const;
239 virtual void AboutToRequestFocusFromTabTraversal(bool reverse); 242 virtual void AboutToRequestFocusFromTabTraversal(bool reverse);
240 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); 243 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e);
241 virtual void SetEnabled(bool enabled); 244 virtual void SetEnabled(bool enabled);
242 virtual void PaintFocusBorder(gfx::Canvas* canvas); 245 virtual void PaintFocusBorder(gfx::Canvas* canvas);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 314
312 // Text to display when empty. 315 // Text to display when empty.
313 string16 text_to_display_when_empty_; 316 string16 text_to_display_when_empty_;
314 317
315 DISALLOW_COPY_AND_ASSIGN(Textfield); 318 DISALLOW_COPY_AND_ASSIGN(Textfield);
316 }; 319 };
317 320
318 } // namespace views 321 } // namespace views
319 322
320 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 323 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698