Home | History | Annotate | Download | only in omnibox
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_MATRIX_H_
      6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_MATRIX_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #import "ui/base/cocoa/tracking_area.h"
     11 #include "ui/base/window_open_disposition.h"
     12 
     13 @class OmniboxPopupMatrix;
     14 
     15 class OmniboxPopupMatrixDelegate {
     16  public:
     17   // Called when the selection in the matrix changes.
     18   virtual void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) = 0;
     19 
     20   // Called when the user clicks on a row.
     21   virtual void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) = 0;
     22 
     23   // Called when the user middle clicks on a row.
     24   virtual void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix,
     25                                         size_t row) = 0;
     26 };
     27 
     28 // Sets up a tracking area to implement hover by highlighting the cell the mouse
     29 // is over.
     30 @interface OmniboxPopupMatrix : NSMatrix {
     31   OmniboxPopupMatrixDelegate* delegate_;  // weak
     32   ui::ScopedCrTrackingArea trackingArea_;
     33 }
     34 
     35 // Create a zero-size matrix.
     36 - (id)initWithDelegate:(OmniboxPopupMatrixDelegate*)delegate;
     37 
     38 // Sets the delegate.
     39 - (void)setDelegate:(OmniboxPopupMatrixDelegate*)delegate;
     40 
     41 // Return the currently highlighted row.  Returns -1 if no row is highlighted.
     42 - (NSInteger)highlightedRow;
     43 
     44 @end
     45 
     46 #endif  // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_MATRIX_H_
     47