diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-10 21:31:59 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-10 21:31:59 +0000 |
commit | f704ee742d36f65d92893873f9c23e743cbc0608 (patch) | |
tree | 610817635f24e86646f7810259f5639cafec4cca /chrome/views/table_view.cc | |
parent | f7a391a1808906f50e978355e911e2f7c2c31eb2 (diff) | |
download | chromium_src-f704ee742d36f65d92893873f9c23e743cbc0608.zip chromium_src-f704ee742d36f65d92893873f9c23e743cbc0608.tar.gz chromium_src-f704ee742d36f65d92893873f9c23e743cbc0608.tar.bz2 |
Changes tree/table to pass in an appropriate location when the context
menu is invoked from the keyboard.
BUG=4029
TEST=In the bookmark manager bring up the context menu of the
tree/table via the menu key and make sure the menu appears at a
reasonable location.
Review URL: http://codereview.chromium.org/10256
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/table_view.cc')
-rw-r--r-- | chrome/views/table_view.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc index a94b9a3..7a00723 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -504,6 +504,24 @@ bool TableView::HasColumn(int id) { return all_columns_.count(id) > 0; } +gfx::Point TableView::GetKeyboardContextMenuLocation() { + int first_selected = FirstSelectedRow(); + int y = height() / 2; + if (first_selected != -1) { + RECT cell_bounds; + RECT client_rect; + if (ListView_GetItemRect(GetNativeControlHWND(), first_selected, + &cell_bounds, LVIR_BOUNDS) && + GetClientRect(GetNativeControlHWND(), &client_rect) && + cell_bounds.bottom >= 0 && cell_bounds.bottom < client_rect.bottom) { + y = cell_bounds.bottom; + } + } + gfx::Point screen_loc(0, y); + ConvertPointToScreen(this, &screen_loc); + return screen_loc; +} + void TableView::SetCustomColorsEnabled(bool custom_colors_enabled) { custom_colors_enabled_ = custom_colors_enabled; } |