summaryrefslogtreecommitdiffstats
path: root/views/controls/textfield/native_textfield_views.h
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 01:17:17 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 01:17:17 +0000
commit188da519ad3504c0138aa0033cae30e2684ff75d (patch)
tree752cd5a19f8192b0b90657da409742ba830bcbbb /views/controls/textfield/native_textfield_views.h
parentf9597714f543497fdafabde1a0df9073f113840d (diff)
downloadchromium_src-188da519ad3504c0138aa0033cae30e2684ff75d.zip
chromium_src-188da519ad3504c0138aa0033cae30e2684ff75d.tar.gz
chromium_src-188da519ad3504c0138aa0033cae30e2684ff75d.tar.bz2
Implement double/triple click functionality in views textfield. Also changed views::Event::time_stamp_ to a platform independent time stamp.
@beng: please review views::Event changes (event.cc,event.h) @oshima: please review the rest BUG=none TEST=new tests added. Review URL: http://codereview.chromium.org/6267002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/textfield/native_textfield_views.h')
-rw-r--r--views/controls/textfield/native_textfield_views.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h
index d474a72..fb567cf 100644
--- a/views/controls/textfield/native_textfield_views.h
+++ b/views/controls/textfield/native_textfield_views.h
@@ -14,6 +14,10 @@
#include "views/controls/textfield/native_textfield_wrapper.h"
#include "views/view.h"
+namespace base {
+class Time;
+}
+
namespace gfx {
class Canvas;
} // namespace
@@ -108,6 +112,13 @@ class NativeTextfieldViews : public views::View,
// Enable/Disable TextfieldViews implementation for Textfield.
static void SetEnableTextfieldViews(bool enabled);
+ enum ClickState {
+ TRACKING_DOUBLE_CLICK,
+ TRACKING_TRIPLE_CLICK,
+ NONE,
+ };
+
+
private:
friend class NativeTextfieldViewsTest;
@@ -162,6 +173,13 @@ class NativeTextfieldViews : public views::View,
// Find a cusor position for given |point| in this views coordinates.
size_t FindCursorPosition(const gfx::Point& point) const;
+ // Mouse event handler. Returns true if textfield needs to be repainted.
+ bool HandleMousePressed(const views::MouseEvent& e);
+
+ // Helper function that sets the cursor position at the location of mouse
+ // event.
+ void SetCursorForMouseClick(const views::MouseEvent& e);
+
// Utility function to inform the parent textfield (and its controller if any)
// that the text in the textfield has changed.
void PropagateTextChange();
@@ -193,6 +211,15 @@ class NativeTextfieldViews : public views::View,
// A runnable method factory for callback to update the cursor.
ScopedRunnableMethodFactory<NativeTextfieldViews> cursor_timer_;
+ // Time of last LEFT mouse press. Used for tracking double/triple click.
+ base::Time last_mouse_press_time_;
+
+ // Position of last LEFT mouse press. Used for tracking double/triple click.
+ gfx::Point last_mouse_press_location_;
+
+ // State variable to track double and triple clicks.
+ ClickState click_state_;
+
// Context menu and its content list for the textfield.
scoped_ptr<ui::SimpleMenuModel> context_menu_contents_;
scoped_ptr<Menu2> context_menu_menu_;