OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/chromeos/input_method/candidate_window.h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 // like an unselected candidate. | 520 // like an unselected candidate. |
521 void Unselect(); | 521 void Unselect(); |
522 | 522 |
523 // Enables or disables the candidate row based on |enabled|. Changes the | 523 // Enables or disables the candidate row based on |enabled|. Changes the |
524 // appearance to make it look like unclickable area. | 524 // appearance to make it look like unclickable area. |
525 void SetRowEnabled(bool enabled); | 525 void SetRowEnabled(bool enabled); |
526 | 526 |
527 // Returns the relative position of the candidate label. | 527 // Returns the relative position of the candidate label. |
528 gfx::Point GetCandidateLabelPosition() const; | 528 gfx::Point GetCandidateLabelPosition() const; |
529 | 529 |
530 // Overridden from View: | |
sadrul
2011/03/19 09:15:30
views::View
Why are these moved from private to p
msw
2011/03/26 00:09:50
Done.
| |
531 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | |
532 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | |
533 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | |
534 virtual void OnMouseCaptureLost() OVERRIDE; | |
535 | |
530 private: | 536 private: |
531 // View::OnMousePressed() implementation. | |
532 virtual bool OnMousePressed(const views::MouseEvent& event); | |
533 | |
534 // View::OnMouseDragged() implementation. | |
535 virtual bool OnMouseDragged(const views::MouseEvent& event); | |
536 | |
537 // View::OnMouseReleased() implementation. | |
538 virtual void OnMouseReleased(const views::MouseEvent& event, | |
539 bool canceled); | |
540 | |
541 // Zero-origin index in the current page. | 537 // Zero-origin index in the current page. |
542 int index_in_page_; | 538 int index_in_page_; |
543 | 539 |
544 // The orientation of the candidate view. | 540 // The orientation of the candidate view. |
545 InputMethodLookupTable::Orientation orientation_; | 541 InputMethodLookupTable::Orientation orientation_; |
546 | 542 |
547 // The parent candidate window that contains this view. | 543 // The parent candidate window that contains this view. |
548 CandidateWindowView* parent_candidate_window_; | 544 CandidateWindowView* parent_candidate_window_; |
549 | 545 |
550 // Views created in the class will be part of tree of |this|, so these | 546 // Views created in the class will be part of tree of |this|, so these |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 bool CandidateView::OnMouseDragged(const views::MouseEvent& event) { | 724 bool CandidateView::OnMouseDragged(const views::MouseEvent& event) { |
729 gfx::Point location_in_candidate_window = event.location(); | 725 gfx::Point location_in_candidate_window = event.location(); |
730 views::View::ConvertPointToView(this, parent_candidate_window_, | 726 views::View::ConvertPointToView(this, parent_candidate_window_, |
731 &location_in_candidate_window); | 727 &location_in_candidate_window); |
732 // Notify the candidate window that a candidate is now being dragged. | 728 // Notify the candidate window that a candidate is now being dragged. |
733 parent_candidate_window_->OnCandidateDragged(location_in_candidate_window); | 729 parent_candidate_window_->OnCandidateDragged(location_in_candidate_window); |
734 // Request MouseReleased event. | 730 // Request MouseReleased event. |
735 return true; | 731 return true; |
736 } | 732 } |
737 | 733 |
738 void CandidateView::OnMouseReleased(const views::MouseEvent& event, | 734 void CandidateView::OnMouseReleased(const views::MouseEvent& event) { |
739 bool canceled) { | 735 // Commit the current candidate. |
740 // Commit the current candidate unless it's canceled. | 736 parent_candidate_window_->CommitCandidate(); |
741 if (!canceled) { | |
742 parent_candidate_window_->CommitCandidate(); | |
743 } | |
744 parent_candidate_window_->OnMouseReleased(); | 737 parent_candidate_window_->OnMouseReleased(); |
745 } | 738 } |
746 | 739 |
740 void CandidateView::OnMouseCaptureLost() { | |
741 parent_candidate_window_->OnMouseReleased(); | |
742 } | |
743 | |
747 CandidateWindowView::CandidateWindowView( | 744 CandidateWindowView::CandidateWindowView( |
748 views::Widget* parent_frame) | 745 views::Widget* parent_frame) |
749 : selected_candidate_index_in_page_(0), | 746 : selected_candidate_index_in_page_(0), |
750 parent_frame_(parent_frame), | 747 parent_frame_(parent_frame), |
751 candidate_area_(NULL), | 748 candidate_area_(NULL), |
752 footer_area_(NULL), | 749 footer_area_(NULL), |
753 header_area_(NULL), | 750 header_area_(NULL), |
754 header_label_(NULL), | 751 header_label_(NULL), |
755 footer_label_(NULL), | 752 footer_label_(NULL), |
756 previous_shortcut_column_width_(0), | 753 previous_shortcut_column_width_(0), |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1415 | 1412 |
1416 CandidateWindowController::~CandidateWindowController() { | 1413 CandidateWindowController::~CandidateWindowController() { |
1417 delete impl_; | 1414 delete impl_; |
1418 } | 1415 } |
1419 | 1416 |
1420 bool CandidateWindowController::Init() { | 1417 bool CandidateWindowController::Init() { |
1421 return impl_->Init(); | 1418 return impl_->Init(); |
1422 } | 1419 } |
1423 | 1420 |
1424 } // namespace chromeos | 1421 } // namespace chromeos |
OLD | NEW |