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

Unified Diff: ui/base/event.h

Issue 10832282: Replace views::MouseEvent with ui::MouseEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « ui/app_list/search_result_list_view.cc ('k') | ui/views/color_chooser/color_chooser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/event.h
===================================================================
--- ui/base/event.h (revision 151406)
+++ ui/base/event.h (working copy)
@@ -207,6 +207,34 @@
const gfx::Point& root_location,
int flags);
+ // Conveniences to quickly test what button is down
+ bool IsOnlyLeftMouseButton() const {
+ return (flags() & ui::EF_LEFT_MOUSE_BUTTON) &&
+ !(flags() & (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON));
+ }
+
+ bool IsLeftMouseButton() const {
+ return (flags() & ui::EF_LEFT_MOUSE_BUTTON) != 0;
+ }
+
+ bool IsOnlyMiddleMouseButton() const {
+ return (flags() & ui::EF_MIDDLE_MOUSE_BUTTON) &&
+ !(flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON));
+ }
+
+ bool IsMiddleMouseButton() const {
+ return (flags() & ui::EF_MIDDLE_MOUSE_BUTTON) != 0;
+ }
+
+ bool IsOnlyRightMouseButton() const {
+ return (flags() & ui::EF_RIGHT_MOUSE_BUTTON) &&
+ !(flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON));
+ }
+
+ bool IsRightMouseButton() const {
+ return (flags() & ui::EF_RIGHT_MOUSE_BUTTON) != 0;
+ }
+
// Compares two mouse down events and returns true if the second one should
// be considered a repeat of the first.
static bool IsRepeatedClickEvent(
@@ -219,9 +247,10 @@
// Set the click count for a mousedown message. Can be 1, 2 or 3.
void SetClickCount(int click_count);
- private:
+ protected:
explicit MouseEvent(const MouseEvent& model);
+ private:
gfx::Point root_location_;
static MouseEvent* last_click_event_;
« no previous file with comments | « ui/app_list/search_result_list_view.cc ('k') | ui/views/color_chooser/color_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698