A helper class for screen related queries. Currently only has a single method for getting the current cursor position in screen coordinates.
Review URL: http://codereview.chromium.org/112072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17322 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2009 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_SCREEN_H_
|
||||
#define VIEWS_SCREEN_H_
|
||||
|
||||
#include "base/gfx/point.h"
|
||||
|
||||
namespace views {
|
||||
|
||||
// A utility class for getting various info about screen size, monitors,
|
||||
// cursor position, etc.
|
||||
// TODO(erikkay) add more of those methods here
|
||||
class Screen {
|
||||
public:
|
||||
static gfx::Point GetCursorScreenPoint();
|
||||
};
|
||||
|
||||
} // namespace views
|
||||
|
||||
#endif // VIEWS_SCREEN_H_
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2009 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.
|
||||
|
||||
#include "views/screen.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
namespace views {
|
||||
|
||||
// static
|
||||
gfx::Point Screen::GetCursorScreenPoint() {
|
||||
gint x, y;
|
||||
gdk_display_get_pointer(NULL, NULL, &x, &y, NULL);
|
||||
return gfx::Point(x, y);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2009 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.
|
||||
|
||||
#include "views/screen.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
namespace views {
|
||||
|
||||
// static
|
||||
gfx::Point Screen::GetCursorScreenPoint() {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
return gfx::Point(pt);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
'painter.h',
|
||||
'repeat_controller.cc',
|
||||
'repeat_controller.h',
|
||||
'screen.h',
|
||||
'screen_gtk.cc',
|
||||
'screen_win.cc',
|
||||
'standard_layout.h',
|
||||
'view.cc',
|
||||
'view.h',
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário